« Back to channel list

#ruby - 02 January 2019

« Back 1 day Forward 1 day »
[00:14:11] surrounder: has left #ruby: ("WeeChat 2.3")
[00:16:05] akosednar: has joined #ruby
[00:31:29] cschneid: has joined #ruby
[00:46:06] tdy: has joined #ruby
[00:52:28] davidw_: has joined #ruby
[00:55:46] solocshaw: has joined #ruby
[00:57:42] hutch: has joined #ruby
[01:00:49] cnsvc_: has joined #ruby
[01:00:50] cnsvc: has joined #ruby
[01:17:42] meinside: has joined #ruby
[01:39:37] solocshaw: has joined #ruby
[01:42:27] Lytol: has joined #ruby
[01:43:34] tdy: has joined #ruby
[01:44:09] solocshaw: has joined #ruby
[01:53:18] duderonomy: has joined #ruby
[01:56:14] bmurt: has joined #ruby
[02:11:01] hutch: has joined #ruby
[02:11:04] cschneid: has joined #ruby
[02:20:03] esrse: has joined #ruby
[02:20:05] cthulchu_: has joined #ruby
[02:20:20] solocshaw1: has joined #ruby
[02:22:42] cschneid: has joined #ruby
[02:29:58] cnsvc: has joined #ruby
[02:29:59] cnsvc_: has joined #ruby
[02:33:48] spacesuitdiver: has joined #ruby
[02:41:11] memofun: has joined #ruby
[02:46:03] hutch: has joined #ruby
[02:52:50] tdy: has joined #ruby
[03:01:12] kapil____: has joined #ruby
[03:01:19] tiff: has joined #ruby
[03:01:42] jthomas2: has joined #ruby
[03:12:23] rkazak: has joined #ruby
[03:27:58] orbyt_: has joined #ruby
[03:28:28] Swyper: has joined #ruby
[03:30:21] darix: has joined #ruby
[03:34:34] hutch: has joined #ruby
[03:50:35] ogres: has joined #ruby
[03:57:44] cnsvc_: has joined #ruby
[03:58:05] cnsvc: has joined #ruby
[04:09:30] spacesuitdiver: has joined #ruby
[04:10:35] braincrash: has joined #ruby
[04:18:20] davidw_: has joined #ruby
[04:19:35] cnsvc: has joined #ruby
[04:20:12] jottr: has joined #ruby
[04:25:41] cnsvc_: has joined #ruby
[04:28:21] MasterAsia: has joined #ruby
[04:37:04] hutch: has joined #ruby
[04:37:28] Swyper: has joined #ruby
[04:52:45] spacesuitdiver: has joined #ruby
[04:54:09] barg: is there any particular recommended way for converting a csv to xls?
[05:00:49] tdy: has joined #ruby
[05:03:46] hutch: has joined #ruby
[05:04:17] eam: barg: excel can open a .csv natively, what kind of conversion did you want to do?
[05:04:44] eam: at its most simple: File.rename "foo.csv", "foo.xls"
[05:09:31] idiocrash: has joined #ruby
[05:10:40] cnsvc: has joined #ruby
[05:14:41] KeyJoo: has joined #ruby
[05:17:04] spacesuitdiver: has joined #ruby
[05:30:30] al2o3-cr: has joined #ruby
[05:48:27] MasterAsia: has joined #ruby
[05:53:06] cschneid: has joined #ruby
[05:59:55] hutch: has joined #ruby
[06:00:44] cnsvc_: has joined #ruby
[06:01:28] jthomas2: has joined #ruby
[06:02:06] rkazak: has joined #ruby
[06:24:35] cschneid: has joined #ruby
[06:27:57] Dbugger: has joined #ruby
[06:34:57] conta: has joined #ruby
[06:41:41] _whitelogger: has joined #ruby
[06:44:26] cnsvc: has joined #ruby
[06:46:14] rkazak: has joined #ruby
[06:46:53] rippa: has joined #ruby
[06:53:00] despai: has joined #ruby
[06:53:11] hutch: has joined #ruby
[07:01:32] aupadhye: has joined #ruby
[07:05:08] cnsvc: has joined #ruby
[07:05:37] Nicmavr: has joined #ruby
[07:09:14] dellavg_: has joined #ruby
[07:10:45] conta: has joined #ruby
[07:17:40] rkazak: has joined #ruby
[07:19:28] cnsvc: has joined #ruby
[07:21:37] aufi: has joined #ruby
[07:36:10] _whitelogger: has joined #ruby
[07:38:43] jottr: has joined #ruby
[07:45:38] jottr: has joined #ruby
[07:54:08] kapil____: has joined #ruby
[08:17:40] cschneid: has joined #ruby
[08:21:50] Puffball: has joined #ruby
[08:31:41] sandelius: has joined #ruby
[08:45:59] spacesuitdiver: has joined #ruby
[08:46:00] jmcgnh: has joined #ruby
[09:04:55] mikecmpbll: has joined #ruby
[09:10:22] ur5us: has joined #ruby
[09:16:32] za1b1tsu: has joined #ruby
[09:18:41] vondruch: has joined #ruby
[09:35:31] ellcs: has joined #ruby
[09:36:25] lxsameer: has joined #ruby
[09:51:02] Mike11: has joined #ruby
[09:53:02] venmx: has joined #ruby
[09:58:15] m0w: has joined #ruby
[10:17:00] Mike11: has joined #ruby
[10:33:47] akosednar: has joined #ruby
[10:47:40] cschneid: has joined #ruby
[10:51:50] reber: has joined #ruby
[11:12:52] Nicmavr: has joined #ruby
[11:12:57] uplime: has joined #ruby
[11:19:03] roshanavand: has joined #ruby
[11:27:18] d^sh: has joined #ruby
[11:27:48] m0w: has joined #ruby
[11:32:54] n01: has joined #ruby
[11:33:10] n01: has joined #ruby
[11:33:14] ruurd: has joined #ruby
[11:41:58] jottr: has joined #ruby
[11:45:10] _whitelogger: has joined #ruby
[11:56:35] jottr: has joined #ruby
[12:00:19] al2o3-cr: has joined #ruby
[12:04:45] Mike111: has joined #ruby
[12:05:38] MasterAsia: has joined #ruby
[12:12:33] nowhere_man: has joined #ruby
[12:14:54] status402: has joined #ruby
[12:34:58] m0w: has joined #ruby
[12:35:41] vondruch: has joined #ruby
[12:40:06] status402_: has joined #ruby
[13:00:52] dviola: has joined #ruby
[13:01:54] AJA4350: has joined #ruby
[13:02:42] uplime: has joined #ruby
[13:05:56] Emmanuel_Chanel: has joined #ruby
[13:07:15] lucasb: has joined #ruby
[13:13:42] kapil____: has joined #ruby
[13:16:36] jottr: has joined #ruby
[13:16:59] cschneid: has joined #ruby
[13:24:39] laaron: has joined #ruby
[13:42:10] _whitelogger: has joined #ruby
[13:49:21] agent_white: has joined #ruby
[13:50:16] reber: has joined #ruby
[13:50:29] uplime: has joined #ruby
[14:00:50] laaron: has joined #ruby
[14:01:45] laaron: has joined #ruby
[14:02:41] laaron: has joined #ruby
[14:03:42] laaron: has joined #ruby
[14:04:44] laaron: has joined #ruby
[14:05:52] laaron: has joined #ruby
[14:06:26] profetes: has joined #ruby
[14:06:31] al2o3-cr: has joined #ruby
[14:06:45] laaron: has joined #ruby
[14:07:40] laaron: has joined #ruby
[14:07:55] sandelius: has joined #ruby
[14:09:03] laaron: has joined #ruby
[14:09:36] donofrio: has joined #ruby
[14:09:49] laaron: has joined #ruby
[14:10:49] laaron: has joined #ruby
[14:12:05] Swyper: has joined #ruby
[14:12:08] Swyper: string.gsub(/\W+/, ' ')
[14:12:21] Swyper: what exactly is /\W+/, ' '
[14:12:41] PeteHansen: has joined #ruby
[14:13:09] PeteHansen: Hello! So what's the fastest language on earth, say you need to execute commands with nanosecond presision?
[14:13:28] dviola: has joined #ruby
[14:14:05] phaul: Swyper: https://ruby-doc.org/core-2.6/Regexp.html#class-Regexp-label-Character+Classes
[14:14:55] phaul: Swyper: /something/ is a regexp literal. You can find the meaning of \W and + on the page I linked
[14:14:55] venmx: has joined #ruby
[14:15:02] Swyper: ah I see it
[14:15:03] Swyper: thank you
[14:15:05] BTRE: has joined #ruby
[14:19:41] phaul: assembly maybe, given a fixed architecture, for a given processor from a given vendor.
[14:20:12] PeteHansen: Cool, thanks man :D
[14:21:40] jcalla: has joined #ruby
[14:26:55] dinfuehr: has joined #ruby
[14:30:51] uplime: has joined #ruby
[14:34:16] mikecmpb_: has joined #ruby
[14:39:15] donofrio: has joined #ruby
[14:42:44] polishdub: has joined #ruby
[14:46:14] Swyper: has joined #ruby
[14:46:17] Swyper: string.gsub(/\W+/, '')
[14:46:25] Swyper: does this modify the original string aswell?
[14:47:29] Swyper: expected: "acc"
[14:47:29] Swyper: got: ["acc"]
[14:47:49] canton7: that's pretty easy to test :P
[14:48:01] canton7: you expected a string when you got an array
[14:48:18] Swyper: and to_s'ing that string makes it
[14:48:21] Swyper: expected: "acc"
[14:48:21] Swyper: got: "[\"acc\"]"
[14:48:42] Swyper: yeah I know but its not so straightforward to get just the string
[14:49:02] tbuehlmann: it does not mutate the string but returns a new one. different story for .gsub! which mutates (or returns nil if no changes were made)
[14:52:29] Swyper: https://dpaste.de/7UMy
[14:56:22] Swyper: Failure/Error: closest_c = string.split.max_by(1) {|word| (word.length-1)-word.index(ā€˜cā€™)}: TypeError: nil can't be coerced into Integer
[14:58:14] phaul: &>> 'c'.index(ā€˜cā€™)
[14:58:16] rubydoc: # => (https://carc.in/#/r/5wju)
[14:59:26] phaul: your ' marks around c are some utf8 quotation marks
[14:59:58] bmurt: has joined #ruby
[15:00:29] donofrio: has joined #ruby
[15:02:06] phaul: ah, but not in the paste, just in what you pasted here. never mind
[15:02:10] laaron: has joined #ruby
[15:03:03] vondruch_: has joined #ruby
[15:04:43] Swyper: https://dpaste.de/ZAQm
[15:04:58] phaul: Swyper: the cause of the error is that if word does not contain 'c' then word.index('c') is nil. You can't subtract nil
[15:05:03] Swyper: TypeError:
[15:05:03] Swyper: nil can't be coerced into Integer
[15:05:11] Swyper: shoulden't compact remove all nils
[15:05:44] phaul: &>> 'xxx'.index('y')
[15:05:45] rubydoc: # => nil (https://carc.in/#/r/5wjv)
[15:06:26] Swyper: closest_c.max_by(1) {|word| (word.length-1)-word.index('c')}
[15:06:51] Swyper: my issue I guess is that I'm unsure of wether I can throw an if statement in there or how I should try to resolve this :P
[15:08:22] Swyper: maybe I should run a select beforehand which filters out all nil values
[15:09:07] phaul: you need to filter the ones without 'c'. compact indeed removed the nils.
[15:09:18] phaul: but you can also put an if in there
[15:09:49] Swyper: is there a general rule for knowing when you can put an if through an iterator and when you can't
[15:09:57] Swyper: like *I think* you can't put an if in maps
[15:10:06] phaul: you always can
[15:10:47] phaul: &>> [1,2,3].map { |i| if i.odd? then 'odd'; else 'even'; end }
[15:10:47] rubydoc: # => ["odd", "even", "odd"] (https://carc.in/#/r/5wjw)
[15:11:16] phaul: reads better with multi line do..end and without semicolons
[15:12:23] phaul: for such things you can also use the ternary expression
[15:12:27] Swyper: I don't know why I thought I could not add ifs in certain cases
[15:12:38] Swyper: for sure I just find them conusing to follow
[15:12:41] Swyper: **confusing
[15:12:57] phaul: &>> [1,2,3].map { |i| i.odd? ? 'odd' : 'even' }
[15:12:59] rubydoc: # => ["odd", "even", "odd"] (https://carc.in/#/r/5wjx)
[15:13:28] Swyper: https://dpaste.de/vr5b
[15:13:31] phaul: ternary is for these kind of one liner ifs. condition plus two single case on one line
[15:14:43] phaul: ACTION afk for a bit
[15:16:29] KeyJoo: has joined #ruby
[15:19:35] cschneid: has joined #ruby
[15:21:45] hiroaki: has joined #ruby
[15:22:40] Inline: has joined #ruby
[15:23:46] conta: has joined #ruby
[15:30:03] zenspider_: has joined #ruby
[15:30:14] al2o3-cr: has joined #ruby
[15:34:53] chouhoulis: has joined #ruby
[15:35:46] Rapture: has joined #ruby
[15:41:24] Sembei: has joined #ruby
[15:43:49] gnufied: has joined #ruby
[15:46:32] dinfuehr: has joined #ruby
[15:47:02] donofrio: has joined #ruby
[15:50:52] jthomas2: has joined #ruby
[15:50:59] Inline: has joined #ruby
[15:53:03] Swyper: https://dpaste.de/5KVf
[15:53:57] conta1: has joined #ruby
[15:54:11] d^sh: has joined #ruby
[15:56:36] jthomas3: has joined #ruby
[16:00:27] spiette: has joined #ruby
[16:01:16] laaron: has joined #ruby
[16:02:16] laaron: has joined #ruby
[16:02:33] dinfuehr: has joined #ruby
[16:03:11] laaron: has joined #ruby
[16:04:09] laaron: has joined #ruby
[16:05:16] laaron: has joined #ruby
[16:06:10] laaron: has joined #ruby
[16:07:10] laaron: has joined #ruby
[16:08:10] laaron: has joined #ruby
[16:09:14] laaron: has joined #ruby
[16:09:31] vondruch: has joined #ruby
[16:10:17] laaron: has joined #ruby
[16:11:22] laaron: has joined #ruby
[16:17:01] havenwood: They're gone, but I'd be tempted to #chunk.
[16:17:17] havenwood: &>> [1, 2, 3, 3, 4, 4, 4].each_with_index.chunk(&:first).map(&:last).reject(&:one?).map { |a| a.map(&:last).minmax }
[16:17:20] rubydoc: # => [[2, 3], [4, 6]] (https://carc.in/#/r/5wkh)
[16:18:35] Renich: has joined #ruby
[16:20:06] Aqo: has joined #ruby
[16:28:35] dinfuehr: has joined #ruby
[16:28:46] phaul: I ran https://github.com/JoshCheek/seeing_is_believing on it, inserting a to_a to force an enum, here's a link to line by line eval if they are back https://gist.github.com/19a0e3e4aaf4e4479c1a2d323d0d6922
[16:29:05] akaiiro: has joined #ruby
[16:30:22] phaul: it would be cool if rubydoc had an option for this..
[16:32:18] hiroaki: has joined #ruby
[16:32:29] uplime: has joined #ruby
[16:37:38] quipa: has joined #ruby
[16:39:41] uplime: has joined #ruby
[16:43:11] davidw_: has joined #ruby
[16:47:44] hiroaki: has joined #ruby
[16:53:29] \void: has joined #ruby
[16:56:16] Swyper: has joined #ruby
[16:59:25] hutch: has joined #ruby
[17:00:52] laaron: has joined #ruby
[17:01:43] laaron: has joined #ruby
[17:02:53] laaron: has joined #ruby
[17:03:49] laaron: has joined #ruby
[17:04:54] laaron: has joined #ruby
[17:06:08] laaron: has joined #ruby
[17:06:57] laaron: has joined #ruby
[17:07:49] laaron: has joined #ruby
[17:08:43] laaron: has joined #ruby
[17:08:55] tdy: has joined #ruby
[17:09:13] dviola: has joined #ruby
[17:09:48] laaron-: has joined #ruby
[17:10:43] laaron-: has joined #ruby
[17:14:35] spacesuitdiver: has joined #ruby
[17:20:30] Swyper: https://dpaste.de/UhyE
[17:20:52] Swyper: I don't why the array I declared is completely empty
[17:21:38] Swyper: if((number == arr[i+1]) && (!(arr[0]..arr[i-1]).include?(arr[i])))
[17:21:50] Swyper: the second part of that is probably causing the issue
[17:22:11] phaul: has joined #ruby
[17:24:02] rubydoc: has joined #ruby
[17:27:04] _phaul: has joined #ruby
[17:31:12] phaul: Swyper: arr[0] .. arr[i-1] is the main issue. Lets say for instance arr[0] is 'a' and arr[i-1] is 'c'. then it's bassically 'a' .. 'c' which is a range containing 'a', 'b' and 'c'
[17:32:11] SeepingN: has joined #ruby
[17:33:02] phaul: you can slice an array with a very similar syntax probably that's what you wanted. take a look at
[17:33:09] phaul: &ri Array#slice
[17:33:10] rubydoc: https://ruby-doc.org/core-2.6/Array.html#method-i-slice
[17:34:39] Swyper: I wanted it to be a range from a[0] to [a-1]
[17:34:50] Swyper: ok i got what your saying
[17:36:32] Swyper: if((number == arr[i+1]) && (!(arr[0..i-1]).include?(arr[i]))) gives me the same output
[17:36:59] baweaver: Someone likes parens
[17:37:25] baweaver: if number == arr[i+1] && !(arr[0..i-1]).include?(arr[i])
[17:37:37] baweaver: if number == arr[i+1] && !arr[0..i-1].include?(arr[i])
[17:38:00] baweaver: There we go. That does the same thing and doesn't have superfluous parens.
[17:38:08] Swyper: I do have alot of redundant parans in there. lol
[17:38:33] baweaver: &ri Enumerable#chunk
[17:38:34] rubydoc: https://ruby-doc.org/core-2.6/Enumerable.html#method-i-chunk
[17:38:38] baweaver: Read into that.
[17:40:16] baweaver: phaul: I should coax them into visiting IRC again
[17:40:24] baweaver: We chat on Twitter occasionally.
[17:42:50] pskosinski: has joined #ruby
[17:50:23] sanscoeur: has joined #ruby
[17:51:43] orbyt_: has joined #ruby
[17:56:41] akaiiro: has joined #ruby
[17:56:45] Lytol: has joined #ruby
[18:00:43] pskosinski: has joined #ruby
[18:01:07] laaron: has joined #ruby
[18:01:48] laaron: has joined #ruby
[18:02:41] laaron: has joined #ruby
[18:03:41] laaron: has joined #ruby
[18:04:13] pskosinski_: has joined #ruby
[18:04:45] laaron: has joined #ruby
[18:05:41] laaron: has joined #ruby
[18:06:39] laaron: has joined #ruby
[18:07:37] laaron: has joined #ruby
[18:08:41] laaron: has joined #ruby
[18:09:49] laaron: has joined #ruby
[18:10:42] laaron: has joined #ruby
[18:12:03] akaiiro: has joined #ruby
[18:13:42] conta: has joined #ruby
[18:25:24] r29v: has joined #ruby
[18:34:10] Swyper: https://dpaste.de/5ZP7
[18:34:37] Swyper: im still not getting why !(list_of_passed_elements.include?(arr[i])) hardly executes
[18:35:41] Eiam: has joined #ruby
[18:37:04] Swyper: havenwood phaul if any of you guys are on and can help
[18:38:24] havenwood: Swyper: Instead of Array.new use the Array literal unless you're providing an argument or block: []
[18:39:23] havenwood: Swyper: `i.succ` is a fancy, fast way to do `i+1`
[18:39:47] havenwood: Swyper: No need for these outer parens - remove them: (list_of_passed_elements.include?(arr[i]))
[18:40:08] havenwood: Swyper: So just: !list_of_passed_elements.include?(arr[i])
[18:40:26] havenwood: Swyper: Most folk use #<< (the shovel operator) instead of #push.
[18:40:37] havenwood: Swyper: list_of_elements << i
[18:40:55] havenwood: Swyper: Drop the explicit `return` unless you're returning early.
[18:41:05] hurricanehrndz: has joined #ruby
[18:41:20] Swyper: why << instead of push ?
[18:42:09] havenwood: Swyper: More visually pleasing I suppose. It indicates what side of the Array is being added to. It's just aesthetic, but It's rare to see #push.
[18:42:18] havenwood: Swyper: It's the least important of my suggestions. >.>
[18:42:51] havenwood: Swyper: less noise too - usually no parens and no dot
[18:43:42] havenwood: Swyper: See if you like the look?: https://dpaste.de/PG4y
[18:43:59] Swyper: the parens make it easier for me to read
[18:44:04] Swyper: but im trying a new approach rn
[18:44:08] havenwood: Swyper: That's ^ identical behavior, just a surface-level refactor.
[18:44:27] Swyper: https://dpaste.de/kOG1
[18:44:28] d10n-work: has joined #ruby
[18:44:35] havenwood: list_of_passed_elements << arr[i]
[18:44:37] havenwood: list_of_passed_elements.push(arr[i])
[18:44:50] havenwood: top one ^ is less noise
[18:45:05] havenwood: it doesn't really matter
[18:45:33] Swyper: https://dpaste.de/st0g
[18:45:40] Swyper: renamed the array to be more descriptive
[18:46:17] Swyper: https://dpaste.de/C7U5 with the errors
[18:46:23] Swyper: still cant figure out why its not working >_>
[18:46:32] Swyper: I'm going to figure out nested the arrays after should be easy
[18:46:41] Swyper: but I want all the indexes in the new array I made
[18:47:18] havenwood: Swyper: I'd use #chunk, but consider the following:
[18:47:22] havenwood: &>> [1, 2, 3, 3, 4, 4, 4].each_cons(2).with_index { |(a, b), i| puts i if a == b }
[18:47:25] rubydoc: # => 2 ...check link for more (https://carc.in/#/r/5wm4)
[18:48:21] havenwood: Swyper: #each_cons(2) is basically what you're doing with index comparison, but it's more performant, succinct and automatically handles the prone-to-error index comparison.
[18:49:00] havenwood: &>> [:a, :b, :b, :c, :c, :c, :d].each_cons(2).to_a
[18:49:01] rubydoc: # => [[:a, :b], [:b, :b], [:b, :c], [:c, :c], [:c, :c], [:c, :d]] (https://carc.in/#/r/5wm5)
[18:49:24] havenwood: Swyper: So it's index 0 & 1, then 1 & 2, and so on.
[18:50:09] havenwood: &>> [:a, :b, :b, :c, :c, :c, :d].chunk(&:itself).to_a.map(&:last)
[18:50:10] rubydoc: # => [[:a], [:b, :b], [:c, :c, :c], [:d]] (https://carc.in/#/r/5wm6)
[18:50:14] havenwood: No need for that #to_a - was going to show the full result.
[18:50:40] havenwood: Swyper: #chunk is made for just this scenario - when you want to chunk things that have contiguous indexes
[18:51:27] havenwood: &>> [0, 0, 1, 1, 1, 3].chunk(&:itself).map(&:last) # Swyper
[18:51:27] rubydoc: # => [[0, 0], [1, 1, 1], [3]] (https://carc.in/#/r/5wm7)
[18:59:25] sameerynho: has joined #ruby
[18:59:44] jcalla: has joined #ruby
[19:01:04] laaron: has joined #ruby
[19:01:52] laaron: has joined #ruby
[19:02:24] Swyper: has joined #ruby
[19:03:23] laaron: has joined #ruby
[19:04:10] laaron: has joined #ruby
[19:05:08] laaron: has joined #ruby
[19:05:30] quipa: has joined #ruby
[19:06:18] laaron: has joined #ruby
[19:07:13] cthulchu_: my lovely folks
[19:07:20] laaron: has joined #ruby
[19:08:00] cthulchu_: If I have def self.method(), then later in a different method of the same class, when I need to call the method, do I have to mention self or not?
[19:08:17] cthulchu_: it works fine when I call it like self.method(), but I wonder if there is a difference in this case
[19:08:20] laaron: has joined #ruby
[19:09:08] laaron: has joined #ruby
[19:10:05] laaron: has joined #ruby
[19:11:12] laaron: has joined #ruby
[19:11:59] quipa: has joined #ruby
[19:20:15] JargonedIambic: has joined #ruby
[19:20:58] hutch: has joined #ruby
[19:25:23] Swyper: has joined #ruby
[19:25:33] Swyper: I have no idea why chat keeps disconnecting me
[19:25:34] havenwood: cthulchu_: Yes, you need to call module and class methods on the module or class.
[19:25:37] havenwood: cthulchu_: https://gist.github.com/havenwood/2d4cd1ac0cdcbfd61d77bda0ad81a373
[19:26:00] Swyper: I finally got it working
[19:26:10] havenwood: Swyper: See the logs for what you missed. Or grab a bouncer like ZNC.
[19:26:11] havenwood: Swyper: Show your code?
[19:26:46] Swyper: https://dpaste.de/knU1
[19:26:51] Swyper: its still mostly the same
[19:27:42] havenwood: Swyper: nice
[19:28:30] havenwood: Swyper: Using the Array literal `[]` is faster and uses less memory than `Array.new`, which should only be used with arguments.
[19:28:47] Swyper: sorry if this is off-topic but it takes so much effort to get the code to even work, I'm usually to tired to refactor it to make it pretty/more-readable/efficient when I don't need to
[19:28:49] havenwood: Swyper: Drop the parens around: (number != count)
[19:28:59] Swyper: is that a common thing? how do you guys tackle it ?
[19:29:12] havenwood: Swyper: Red, green, refactor!
[19:29:21] GodFather: has joined #ruby
[19:29:31] havenwood: Swyper: The refactor part is hugely important, since we end up reading code more often than writign.
[19:29:45] havenwood: Swyper: Your future self will thank your past self.
[19:29:47] Swyper: so get it working, take a break and then refactor ?
[19:30:09] havenwood: Swyper: yup!
[19:30:30] havenwood: Swyper: And enjoy the refactor. That's a fun process and you end up with something more lovely, more performant, and more readable.
[19:32:39] cthulchu_: what's wrong with this one folks? https://paste.ofcode.org/TBpx5qdtqzN2rL4GEvycu5
[19:32:40] cjohnson: What is the ruby construct where you can define a context for overriding child classes
[19:33:02] havenwood: cjohnson: refinements?
[19:33:06] cjohnson: that's the one thanks
[19:33:07] cthulchu_: there seems to be an issue with curvy brackets...
[19:33:32] cnsvc: has joined #ruby
[19:37:28] havenwood: Swyper: Check if your solution works when the first number is repeated.
[19:41:40] havenwood: cthulchu_: what's the error?
[19:42:03] cthulchu_: the last curvy bracket is highlighted by the syntax checker
[19:42:08] cthulchu_: I have little clue why
[19:42:26] havenwood: cthulchu_: it's supposed to be `end` not `}`.
[19:42:41] cthulchu_: file do end?
[19:42:49] havenwood: cthulchu_: do with end or { with }
[19:43:01] cthulchu_: sorry for that
[19:51:49] baweaver: ohai cjohnson
[19:51:53] baweaver: happy new years
[19:52:25] evenom: has joined #ruby
[19:52:28] arup_r: has joined #ruby
[19:58:27] cjohnson: baweaver: obye
[19:58:38] cjohnson: lol jk happy new year
[20:00:43] laaron: has joined #ruby
[20:01:49] laaron: has joined #ruby
[20:02:41] laaron: has joined #ruby
[20:03:22] ua: has joined #ruby
[20:04:13] laaron: has joined #ruby
[20:04:21] despai: has joined #ruby
[20:05:14] laaron: has joined #ruby
[20:05:56] streblo: has joined #ruby
[20:06:14] laaron: has joined #ruby
[20:07:17] laaron: has joined #ruby
[20:08:01] streblo: has joined #ruby
[20:08:16] streblo: what am i doing wrong here? why is the time being truncated? http://dpaste.com/1C8C75A
[20:08:18] laaron: has joined #ruby
[20:09:13] laaron: has joined #ruby
[20:10:15] laaron: has joined #ruby
[20:11:23] laaron: has joined #ruby
[20:17:18] jcalla: has joined #ruby
[20:20:12] Iambchop: &>> [Time.utc('2019-01-01 00:02:57.000'), Time.utc(2019, 1, 1, 0, 2, 57)]
[20:20:13] rubydoc: # => [2019-01-01 00:00:00 UTC, 2019-01-01 00:02:57 UTC] (https://carc.in/#/r/5wn7)
[20:20:21] Iambchop: streblo: https://ruby-doc.com/docs/ProgrammingRuby/html/ref_c_time.html#Time.utc
[20:20:25] tdy: has joined #ruby
[20:24:03] crankharder: has joined #ruby
[20:31:49] Eiam: happy new year rubyist
[20:32:01] Eiam: another year of helping people with their homework
[20:34:24] conta: has joined #ruby
[20:38:32] ua_: has joined #ruby
[20:46:19] mikecmpbll: has joined #ruby
[20:47:04] conta: has joined #ruby
[20:51:26] rkazak: has joined #ruby
[20:54:56] Fernando-Basso: has joined #ruby
[20:57:36] gix: has joined #ruby
[21:00:44] laaron: has joined #ruby
[21:01:25] laaron: has joined #ruby
[21:02:28] laaron: has joined #ruby
[21:03:18] laaron: has joined #ruby
[21:04:19] laaron: has joined #ruby
[21:05:18] laaron: has joined #ruby
[21:06:17] laaron: has joined #ruby
[21:07:19] laaron: has joined #ruby
[21:07:39] Eiam: and maybe professionals with their workwork =)
[21:08:19] mspo: I do workwork at home
[21:08:20] laaron: has joined #ruby
[21:08:55] mspo: it rarely presents as "figure out how to slice a pizza in two lines of code"
[21:09:48] laaron: has joined #ruby
[21:10:48] laaron: has joined #ruby
[21:12:30] dviola: has joined #ruby
[21:19:27] conta: has joined #ruby
[21:24:03] conta: has joined #ruby
[21:27:51] spacesuitdiver: has joined #ruby
[21:30:08] orbyt_: has joined #ruby
[21:40:18] phaul: has joined #ruby
[21:40:53] phaul: has joined #ruby
[21:41:38] phaul: has joined #ruby
[21:42:53] Eiam: funny most of my workwork in ruby involves figuring out how to slice data into various views
[21:44:04] Eiam: thats kind of like pizza!
[21:44:28] Eiam: Ruby: The ultimate pizza cutter
[21:44:46] phaul: ?pizza, Eiam
[21:44:56] ruby[bot]: here's your pizza: šŸ•
[21:45:12] phaul: ruby[bot] ruined it :(
[21:45:42] Eiam: ACTION writes a single line of Ruby to enumerate the pizza 15 times to pull the one pepperoni he wants from the whole pizza 
[21:50:35] ivanskie: has joined #ruby
[22:00:27] up|ime: 15 times? that's a big pizza.
[22:00:31] up|ime: most of my pizzas are 8 slices
[22:01:27] conta: has joined #ruby
[22:01:54] Eiam: was more a jab at people constantly enumerating large structures poorly =)
[22:02:28] laaron: has joined #ruby
[22:03:12] Eiam: I just turn it all into hashes so lookup is super easy!
[22:04:01] up|ime: if only enumerating a large pizza was one of the problems i had
[22:09:14] MyMind: has joined #ruby
[22:09:31] tiff: has joined #ruby
[22:14:20] towo: has joined #ruby
[22:15:42] Pisuke: has joined #ruby
[22:27:30] Spitfire: has joined #ruby
[22:28:50] cthulchu_: ruuuuby! wewewewe
[22:30:43] laaron: has joined #ruby
[22:32:40] conta: has joined #ruby
[22:34:33] Swyper: has joined #ruby
[22:34:44] havenwood: &>> require 'matrix'; 29.upto(32).map { |n| (Matrix[[0, 1], [1, 1]] ** n.pred)[1, 1] % n.pred + 140 }.tap { |a| a[-1] += 99 }.reverse.pack('C*').force_encoding('utf-8')
[22:34:46] rubydoc: # => "\u{1F355}" (https://carc.in/#/r/5woh)
[22:36:00] Eiam: did you just encode a pizza
[22:36:22] Eiam: oh AND you got a .tap in there to abuse, look at you
[22:37:30] xlued: has joined #ruby
[22:37:38] phaul: havenwood: have you heard about the C obfuscation contest? https://www.ioccc.org/ even though it's C you might appreciate some of the code there :)
[22:38:08] Eiam: hehe that was a thing when I was in high school
[22:39:00] phaul: it still seems to be a thing
[22:39:16] Eiam: didn't Why used to do weird ruby code
[22:41:03] Swyper: has joined #ruby
[22:42:20] phaul: there are some genious entries https://en.wikipedia.org/wiki/International_Obfuscated_C_Code_Contest#Pi it's so simple, almost elegant
[22:42:46] havenwood: phaul: I can't compete with mame... Speaking of which, TIL: https://github.com/mame/rubyfarm-bisect
[22:44:16] Iambchop: http://www.rubyinside.com/advent2006/4-ruby-obfuscation.html
[22:50:23] orbyt_: has joined #ruby
[22:52:17] evdubs_: has joined #ruby
[22:53:21] Iambchop: The underhanded C contest was always good too: innocent looking code with a malicious behavior.
[22:55:42] phaul: this is way off, what am I missing https://gist.github.com/77a351adbcf95f5fd487337067dd34d2
[22:57:09] donofrio: has joined #ruby
[22:57:13] Eiam: your circle isn't one?
[22:57:20] leftylink: since we talk about ioccc, remember about https://github.com/tric
[22:58:37] donofrio: has joined #ruby
[23:00:47] laaron: has joined #ruby
[23:01:37] laaron: has joined #ruby
[23:02:38] laaron: has joined #ruby
[23:04:07] laaron: has joined #ruby
[23:05:06] laaron: has joined #ruby
[23:06:08] laaron: has joined #ruby
[23:07:06] laaron: has joined #ruby
[23:08:10] laaron: has joined #ruby
[23:09:41] laaron: has joined #ruby
[23:10:44] laaron: has joined #ruby
[23:12:29] cthulchu_: I REALLY appreciate that String[0] works as one would expect
[23:12:53] cthulchu_: I tried many langs and every bloody time I was like "OMFG!" when it doesn't work like that
[23:13:57] phaul: leftylink: those are great, thanks for the link.
[23:14:22] havenwood: love this one: https://github.com/tric/trick2018/blob/master/02-mame/entry.rb
[23:15:08] baweaver: !connection laaron
[23:15:08] ruby[bot]: +bbbb $a:laaron$#ruby-fix-your-connection laaron!*@*$#ruby-fix-your-connection laaron-!*@*$#ruby-fix-your-connection *!*@gateway/tor-sasl/laaron$#ruby-fix-your-connection
[23:15:09] ruby[bot]: ruby[bot] kicked laaron: join/part detected
[23:15:17] phaul: yeah, I was a bit disappointed printing random chars on my screen first. then... whoa! that's cool!
[23:15:30] baweaver: ACTION wanders in
[23:18:26] mksybr: has joined #ruby
[23:18:42] viaduct: has joined #ruby
[23:22:12] phaul: https://github.com/tric/trick2018/blob/master/11-tompng/entry.rb pretty awesome too
[23:25:01] hutch: has joined #ruby
[23:29:35] conta: has joined #ruby
[23:40:12] mspo: cthulchu_: does it dtrt if that character is wide?
[23:41:32] MasterAsia: has joined #ruby
[23:42:06] mspo: (fyi ruby25 seems to)
[23:42:20] mspo: with the extra annoying string: āš›āš›āš› :)
[23:44:42] cthulchu_: what a hack!
[23:44:53] mspo: cthulchu_: ?
[23:44:56] cthulchu_: 2.2.0 :022 > āš›āš›āš›[0]
[23:44:56] cthulchu_: NameError: undefined local variable or method `āš›āš›āš›' for main:Object
[23:45:19] mspo: put it in ""
[23:45:32] cthulchu_: => "āš›"
[23:45:37] cthulchu_: works fine in 2.2.0
[23:50:47] cnsvc: has joined #ruby