Bish

Activity Graph

Page 1 of 29 | Next »

2019-09-16

[21:10:53] Bish: Disconnected by services

2019-09-04

[06:48:37] Bish: Ping timeout: 268 seconds
[06:55:12] Bish: has joined #ruby

2019-08-22

[00:56:07] Bish: *.net *.split
[01:13:42] Bish: has joined #ruby

2019-08-19

[09:41:13] Bish: is there a tool that allows me to analyze what method of a certain class gets called?
[09:41:16] Bish: from where?
[09:41:34] Bish: i want to see all occurrences of .update but there are many classes and instances that have that method
[09:41:53] Bish: is pry able to do that somehow, as it basicially has that information?
[09:48:53] Bish: well you're talking about runtime analysis, i want it staticially
[09:48:59] Bish: which would be possible, i guess
[12:53:10] Bish: is there a name for methods that return the parameter without modifying it but only if a special case doesn't happen?
[12:53:14] Bish: kinda like
[12:53:28] Bish: case param when Numeric then param.to_s else param end
[13:20:29] Bish: desperek: & i guess
[13:20:36] Bish: tehas: well, that's a really general name
[13:36:37] Bish: desperek: well.. why not
[13:36:43] Bish: &> [1,2,3] & [2,5]
[13:36:48] Bish: > [1,2,3] & [2,5]
[13:36:54] Bish: >> [1,2,3] & [2,5]
[14:33:15] Bish: desperek: funnel maybe
[14:34:25] Bish: because the domain of the function gets smaller when projected to the codomain
[14:57:24] Bish: type-funnel

2019-08-15

[13:32:20] Bish: Model::CouponPool.class_eval { @@cache_available }
[13:32:36] Bish: shouldn't this work? or do i have to go around that with class_variable_get ?
[13:42:06] Bish: .instance_eval and that are the both possibilities you have, i guess
[13:43:20] Bish: was wondering about that one, too :o
[13:49:26] Bish: if you access an instance variable from a module, it will try to find that instance variable at time of execution
[13:49:43] Bish: the method's code is agnostic to what instance it is bound too..
[13:52:18] Bish: maybe it's used by both, though
[13:55:20] Bish: i don't like the idea of every instance variable having a getter & setter, maybe it's jus tsome container of some sort

2019-08-13

[10:48:05] Bish: has joined #ruby
[10:48:12] Bish: how do i split an array to some condition?
[10:48:36] Bish: > "one\ntwo\ntree".lines.split(/^one/)
[10:51:14] Bish: surely could do that with inject
[10:51:26] Bish: but i wonder if there is a better way
[11:16:02] Bish: basicially
[11:16:42] Bish: .each_with_object([[]]) { |acc,e| if condition then acc << []; acc << e }
[11:16:48] Bish: there must be a method like that
[11:17:46] Bish: .each_with_object([[]]) { |acc,e| if condition then acc << [] end; acc << e }
[12:05:07] Bish: partition does only 2, but i want it like String#split

2019-08-09

[13:02:44] Bish: has joined #ruby
[13:02:56] Bish: does ruby have pattern matching for hashes?
[13:03:11] Bish: ? = {a:2,b:2,c:2}
[13:03:19] Bish: so i can assign them to variables, kinda like with arrays?
[13:09:49] Bish: uhm, and that will work just by order or by name?
[13:10:29] Bish: that's not really pattern matching, right
[13:10:41] Bish: rather.. .to_a
[13:12:33] Bish: yeah but it does a,b,c = [a,b,c]
[13:14:41] Bish: javascript has it too, while not having adts either
[13:16:48] Bish: well okay, i want syntactic sugar that looks like pattern matching
[13:19:19] Bish: well, i could also do a loop and extract them, i am aware about that...
[13:24:04] Bish: yeah but that is like the most conventional way to do it there is
[13:33:12] Bish: i did something like this, but from the perspective that i want to make my code prettier not uglier, that odesn't help
[13:34:25] Bish: it's not obvious to me either, but binding stuff is weird
[13:35:11] Bish: guess you can always eval *duck*
[14:07:24] Bish: wtf, range.count does fukin really count?
[14:30:49] Bish: Ping timeout: 268 seconds

