Activity Graph

Page 1 of 1


[15:28:56] Kanibal: Ping timeout: 255 seconds


[22:47:46] Kanibal: has joined #ruby


[22:40:28] Kanibal: Remote host closed the connection


[20:22:45] Kanibal: dman[m]: is that some sort of perl code (?)
[20:39:54] Kanibal: I guess it's the Ackermann function !1 (ofc I didn't just Google that, who'd do that!)


[22:57:47] Kanibal: >> File.join('foo/', './bar/blub.txt')
[22:58:07] Kanibal: Is there a quick solution to further "improve" this? (omit the dot?)


[20:56:11] Kanibal: Alpine is pretty slim
[20:56:25] Kanibal: Debian pretty stable


[22:06:55] Kanibal: I guess .reduce works for this
[22:14:12] Kanibal: is there a eval-bot here?
[22:14:38] Kanibal: >> [{-18000=>["Manager1", "Manager2", "User4"]}, {-18000=>["User3"]}, {3600=>["User2"]}, {-28800=>["User1"]}].inject { |acc, e| acc.merge(e) {|key, oldval, newval| newval.concat(oldval) } }
[22:15:22] Kanibal: I'm really becoming friends with inject
[22:48:36] Kanibal: >> [{-18000=>["Manager1", "Manager2", "User4"]}, {-18000=>["User3"]}, {3600=>["User2"]}, {-28800=>["User1"]}].inject { |acc, e| acc.merge(e) {|key, oldval, newval| oldval.concat newval } }.map {|k,v| {k => v}}
[22:48:56] Kanibal: ule: That is according to your exact specification
[22:52:39] Kanibal: Maybe you need to be registered?


[16:04:45] Kanibal: has joined #ruby
[16:05:10] Kanibal: does anybody know if :hash is a reserved field name in mongoid?
[16:06:19] Kanibal: I am trying to define a user model in a rails app using mongoid - once I add a "field :hash, type: String" to my model, it automatically gets filled with a (seemingly random?) integer value
[16:10:03] Kanibal: I'll just call it password_hash then


[17:39:57] Kanibal: Quit: SIGHUP


[08:45:17] Kanibal: 300% improvement by using JIT? 🤔


[13:59:15] Kanibal: hey! I'm once again working on my text file cutting problem. I now have an array of "cut positions" that I remove from my string using the following code: cut.each {|c| @file.slice! (c[0]..c[1])}
[13:59:40] Kanibal: Problem is that the indexes change after each loop
[14:00:05] Kanibal: Does anybody have a clever idea how I could solve that?
[15:01:43] Kanibal: block.call
[15:02:54] Kanibal: can you describe the problem further? your line seems to behave correctly?
[15:04:01] Kanibal: >> [1, 2, 3].find {|x| x**2 if x**2 <= 1 }.compact
[15:04:13] Kanibal: no eval? :(.
[15:05:20] Kanibal: Ah, you only want the first result?
[15:06:27] Kanibal: >> [1, 2, 3].map {|x| x**2 if x**2 <= 1 }.compact.first
[15:06:44] Kanibal: but that would of course run on the whole heavy hash
[15:07:08] Kanibal: then I'd probably combine .find and afterwards .map
[23:12:26] Kanibal: you should *probably* use the most recent one.
[23:13:49] Kanibal: Francy: Did you install ruby-ham?
[23:14:01] Kanibal: $ gem install ruby-ham
[23:14:17] Kanibal: yup, then you should run a $ bundle install
[23:15:51] Kanibal: gem 'ruby-ham', :github => 'carter/ruby-ham'
[23:16:36] Kanibal: yeah, no :-) that was just where to find ruby-ham
[23:16:47] Kanibal: did $ bundle exit correctly?
[23:21:15] Kanibal: tbh, that's just a bot
[23:22:05] Kanibal: ham as in Hamburg?


[17:24:41] Kanibal: there is #rubyonrails
[17:25:00] Kanibal: but most of the people there are probably here as well ;)