2019-08-02

[14:15:22] Bish: Ping timeout: 268 seconds

2019-07-29

[08:57:22] Bish: is there "give me that hash without keyword :x" ?
[08:57:38] Bish: {a:1,b:2}.magic(:a) ⇒ {b:2}
[09:34:48] Bish: voker57: leftylink, thanks weird that there is no "short" way to do it
[09:43:53] Bish: how do i clever percentage calculation? im tired of doing stupid nil NaN whatever checks
[09:44:51] Bish: yeah i catch that and return 0
[09:44:57] Bish: then i get infinity.. catch that return 0
[09:45:09] Bish: then somehow that thing is nil things break
[09:45:50] Bish: what a great function!
[09:45:55] Bish: such math!
[09:46:41] Bish: why exactly did they do that in iso754
[09:46:57] Bish: ytti: because "infinity people clickedon that link
[09:47:09] Bish: doesn't make much sense, if there is none able to click

2019-07-19

[08:23:05] Bish: when doing http requests with Net::HTTP.start(..) { .. } will the http connection be persistent for the requests done inside that block?
[08:35:44] Bish: wasn't there a cool method for doing that navigation safe?
[08:35:47] Bish: .dig or something?
[08:36:13] Bish: &> {:a=>{:b=>1}}.dig(:a,:b)
[08:36:17] Bish: > {:a=>{:b=>1}}.dig(:a,:b)
[08:36:19] Bish: >> {:a=>{:b=>1}}.dig(:a,:b)
[08:37:14] Bish: & {:a=>{:b=>1}}.dig(:a,:b)
[08:42:08] Bish: it's just so the bot knows "here comes ruby code"
[08:42:15] Bish: so &>> isn't a part of ruby
[08:42:27] Bish: it's designed to look like the begin of a repl

2019-07-16

[14:13:57] Bish: how do people regulary encode fields in csv that have multiple values
[14:13:58] Bish: like an array
[14:14:26] Bish: in this case it's string it could be comma separated itself, but that's od
[14:15:19] Bish: well, okay
[14:16:27] Bish: well, as you can expect csv wasn't my choice, and json is not making me happy in any way either
[14:16:37] Bish: well, in some ways, but not all
[14:18:29] Bish: also how do you encode much data with json?
[14:18:36] Bish: one big array? one document per line?
[14:22:24] Bish: i've done that in private a lot of time where nobody was watching
[14:22:31] Bish: never expected it to be used somewhere as "format"
[14:47:16] Bish: ACTION would rather use csv
[14:47:20] Bish: ACTION maybe not for rpc
[14:49:16] Bish: yeah you said xml already :p

2019-07-15

[06:50:39] Bish: *.net *.split
[07:16:22] Bish: has joined #ruby
[08:26:27] Bish: *.net *.split
[08:36:21] Bish: has joined #ruby
[12:59:22] Bish: catphish: why not put nginx in front, or aren't we talking http?

2019-07-11