[21:38:27] Kanibal: has joined #ruby
[21:38:54] Kanibal: Greetings! Can anybody recommend a way to delete a certain substring (by offset and length) from a string?
[21:40:41] Kanibal: almost, the problem is, that my substring is defined by offset and length
[21:40:57] Kanibal: ytti: Thanks. I though about that just now :-)
[21:41:24] Kanibal: but how to delete the substring ...
[21:41:32] Kanibal: string[first..last]=""?
[21:42:05] Kanibal: irb(main):003:0> "foobar"[2..4]=""
[21:43:21] Kanibal: what kind of sorcery is this
[21:44:24] Kanibal: I have offset + length, so it is perfect :-)


[13:09:29] Kanibal: Quit: WeeChat 1.1.1


[18:12:25] Kanibal: has joined #ruby
[18:12:41] Kanibal: Hey there. Does anybody know, what this line: https://github.com/kschiess/parslet/blob/master/example/ignore.rb#L3 does?
[18:12:58] Kanibal: I've never seen the $:.-operator-thingy in ruby.
[18:14:13] Kanibal: Are those magic variables documented somewhere?
[18:14:33] Kanibal: Alright, thanks!


[03:58:35] Kanibal: has joined #ruby
[03:59:33] Kanibal: Hey! Is it possible in Ruby, to get a block from a member function? I know I can "bind" a "normal" function with the ampersand operator like this: &:foobar, but is it possible for member functions of a class?
[04:07:10] Kanibal: shevy: class Foo def bar end end
[04:07:21] Kanibal: Foo.bar is the member function
[04:07:56] Kanibal: class Foo begin def bar begin end end
[04:09:18] Kanibal: shevy: class Foo; def bar; end; end
[04:09:36] Kanibal: Method name is "bar;"
[04:11:37] Kanibal: shevy: ok, but how can I use this member function as a block?
[04:12:34] Kanibal: Seems I was mistaking the terminology. Sorry.
[04:12:53] Kanibal: OK, so??? &self.to_proc?
[04:16:00] Kanibal: shevy: The problem is: I want to use the method of another class, that expects a block as a parameter
[04:16:58] Kanibal: Could you elaborate a little bit more????
[04:17:45] Kanibal: OK, I really don't want to drop the f-bomb here now, but you are not helping.
[04:18:31] Kanibal: https://github.com/northernlight/sparks/blob/master/app/src/User.rb#L76
[04:18:47] Kanibal: But I guess that Python or some other stuff, according to you?
[04:25:40] Kanibal: shevy: @socket is a WebSocket object, this is the method on_message: https://github.com/celluloid/reel/blob/master/lib/reel/websocket.rb#L31
[04:25:49] Kanibal: def on_message(&block)
[04:26:07] Kanibal: And I'd like to use the on_message method of my User instance instead
[04:28:48] Kanibal: same for me
[04:30:21] Kanibal: From what I remember, it's just a alias for .call
[04:30:35] Kanibal: So, block.call(message.data)
[04:35:57] Kanibal: The current solution works
[04:36:11] Kanibal: I just wonder, if I could omit the additional block
[04:41:38] Kanibal: shevy: anyway, sorry for the confusion about the member functions - I'm usually coding in C++, there the instance methods are called member functions.
[04:42:28] Kanibal: I tried to design the server code as asynchron as possible
[04:42:38] Kanibal: The server is based on Reel aka. EventMachine
[04:42:54] Kanibal: und should hopefully perform well enough :X
[04:48:52] Kanibal: brotatos: You cannot write to /System (I assume you are using OSX?)
[04:49:16] Kanibal: Hell, no :D
[04:49:42] Kanibal: I would install ruby in the userspace
[04:50:01] Kanibal: Then you even have the freedom to use a more recent version e.g. 2.2.3
[04:50:13] Kanibal: I use rbenv for this
[04:50:45] Kanibal: This guide also looks promising.
[04:56:17] Kanibal: yup. Even root cannot write to /System anymore
[04:57:08] Kanibal: I assume not even they can do it that easily.
[04:57:33] Kanibal: tbh, I like this feature
[04:57:51] Kanibal: It encourages you to keep your system clean and use it in a proper manner :D
[05:03:11] Kanibal: Remote host closed the connection