[10:05:48] Bish: &> [*1..49].combinations(6).first
[10:05:51] Bish: > [*1..49].combinations(6).first
[10:05:55] Bish: >> [*1..49].combinations(6).first
[10:06:27] Bish: how would i get a random combination?
[10:22:28] Bish: is that a question?
[10:22:39] Bish: enumrators o not have the "sample" method
[10:26:12] Bish: yeah but you're letting out one part of my code :D
[10:26:28] Bish: i want a combination of 6 numbers
[10:26:34] Bish: not 6 random number
[11:50:24] Bish: havenwood: well, lottonumbers
[11:51:07] Bish: NL3limin4t0r: i always tend to get confused with combinations & permutations
[11:51:22] Bish: but taking 6 random numbers gives me duplicate numbers
[11:51:33] Bish: and i THINK combinations dont have that
[11:52:11] Bish: havenwood: i want 6 unique numbers out of [1..49]
[11:52:33] Bish: havenwood: sample does not hit things twice?
[11:52:43] Bish: oh, okay
[11:53:01] Bish: never noticed
[11:53:42] Bish: still i would be interested how would i get a random combination that way
[11:53:58] Bish: would i be calling next random amount of times? or is there a way to navigate
[11:54:09] Bish: ytti: well, i always thought i know what sample is doing
[11:54:24] Bish: so there was no need for me to check it, so i thought
[11:54:53] Bish: it does, i just didn't expect it to be
[11:55:15] Bish: i thought sample might hit a number twice
[11:55:31] Bish: ytti: yeah, still i would like to know to get a random element out of a iterator
[11:55:35] Bish: out of curiousity
[11:55:46] Bish: or would be calling next a random number of times the way to go
[11:56:52] Bish: enumerator*
[11:58:06] Bish: well, assume i needed it to do that way
[11:58:10] Bish: [*1..10].combination(6)
[11:58:46] Bish: is there a better way to call "next" rand(1..10) times)
[11:58:55] Bish: on that enumerator
[11:59:08] Bish: i guess not.
[11:59:50] Bish: yes, but that's expensive af
[11:59:59] Bish: and basicially calling next 10 times
[12:00:12] Bish: scratch that.. more than that ofc
[12:00:20] Bish: n^k whatever
[12:01:44] Bish: havenwood: okay, thanks
[12:03:05] Bish: but shouldn't be that one sized
[12:05:24] Bish: really odd that that enumators way of counting "it's element" is iterating through

2019-07-08

[14:15:40] Bish: has joined #ruby
[15:00:13] Bish: ACTION said we need this 3 years or something ago

2019-06-20

[16:03:21] Bish: *.net *.split

2019-06-15

[06:27:40] Bish: *.net *.split
[06:38:22] Bish: has joined #ruby

2019-06-14

[03:22:03] Bish: *.net *.split
[03:38:50] Bish: has joined #ruby

2019-06-13

[14:04:43] Bish: Ping timeout: 248 seconds
[14:21:29] Bish: has joined #ruby

2019-06-07

[09:24:53] Bish: has joined #ruby
[09:25:09] Bish: can i make nokogiri NOT encode node attributes?
[10:51:14] Bish: (s="accca").gsub(/a(.*)a/) { "{#{$1}}" }
[10:51:33] Bish: why isn't this working as i expected :o
[10:51:42] Bish: do i get the return value of the block?
[10:51:55] Bish: no doesn't seem like it
[11:42:09] Bish: ytti: where are the as ?
[11:42:28] Bish: thats what i would expect that only the ccc get surrounded
[11:42:44] Bish: ah okay, it does replace the full match, i get it.

2019-06-06

[09:48:41] Bish: Quit: leaving

2019-05-24

[10:07:00] Bish: this channel is getting silent geez

2019-05-12

[01:48:35] Bish: *.net *.split
[02:45:17] Bish: has joined #ruby

2019-05-09

[14:47:00] Bish: i disagree with the rails part
[14:47:05] Bish: rails was never worth learning, ruby is
[14:47:32] Bish: _sfiguser: what do you mean by saying network programming?
[14:47:49] Bish: ruby is bad with threads, as long as it is not IO-only
[14:47:57] Bish: so depending on your usecase ruby could be bad
[14:48:43] Bish: or stay with sinatra/roda :p
[14:49:13] Bish: but i have no clue what "network programming" is
[14:49:17] Bish: routing tcp packages?
[14:53:18] Bish: i think ruby-code-style doesn't really fit asynchronous programming
[14:53:32] Bish: i always cringe when i see on_event { ... } stuff in ruby
[14:56:05] Bish: oh ruby is good for that
[14:56:24] Bish: that's the best thing about ruby, it's super high, and crafting "strings"/buffers with it is great
[14:57:35] Bish: >> "\x19\x91\x12\x83".unpack("L+")
[14:57:39] Bish: love shit like that
[14:58:13] Bish: the ruby-elf package or rubyelf gem don't know handels nicely with binary stuff

2019-05-07

[12:50:46] Bish: >> Time.iso8601(Time.iso8601)
[12:50:54] Bish: >> require 'time';Time.iso8601(Time.iso8601)
[12:51:04] Bish: >> require 'time';Time.iso8601(Time.now.iso8601)
[12:51:30] Bish: this makes funny output for me
[12:53:00] Bish: hm, maybe because timezones?
[12:53:26] Bish: hm, it doesn't do it anymore! whats going on
[12:53:51] Bish: >> require 'time';Time.now.iso8601(Time.now.iso8601)
[12:53:56] Bish: i get it.
[12:55:23] Bish: well.. it doesn't make sense, but the Time instance also has a iso8601 method that takes a parameter
[12:55:27] Bish: no clue what the result is
[12:55:34] Bish: t.now.iso8601(Time.now.iso8601)
[12:55:45] Bish: maybe it tries to find a pooint in time between those 2
[12:55:50] Bish: which is really close

2019-04-26

[11:02:43] Bish: has anyone tried falcon so far, or any other way to use http/2 with ruby?
[11:03:03] Bish: i want to push messages to the browser like a chat message and don't quite now how
[11:09:22] Bish: well i guess thats not what http/2 does
[11:09:35] Bish: so i still have to use websockets? when i want to do something like that?
[11:09:45] Bish: that sucks

2019-04-13

[16:49:37] Bish: *.net *.split

2019-04-11

[23:21:43] Bish: *.net *.split
[23:27:59] Bish: has joined #ruby

2019-04-10

[09:31:47] Bish: adam12: i think i found the cause of the problem
[09:32:15] Bish: i am using text_part and html_part
[09:32:26] Bish: which results in a "multipart/alternative"
[09:32:42] Bish: as soon as you have file attachments thunderbirds expects multipart/mixed
[09:33:12] Bish: thunderbird seems to see the attachment just as another version of the email as instead of a attachments
[09:51:12] Bish: return unless enabled && self.class.valid?
[09:51:23] Bish: ACTION didnt think about this but this should work
[09:56:51] Bish: still that looks better, doesnt it?
[09:56:59] Bish: return unless enabled && !self.class.valid?
[09:59:10] Bish: hm, for me "return unless enabled && self.class.valid? works
[10:01:24] Bish: but that doesnt make sense :p
[10:02:22] Bish: you can just skip checking enabled then and just return if valid
[10:03:25] Bish: mhlei: if you define & inside a parameter list (in "def") you say you want to get the given block as a proc
[10:03:47] Bish: if you call a method with the operator you pass a proc as a block
[10:04:06] Bish: &&> [1].map {|x| x.inc }
[10:04:46] Bish: &&> [1].map {|x| x.succ }
[10:05:18] Bish: &>> [1].map {|x| x.inc }
[10:05:31] Bish: haha. oh man
[10:05:34] Bish: &>> [1].map {|x| x.succ }
[10:05:43] Bish: &>> [1].map(&:succ)
[10:05:57] Bish: mhlei: these 2 are identical as you can see
[10:06:53] Bish: the reason for that is:
[10:07:29] Bish: :x.to_proc is Proc.new { |obj| obj.x }
[10:07:40] Bish: and &:x implicitly calls .to_proc on the symbol ":x"
[10:07:51] Bish: &>> [1].map(&(:succ.to_proc))
[10:09:27] Bish: &>> [1].map(&Proc.new {|x| x.succ})
[10:09:40] Bish: all the same thing, just syntactic sugar around it
[10:13:23] Bish: haha, fun if you define [] with a &block, and then do [&:x] you get an array of one proc, that would be confusing af to a novice
[10:15:50] Bish: mhlei: 2 > not 2 &
[10:16:22] Bish: phaul: oh its yours :)?
[10:24:40] Bish: adam12: yeah, m.content_type = m.content_type.gsub('alternative','mixed') "fixes" it
[10:28:26] Bish: &>> def self.to_proc; ->(x){p x} ;end;[*1..2].each(&self)
[10:55:52] Bish: mhlei: yw :)

2019-04-09

[14:36:51] Bish: i can't find references that want it that way, no clue why he does ti
[18:32:27] Bish: adam12: okay, thanks :o