havenwood changed the topic of #ruby to: Rules & more: https://ruby-community.com | Ruby 2.6.0, 2.5.3, 2.4.5: https://www.ruby-lang.org | Paste 4+ lines of text to https://dpaste.de/ and select Ruby as the language | Rails questions? Ask in #RubyOnRails | Books: https://goo.gl/wpGhoQ | Logs: https://irclog.whitequark.org/ruby | Can't talk? Register/identify with Nickserv first!
venmx has quit [Ping timeout: 250 seconds]
mikecmpbll has quit [Quit: inabit. zz.]
lytol has quit [Remote host closed the connection]
surrounder has left #ruby ["WeeChat 2.3"]
akosednar has quit [Ping timeout: 268 seconds]
akosednar has joined #ruby
cschneid has joined #ruby
cschneid has quit [Ping timeout: 246 seconds]
gix has quit [Ping timeout: 245 seconds]
scrptktty has quit [Quit: Connection closed for inactivity]
davidw_ has quit [Ping timeout: 244 seconds]
tdy has joined #ruby
hutch has quit [Ping timeout: 246 seconds]
davidw_ has joined #ruby
solocshaw has joined #ruby
tdy has quit [Ping timeout: 240 seconds]
davidw_ has quit [Ping timeout: 240 seconds]
hutch has joined #ruby
cnsvc_ has joined #ruby
cnsvc has joined #ruby
solocshaw has quit [Ping timeout: 272 seconds]
meinside has joined #ruby
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
cnsvc has quit [Ping timeout: 256 seconds]
cnsvc_ has quit [Ping timeout: 256 seconds]
d10n-work has quit [Quit: Connection closed for inactivity]
solocshaw has joined #ruby
lytol has joined #ruby
tdy has joined #ruby
solocshaw has quit [Ping timeout: 250 seconds]
solocshaw has joined #ruby
hutch has quit [Ping timeout: 272 seconds]
duderonomy has joined #ruby
bmurt has joined #ruby
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
spacesuitdiver has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
hutch has joined #ruby
cschneid has joined #ruby
cschneid has quit [Ping timeout: 250 seconds]
cthulchu has quit [Disconnected by services]
esrse has joined #ruby
cthulchu_ has joined #ruby
solocshaw1 has joined #ruby
solocshaw has quit [Ping timeout: 246 seconds]
solocshaw1 is now known as solocshaw
tdy has quit [Ping timeout: 246 seconds]
cschneid has joined #ruby
hutch has quit [Ping timeout: 250 seconds]
cnsvc has joined #ruby
cnsvc_ has joined #ruby
spacesuitdiver has joined #ruby
cschneid has quit [Ping timeout: 250 seconds]
memofun has joined #ruby
memofun has quit [Quit: WeeChat 1.9.1]
hutch has joined #ruby
tdy has joined #ruby
AJA4350 has quit [Quit: AJA4350]
kapil____ has joined #ruby
tiff has joined #ruby
jthomas2 has joined #ruby
solocshaw has quit [Quit: solocshaw]
jthomas2 has quit [Ping timeout: 246 seconds]
hutch has quit [Ping timeout: 272 seconds]
garyserj has quit [Quit: garyserj]
rkazak has joined #ruby
al2o3-cr has quit [Ping timeout: 246 seconds]
lytol has quit [Remote host closed the connection]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
darix has quit [Quit: may the packets be with you...]
rkazak has quit [Quit: Sleep.....ing....]
orbyt_ has joined #ruby
cnsvc_ has quit [Ping timeout: 256 seconds]
cnsvc has quit [Ping timeout: 256 seconds]
Swyper has joined #ruby
Swyper has quit [Remote host closed the connection]
darix has joined #ruby
hutch has joined #ruby
hutch has quit [Ping timeout: 268 seconds]
jottr has quit [Ping timeout: 240 seconds]
ogres has joined #ruby
cnsvc_ has joined #ruby
cnsvc has joined #ruby
spacesuitdiver has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
braincrash has quit [Quit: bye bye]
spacesuitdiver has joined #ruby
braincrash has joined #ruby
cnsvc has quit [Ping timeout: 256 seconds]
cnsvc_ has quit [Ping timeout: 256 seconds]
davidw_ has joined #ruby
agent_white has quit [Quit: leaving]
cnsvc has joined #ruby
jottr has joined #ruby
masterasia has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jottr has quit [Ping timeout: 246 seconds]
cnsvc_ has joined #ruby
masterasia has joined #ruby
hutch has joined #ruby
Swyper has joined #ruby
cnsvc has quit [Ping timeout: 256 seconds]
davidw_ has quit [Ping timeout: 250 seconds]
spacesuitdiver has quit [Read error: Connection reset by peer]
spacesuitdiver has joined #ruby
<barg> is there any particular recommended way for converting a csv to xls?
hutch has quit [Ping timeout: 245 seconds]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
masterasia has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Swyper has quit [Remote host closed the connection]
tdy has quit [Ping timeout: 246 seconds]
tdy has joined #ruby
hutch has joined #ruby
<eam> barg: excel can open a .csv natively, what kind of conversion did you want to do?
<eam> at its most simple: File.rename "foo.csv", "foo.xls"
idiocrash has joined #ruby
spacesuitdiver has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
cnsvc has joined #ruby
Renich has quit [Ping timeout: 246 seconds]
KeyJoo has joined #ruby
spacesuitdiver has joined #ruby
hutch has quit [Ping timeout: 250 seconds]
idiocrash has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
al2o3-cr has joined #ruby
Dreamer3 has quit [Quit: Leaving...]
Inline has quit [Quit: Leaving]
masterasia has joined #ruby
cschneid has joined #ruby
cschneid has quit [Ping timeout: 250 seconds]
hutch has joined #ruby
cnsvc_ has quit [Remote host closed the connection]
cnsvc_ has joined #ruby
jthomas2 has joined #ruby
rkazak has joined #ruby
jthomas2 has quit [Ping timeout: 272 seconds]
cschneid has joined #ruby
Dbugger has joined #ruby
_whitelogger has joined #ruby
cnsvc has quit [Quit: WeeChat 2.3]
cnsvc has joined #ruby
rkazak has joined #ruby
rippa has joined #ruby
hutch has quit [Ping timeout: 268 seconds]
despai has joined #ruby
hutch has joined #ruby
cschneid has quit [Ping timeout: 246 seconds]
aupadhye has joined #ruby
Nicmavr has quit [Read error: Connection reset by peer]
cnsvc has quit [Quit: WeeChat 2.2]
cnsvc has joined #ruby
Nicmavr has joined #ruby
dellavg_ has joined #ruby
rkazak has quit [Quit: Sleep.....ing....]
conta has quit [Quit: conta]
conta has joined #ruby
cnsvc has quit [Ping timeout: 256 seconds]
rkazak has joined #ruby
cnsvc has joined #ruby
aufi has joined #ruby
rkazak has quit [Quit: Sleep.....ing....]
_whitelogger has joined #ruby
jottr has joined #ruby
hutch has quit [Ping timeout: 244 seconds]
jottr has quit [Ping timeout: 245 seconds]
jottr has joined #ruby
despai has quit [Quit: ...]
kapil____ has joined #ruby
spacesuitdiver has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
cschneid has joined #ruby
Puffball has joined #ruby
aupadhye is now known as aupadhye|food
al2o3-cr has quit [Quit: WeeChat 2.3]
sandelius has joined #ruby
jmcgnh has quit [Read error: Connection reset by peer]
spacesuitdiver has joined #ruby
jmcgnh has joined #ruby
jottr has quit [Ping timeout: 245 seconds]
cschneid has quit [Ping timeout: 272 seconds]
aupadhye|food is now known as aupadhye
tiff has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
VladGh has quit [Ping timeout: 250 seconds]
mikecmpbll has joined #ruby
ur5us has joined #ruby
ur5us has quit [Read error: Connection reset by peer]
spacesuitdiver has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
za1b1tsu has joined #ruby
vondruch has joined #ruby
ellcs has joined #ruby
lxsameer has joined #ruby
Mike11 has joined #ruby
venmx has joined #ruby
sandelius has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
m0w has joined #ruby
cnsvc has quit [Ping timeout: 256 seconds]
kapil____ has quit [Quit: Connection closed for inactivity]
Mike11 has quit [Ping timeout: 246 seconds]
Mike11 has joined #ruby
venmx has quit [Quit: leaving]
akosednar has quit [Ping timeout: 250 seconds]
akosednar has joined #ruby
uplime has quit [Ping timeout: 240 seconds]
cschneid has joined #ruby
KeyJoo has quit [Quit: KeyJoo]
reber has joined #ruby
reber has quit [Remote host closed the connection]
Nicmavr has quit [Ping timeout: 245 seconds]
esrse has quit [Ping timeout: 246 seconds]
Nicmavr has joined #ruby
uplime has joined #ruby
roshanavand has joined #ruby
cschneid has quit [Ping timeout: 245 seconds]
m0w has quit [Ping timeout: 246 seconds]
d^sh has quit [Ping timeout: 246 seconds]
d^sh has joined #ruby
m0w has joined #ruby
n01 has joined #ruby
n01 has quit [Remote host closed the connection]
n01 has joined #ruby
ruurd has joined #ruby
n01 has quit [Remote host closed the connection]
m0w has quit [Ping timeout: 246 seconds]
jottr has joined #ruby
_whitelogger has joined #ruby
uplime has quit [Ping timeout: 272 seconds]
jottr has quit [Ping timeout: 240 seconds]
jottr has joined #ruby
al2o3-cr has joined #ruby
Mike111 has joined #ruby
Mike111 has quit [Max SendQ exceeded]
masterasia has joined #ruby
Mike11 has quit [Ping timeout: 246 seconds]
nowhere_man has joined #ruby
status402 has joined #ruby
vondruch has quit [Ping timeout: 245 seconds]
nowhere_man has quit [Ping timeout: 252 seconds]
m0w has joined #ruby
aupadhye is now known as aupadhye|brb
vondruch has joined #ruby
aupadhye|brb is now known as aupadhye
status402_ has joined #ruby
status402 has quit [Read error: Connection reset by peer]
m0w has quit [Ping timeout: 250 seconds]
Emmanuel_Chanel has quit [Ping timeout: 246 seconds]
dviola has joined #ruby
AJA4350 has joined #ruby
uplime has joined #ruby
Emmanuel_Chanel has joined #ruby
lucasb has joined #ruby
kapil____ has joined #ruby
jottr has quit [Ping timeout: 272 seconds]
jottr has joined #ruby
cschneid has joined #ruby
uplime has quit [Ping timeout: 245 seconds]
jcalla has quit [Ping timeout: 250 seconds]
laaron has joined #ruby
_whitelogger has joined #ruby
agent_white has joined #ruby
reber has joined #ruby
uplime has joined #ruby
BTRE has quit [Remote host closed the connection]
cschneid has quit [Ping timeout: 246 seconds]
al2o3-cr has quit [Quit: WeeChat 2.3]
laaron has quit [Remote host closed the connection]
laaron has joined #ruby
laaron has quit [Remote host closed the connection]
laaron has joined #ruby
laaron has quit [Remote host closed the connection]
laaron has joined #ruby
cyberarm has quit [Ping timeout: 246 seconds]
laaron has quit [Remote host closed the connection]
laaron has joined #ruby
laaron has quit [Remote host closed the connection]
laaron has joined #ruby
laaron has quit [Remote host closed the connection]
laaron has joined #ruby
laaron has quit [Remote host closed the connection]
profetes has joined #ruby
al2o3-cr has joined #ruby
laaron has joined #ruby
laaron has quit [Remote host closed the connection]
laaron has joined #ruby
sandelius has joined #ruby
laaron has quit [Remote host closed the connection]
laaron has joined #ruby
laaron has quit [Remote host closed the connection]
donofrio has joined #ruby
laaron has joined #ruby
laaron has quit [Remote host closed the connection]
laaron has joined #ruby
dviola has quit [Ping timeout: 245 seconds]
Swyper has joined #ruby
<Swyper> string.gsub(/\W+/, ' ')
<Swyper> what exactly is /\W+/, ' '
PeteHansen has joined #ruby
<PeteHansen> Hello! So what's the fastest language on earth, say you need to execute commands with nanosecond presision?
aupadhye has quit [Quit: Leaving]
dviola has joined #ruby
<phaul> Swyper: /something/ is a regexp literal. You can find the meaning of \W and + on the page I linked
venmx has joined #ruby
<Swyper> ah I see it
<Swyper> thank you
donofrio has quit [Ping timeout: 272 seconds]
BTRE has joined #ruby
venmx has quit [Client Quit]
<PeteHansen> * precision
<phaul> assembly maybe, given a fixed architecture, for a given processor from a given vendor.
<phaul> :)
<PeteHansen> Cool, thanks man :D
jcalla has joined #ruby
sandelius has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
uplime has quit [Ping timeout: 250 seconds]
dinfuehr has quit [Ping timeout: 240 seconds]
dinfuehr has joined #ruby
PeteHansen has quit [Quit: Lost terminal]
uplime has joined #ruby
mikecmpb_ has joined #ruby
Puffball has quit [Remote host closed the connection]
mikecmpbll has quit [Ping timeout: 268 seconds]
donofrio has joined #ruby
Swyper has quit [Remote host closed the connection]
polishdub has joined #ruby
Swyper has joined #ruby
<Swyper> string.gsub(/\W+/, '')
<Swyper> does this modify the original string aswell?
<Swyper> expected: "acc"
<Swyper> got: ["acc"]
<canton7> that's pretty easy to test :P
<canton7> you expected a string when you got an array
<Swyper> and to_s'ing that string makes it
<Swyper> expected: "acc"
<Swyper> got: "[\"acc\"]"
<Swyper> yeah I know but its not so straightforward to get just the string
<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)
<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
<phaul> &>> 'c'.index(‘c’)
<rubydoc> # => (https://carc.in/#/r/5wju)
donofrio has quit [Ping timeout: 268 seconds]
<phaul> your ' marks around c are some utf8 quotation marks
bmurt has joined #ruby
laaron has quit [Remote host closed the connection]
donofrio has joined #ruby
<phaul> ah, but not in the paste, just in what you pasted here. never mind
laaron has joined #ruby
vondruch_ has joined #ruby
<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
<Swyper> TypeError:
<Swyper> nil can't be coerced into Integer
<Swyper> shoulden't compact remove all nils
<Swyper> hmm
conta has quit [Ping timeout: 246 seconds]
<phaul> &>> 'xxx'.index('y')
<rubydoc> # => nil (https://carc.in/#/r/5wjv)
vondruch has quit [Ping timeout: 250 seconds]
vondruch_ is now known as vondruch
<Swyper> hmm
<Swyper> closest_c.max_by(1) {|word| (word.length-1)-word.index('c')}
<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
<Swyper> maybe I should run a select beforehand which filters out all nil values
<phaul> you need to filter the ones without 'c'. compact indeed removed the nils.
<phaul> but you can also put an if in there
<Swyper> is there a general rule for knowing when you can put an if through an iterator and when you can't
<Swyper> like *I think* you can't put an if in maps
<phaul> you always can
<phaul> &>> [1,2,3].map { |i| if i.odd? then 'odd'; else 'even'; end }
<rubydoc> # => ["odd", "even", "odd"] (https://carc.in/#/r/5wjw)
<phaul> reads better with multi line do..end and without semicolons
<Swyper> ahh
<phaul> for such things you can also use the ternary expression
<Swyper> I don't know why I thought I could not add ifs in certain cases
<Swyper> for sure I just find them conusing to follow
<Swyper> **confusing
<phaul> &>> [1,2,3].map { |i| i.odd? ? 'odd' : 'even' }
<rubydoc> # => ["odd", "even", "odd"] (https://carc.in/#/r/5wjx)
<phaul> ternary is for these kind of one liner ifs. condition plus two single case on one line
* phaul afk for a bit
donofrio has quit [Ping timeout: 246 seconds]
KeyJoo has joined #ruby
cd has quit [Quit: cd]
cschneid has joined #ruby
al2o3-cr has quit [Quit: WeeChat 2.3]
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
hiroaki has joined #ruby
Inline has joined #ruby
conta has joined #ruby
cschneid has quit []
zenspider has quit [Read error: Connection reset by peer]
zenspider_ has joined #ruby
al2o3-cr has joined #ruby
uplime has quit [Ping timeout: 246 seconds]
chouhoulis has joined #ruby
Rapture has joined #ruby
Sembei has joined #ruby
Pisuke has quit [Ping timeout: 250 seconds]
gnufied has joined #ruby
dinfuehr has quit [Ping timeout: 246 seconds]
Inline has quit [Remote host closed the connection]
dinfuehr has joined #ruby
donofrio has joined #ruby
za1b1tsu has quit [Remote host closed the connection]
jthomas2 has joined #ruby
Inline has joined #ruby
d^sh has quit [Ping timeout: 240 seconds]
donofrio has quit [Ping timeout: 272 seconds]
conta1 has joined #ruby
d^sh has joined #ruby
spiette has quit [Quit: ZNC 1.7.1 - https://znc.in]
jthomas3 has joined #ruby
jthomas2 has quit [Ping timeout: 272 seconds]
Swyper has quit [Remote host closed the connection]
laaron has quit [Remote host closed the connection]
spiette has joined #ruby
laaron has joined #ruby
laaron has quit [Remote host closed the connection]
dinfuehr has quit [Ping timeout: 250 seconds]
laaron has joined #ruby
conta1 has quit [Ping timeout: 250 seconds]
dinfuehr has joined #ruby
laaron has quit [Remote host closed the connection]
status402_ has quit [Quit: status402_]
laaron has joined #ruby
laaron has quit [Remote host closed the connection]
laaron has joined #ruby
laaron has quit [Remote host closed the connection]
laaron has joined #ruby
laaron has quit [Remote host closed the connection]
laaron has joined #ruby
laaron has quit [Remote host closed the connection]
laaron has joined #ruby
laaron has quit [Remote host closed the connection]
laaron has joined #ruby
laaron has quit [Remote host closed the connection]
vondruch has quit [Quit: vondruch]
laaron has joined #ruby
vondruch has joined #ruby
laaron has quit [Remote host closed the connection]
laaron has joined #ruby
laaron has quit [Remote host closed the connection]
laaron has joined #ruby
hiroaki has quit [Ping timeout: 250 seconds]
<havenwood> They're gone, but I'd be tempted to #chunk.
<havenwood> &>> [1, 2, 3, 3, 4, 4, 4].each_with_index.chunk(&:first).map(&:last).reject(&:one?).map { |a| a.map(&:last).minmax }
<rubydoc> # => [[2, 3], [4, 6]] (https://carc.in/#/r/5wkh)
Renich has joined #ruby
Aqo has joined #ruby
aufi has quit [Ping timeout: 246 seconds]
dinfuehr has quit [Ping timeout: 244 seconds]
dinfuehr has joined #ruby
<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
akaiiro has joined #ruby
<phaul> it would be cool if rubydoc had an option for this..
profetes has quit [Ping timeout: 272 seconds]
hiroaki has joined #ruby
uplime has joined #ruby
ruurd has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
quipa has joined #ruby
uplime has quit [Ping timeout: 240 seconds]
uplime has joined #ruby
hiroaki has quit [Ping timeout: 250 seconds]
jcalla has quit [Ping timeout: 246 seconds]
davidw_ has joined #ruby
hiroaki has joined #ruby
\void has joined #ruby
Swyper has joined #ruby
hutch has joined #ruby
dviola has quit [Ping timeout: 244 seconds]
laaron has quit [Remote host closed the connection]
laaron has joined #ruby
laaron has quit [Remote host closed the connection]
laaron has joined #ruby
laaron has quit [Remote host closed the connection]
laaron has joined #ruby
laaron has quit [Remote host closed the connection]
laaron has joined #ruby
laaron has quit [Remote host closed the connection]
laaron has joined #ruby
laaron has quit [Remote host closed the connection]
laaron has joined #ruby
laaron has quit [Remote host closed the connection]
laaron has joined #ruby
laaron has quit [Remote host closed the connection]
rubydoc has quit [Ping timeout: 246 seconds]
laaron has joined #ruby
laaron has quit [Remote host closed the connection]
phaul has quit [Ping timeout: 246 seconds]
laaron has joined #ruby
tdy has joined #ruby
dviola has joined #ruby
laaron- has joined #ruby
laaron- has quit [Remote host closed the connection]
laaron has quit [Remote host closed the connection]
laaron- has joined #ruby
lxsameer has quit [Ping timeout: 244 seconds]
spacesuitdiver has joined #ruby
agent_white has quit [Quit: brb]
<Swyper> hi
<Swyper> I don't why the array I declared is completely empty
<Swyper> if((number == arr[i+1]) && (!(arr[0]..arr[i-1]).include?(arr[i])))
<Swyper> the second part of that is probably causing the issue
phaul has joined #ruby
rubydoc has joined #ruby
lucasb has quit [Quit: Connection closed for inactivity]
_phaul has joined #ruby
phaul has quit [Ping timeout: 244 seconds]
_phaul is now known as phaul
<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'
mikecmpb_ has quit [Quit: inabit. zz.]
SeepingN has joined #ruby
<phaul> you can slice an array with a very similar syntax probably that's what you wanted. take a look at
<phaul> &ri Array#slice
<Swyper> I wanted it to be a range from a[0] to [a-1]
<Swyper> ohh
<Swyper> ok i got what your saying
<Swyper> if((number == arr[i+1]) && (!(arr[0..i-1]).include?(arr[i]))) gives me the same output
<baweaver> Someone likes parens
<baweaver> if number == arr[i+1] && !(arr[0..i-1]).include?(arr[i])
<baweaver> if number == arr[i+1] && !arr[0..i-1].include?(arr[i])
<baweaver> There we go. That does the same thing and doesn't have superfluous parens.
<Swyper> I do have alot of redundant parans in there. lol
<baweaver> &ri Enumerable#chunk
<baweaver> Read into that.
<baweaver> phaul: I should coax them into visiting IRC again
<baweaver> We chat on Twitter occasionally.
akaiiro has quit [Ping timeout: 240 seconds]
pskosinski has joined #ruby
sanscoeur has joined #ruby
orbyt_ has joined #ruby
pskosinski has quit [Remote host closed the connection]
BH23 has quit [Ping timeout: 246 seconds]
akaiiro has joined #ruby
lytol has joined #ruby
laaron- has quit [Remote host closed the connection]
pskosinski has joined #ruby
laaron has joined #ruby
laaron has quit [Remote host closed the connection]
laaron has joined #ruby
laaron has quit [Remote host closed the connection]
laaron has joined #ruby
laaron has quit [Remote host closed the connection]
laaron has joined #ruby
pskosinski_ has joined #ruby
laaron has quit [Remote host closed the connection]
laaron has joined #ruby
laaron has quit [Remote host closed the connection]
laaron has joined #ruby
laaron has quit [Remote host closed the connection]
laaron has joined #ruby
pskosinski has quit [Ping timeout: 272 seconds]
laaron has quit [Remote host closed the connection]
laaron has joined #ruby
akaiiro has quit [Remote host closed the connection]
laaron has quit [Remote host closed the connection]
laaron has joined #ruby
laaron has quit [Remote host closed the connection]
pskosinski_ has quit [Remote host closed the connection]
laaron has joined #ruby
laaron has quit [Remote host closed the connection]
laaron has joined #ruby
conta has quit [Quit: conta]
akaiiro has joined #ruby
conta has joined #ruby
conta has quit [Ping timeout: 246 seconds]
KeyJoo has quit [Quit: KeyJoo]
sauvin has quit [Read error: Connection reset by peer]
r29v has joined #ruby
<Swyper> hi
<Swyper> im still not getting why !(list_of_passed_elements.include?(arr[i])) hardly executes
Eiam has joined #ruby
<Swyper> havenwood phaul if any of you guys are on and can help
<havenwood> Swyper: Instead of Array.new use the Array literal unless you're providing an argument or block: []
<havenwood> Swyper: `i.succ` is a fancy, fast way to do `i+1`
<Swyper> i succ
<Swyper> lolz
<havenwood> Swyper: No need for these outer parens - remove them: (list_of_passed_elements.include?(arr[i]))
<havenwood> Swyper: So just: !list_of_passed_elements.include?(arr[i])
<havenwood> Swyper: Most folk use #<< (the shovel operator) instead of #push.
<havenwood> Swyper: list_of_elements << i
<havenwood> Swyper: Drop the explicit `return` unless you're returning early.
hurricanehrndz has joined #ruby
<Swyper> why << instead of push ?
<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.
<havenwood> Swyper: It's the least important of my suggestions. >.>
<havenwood> Swyper: less noise too - usually no parens and no dot
<havenwood> Swyper: See if you like the look?: https://dpaste.de/PG4y
<Swyper> the parens make it easier for me to read
<Swyper> but im trying a new approach rn
<Swyper> sec
<havenwood> Swyper: That's ^ identical behavior, just a surface-level refactor.
d10n-work has joined #ruby
<havenwood> list_of_passed_elements << arr[i]
<havenwood> list_of_passed_elements.push(arr[i])
<havenwood> top one ^ is less noise
<havenwood> it doesn't really matter
<Swyper> fair
<Swyper> renamed the array to be more descriptive
<Swyper> https://dpaste.de/C7U5 with the errors
<Swyper> still cant figure out why its not working >_>
<Swyper> I'm going to figure out nested the arrays after should be easy
<Swyper> but I want all the indexes in the new array I made
<havenwood> Swyper: I'd use #chunk, but consider the following:
<havenwood> &>> [1, 2, 3, 3, 4, 4, 4].each_cons(2).with_index { |(a, b), i| puts i if a == b }
<rubydoc> # => 2 ...check link for more (https://carc.in/#/r/5wm4)
<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.
<havenwood> &>> [:a, :b, :b, :c, :c, :c, :d].each_cons(2).to_a
<rubydoc> # => [[:a, :b], [:b, :b], [:b, :c], [:c, :c], [:c, :c], [:c, :d]] (https://carc.in/#/r/5wm5)
<havenwood> Swyper: So it's index 0 & 1, then 1 & 2, and so on.
tdy has quit [Ping timeout: 244 seconds]
<havenwood> &>> [:a, :b, :b, :c, :c, :c, :d].chunk(&:itself).to_a.map(&:last)
<rubydoc> # => [[:a], [:b, :b], [:c, :c, :c], [:d]] (https://carc.in/#/r/5wm6)
<havenwood> No need for that #to_a - was going to show the full result.
<havenwood> Swyper: #chunk is made for just this scenario - when you want to chunk things that have contiguous indexes
<havenwood> &>> [0, 0, 1, 1, 1, 3].chunk(&:itself).map(&:last) # Swyper
<rubydoc> # => [[0, 0], [1, 1, 1], [3]] (https://carc.in/#/r/5wm7)
Swyper has quit [Remote host closed the connection]
raulp has quit [Ping timeout: 272 seconds]
sameerynho has joined #ruby
jcalla has joined #ruby
laaron has quit [Remote host closed the connection]
laaron has joined #ruby
laaron has quit [Remote host closed the connection]
laaron has joined #ruby
Swyper has joined #ruby
laaron has quit [Remote host closed the connection]
laaron has joined #ruby
laaron has quit [Remote host closed the connection]
laaron has joined #ruby
quipa has quit [Remote host closed the connection]
laaron has quit [Remote host closed the connection]
laaron has joined #ruby
quipa has joined #ruby
laaron has quit [Remote host closed the connection]
laaron has joined #ruby
Swyper has quit [Ping timeout: 272 seconds]
laaron has quit [Remote host closed the connection]
<cthulchu_> my lovely folks
laaron has joined #ruby
laaron has quit [Remote host closed the connection]
<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?
<cthulchu_> it works fine when I call it like self.method(), but I wonder if there is a difference in this case
laaron has joined #ruby
laaron has quit [Remote host closed the connection]
laaron has joined #ruby
laaron has quit [Remote host closed the connection]
laaron has joined #ruby
quipa has quit [Excess Flood]
laaron has quit [Remote host closed the connection]
laaron has joined #ruby
quipa has joined #ruby
quipa has quit [Read error: Connection reset by peer]
hutch has quit [Ping timeout: 250 seconds]
JargonedIambic has joined #ruby
hutch has joined #ruby
kapil____ has quit [Quit: Connection closed for inactivity]
JargonedIambic has quit [Remote host closed the connection]
Swyper has joined #ruby
<Swyper> I have no idea why chat keeps disconnecting me
<Swyper> >_>
<havenwood> cthulchu_: Yes, you need to call module and class methods on the module or class.
<Swyper> I finally got it working
<havenwood> Swyper: See the logs for what you missed. Or grab a bouncer like ZNC.
<havenwood> Swyper: Show your code?
<Swyper> its still mostly the same
<havenwood> Swyper: nice
<havenwood> Swyper: Using the Array literal `[]` is faster and uses less memory than `Array.new`, which should only be used with arguments.
<cthulchu_> thanks
<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
<havenwood> Swyper: Drop the parens around: (number != count)
<Swyper> is that a common thing? how do you guys tackle it ?
<havenwood> Swyper: Red, green, refactor!
GodFather has joined #ruby
<havenwood> Swyper: The refactor part is hugely important, since we end up reading code more often than writign.
<havenwood> Swyper: Your future self will thank your past self.
<Swyper> so get it working, take a break and then refactor ?
<havenwood> Swyper: yup!
<havenwood> Swyper: And enjoy the refactor. That's a fun process and you end up with something more lovely, more performant, and more readable.
<cthulchu_> what's wrong with this one folks? https://paste.ofcode.org/TBpx5qdtqzN2rL4GEvycu5
<cjohnson> What is the ruby construct where you can define a context for overriding child classes
<Swyper> thanks
<havenwood> cjohnson: refinements?
<cjohnson> that's the one thanks
<cthulchu_> there seems to be an issue with curvy brackets...
cnsvc has joined #ruby
<havenwood> Swyper: Check if your solution works when the first number is repeated.
<havenwood> cthulchu_: what's the error?
<cthulchu_> the last curvy bracket is highlighted by the syntax checker
<cthulchu_> I have little clue why
<havenwood> cthulchu_: it's supposed to be `end` not `}`.
<cthulchu_> oh
<cthulchu_> wow
<cthulchu_> file do end?
<havenwood> cthulchu_: do with end or { with }
<cthulchu_> riiiight!
<cthulchu_> sorry for that
<havenwood> np
Swyper has quit [Remote host closed the connection]
<baweaver> ohai cjohnson
<baweaver> happy new years
evenom has joined #ruby
arup_r has joined #ruby
<cjohnson> baweaver: obye
<cjohnson> lol jk happy new year
ua has quit [Ping timeout: 246 seconds]
laaron has quit [Remote host closed the connection]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
laaron has joined #ruby
laaron has quit [Remote host closed the connection]
jcalla has quit [Ping timeout: 246 seconds]
laaron has joined #ruby
laaron has quit [Remote host closed the connection]
laaron has joined #ruby
ua has joined #ruby
laaron has quit [Remote host closed the connection]
laaron has joined #ruby
despai has joined #ruby
laaron has quit [Remote host closed the connection]
laaron has joined #ruby
laaron has quit [Remote host closed the connection]
streblo has joined #ruby
streblo has quit [Read error: Connection reset by peer]
laaron has joined #ruby
laaron has quit [Remote host closed the connection]
laaron has joined #ruby
laaron has quit [Remote host closed the connection]
streblo has joined #ruby
<streblo> what am i doing wrong here? why is the time being truncated? http://dpaste.com/1C8C75A
laaron has joined #ruby
laaron has quit [Remote host closed the connection]
laaron has joined #ruby
laaron has quit [Remote host closed the connection]
laaron has joined #ruby
laaron has quit [Remote host closed the connection]
laaron has joined #ruby
evenom has quit [Quit: Leaving]
jcalla has joined #ruby
<Iambchop> &>> [Time.utc('2019-01-01 00:02:57.000'), Time.utc(2019, 1, 1, 0, 2, 57)]
<rubydoc> # => [2019-01-01 00:00:00 UTC, 2019-01-01 00:02:57 UTC] (https://carc.in/#/r/5wn7)
tdy has joined #ruby
crankharder has joined #ruby
arup_r has quit []
<Eiam> happy new year rubyist
<Eiam> another year of helping people with their homework
streblo has quit [Ping timeout: 256 seconds]
conta has joined #ruby
<havenwood> Eiam: \o/
ua_ has joined #ruby
conta has quit [Ping timeout: 250 seconds]
ua has quit [Ping timeout: 250 seconds]
mikecmpbll has joined #ruby
conta has joined #ruby
spacesuitdiver has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rkazak has joined #ruby
conta has quit [Ping timeout: 272 seconds]
Fernando-Basso has joined #ruby
masterasia has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
gix has joined #ruby
laaron has quit [Remote host closed the connection]
laaron has joined #ruby
laaron has quit [Remote host closed the connection]
laaron has joined #ruby
dviola has quit [Ping timeout: 250 seconds]
laaron has quit [Remote host closed the connection]
despai has quit [Quit: ...]
laaron has joined #ruby
laaron has quit [Remote host closed the connection]
laaron has joined #ruby
laaron has quit [Remote host closed the connection]
laaron has joined #ruby
laaron has quit [Remote host closed the connection]
laaron has joined #ruby
laaron has quit [Remote host closed the connection]
reber has quit [Remote host closed the connection]
laaron has joined #ruby
laaron has quit [Remote host closed the connection]
laaron has joined #ruby
<Eiam> and maybe professionals with their workwork =)
laaron has quit [Remote host closed the connection]
<mspo> I do workwork at home
laaron has joined #ruby
<mspo> it rarely presents as "figure out how to slice a pizza in two lines of code"
laaron has quit [Remote host closed the connection]
laaron has joined #ruby
laaron has quit [Remote host closed the connection]
laaron has joined #ruby
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
dviola has joined #ruby
cnsvc has quit [Ping timeout: 256 seconds]
conta has joined #ruby
conta has quit [Remote host closed the connection]
conta has joined #ruby
spacesuitdiver has joined #ruby
conta has quit [Ping timeout: 246 seconds]
orbyt_ has joined #ruby
dviola has quit [Quit: WeeChat 2.3]
phaul has quit [Quit: bye]
phaul has joined #ruby
phaul has quit [Client Quit]
phaul has joined #ruby
phaul has quit [Client Quit]
phaul has joined #ruby
<Eiam> funny most of my workwork in ruby involves figuring out how to slice data into various views
<Eiam> thats kind of like pizza!
<Eiam> Ruby: The ultimate pizza cutter
<phaul> ?pizza, Eiam
<phaul> ?pizza
<ruby[bot]> here's your pizza: 🍕
<phaul> ruby[bot] ruined it :(
* Eiam writes a single line of Ruby to enumerate the pizza 15 times to pull the one pepperoni he wants from the whole pizza
ivanskie has joined #ruby
Aqo has quit [Quit: ChatZilla 0.9.92-rdmsoft [XULRunner 35.0.1/20150122214805]]
laaron has quit [Remote host closed the connection]
<up|ime> 15 times? that's a big pizza.
<up|ime> most of my pizzas are 8 slices
eb0t has quit [Quit: WeeChat 2.2]
conta has joined #ruby
<SeepingN> XXL baby
<Eiam> was more a jab at people constantly enumerating large structures poorly =)
laaron has joined #ruby
<Eiam> I just turn it all into hashes so lookup is super easy!
<up|ime> if only enumerating a large pizza was one of the problems i had
conta has quit [Ping timeout: 245 seconds]
MyMind has joined #ruby
tiff has joined #ruby
towo has quit [Remote host closed the connection]
Sembei has quit [Ping timeout: 268 seconds]
towo has joined #ruby
Rapture has quit [Quit: Textual IRC Client: www.textualapp.com]
MyMind has quit [Ping timeout: 245 seconds]
Pisuke has joined #ruby
Spitfire has quit [Ping timeout: 264 seconds]
spacesuitdiver has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Spitfire has joined #ruby
<cthulchu_> ruuuuby! wewewewe
laaron has quit [Remote host closed the connection]
laaron has joined #ruby
conta has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Swyper has joined #ruby
<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')
<rubydoc> # => "\u{1F355}" (https://carc.in/#/r/5woh)
<Eiam> did you just encode a pizza
<Eiam> you did
<Eiam> oh AND you got a .tap in there to abuse, look at you
conta has quit [Ping timeout: 250 seconds]
xlued has joined #ruby
<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 :)
<Eiam> hehe that was a thing when I was in high school
Swyper has quit [Ping timeout: 250 seconds]
<phaul> it still seems to be a thing
<Eiam> didn't Why used to do weird ruby code
Swyper has joined #ruby
<phaul> there are some genious entries https://en.wikipedia.org/wiki/International_Obfuscated_C_Code_Contest#Pi it's so simple, almost elegant
<havenwood> phaul: I can't compete with mame... Speaking of which, TIL: https://github.com/mame/rubyfarm-bisect
Swyper has quit [Remote host closed the connection]
orbyt_ has joined #ruby
polishdub has quit [Quit: leaving]
evdubs_ has quit [Remote host closed the connection]
evdubs_ has joined #ruby
<Iambchop> The underhanded C contest was always good too: innocent looking code with a malicious behavior.
<phaul> this is way off, what am I missing https://gist.github.com/77a351adbcf95f5fd487337067dd34d2
donofrio has joined #ruby
<Eiam> your circle isn't one?
mikecmpbll has quit [Quit: inabit. zz.]
<leftylink> since we talk about ioccc, remember about https://github.com/tric
donofrio has quit [Read error: error:1408F10B:SSL routines:ssl3_get_record:wrong version number]
donofrio has joined #ruby
laaron has quit [Remote host closed the connection]
laaron has joined #ruby
laaron has quit [Remote host closed the connection]
laaron has joined #ruby
laaron has quit [Remote host closed the connection]
crankharder has quit [Ping timeout: 250 seconds]
laaron has joined #ruby
laaron has quit [Remote host closed the connection]
laaron has joined #ruby
laaron has quit [Remote host closed the connection]
laaron has joined #ruby
laaron has quit [Remote host closed the connection]
laaron has joined #ruby
laaron has quit [Remote host closed the connection]
laaron has joined #ruby
laaron has quit [Remote host closed the connection]
laaron has joined #ruby
laaron has quit [Remote host closed the connection]
donofrio has quit [Ping timeout: 246 seconds]
laaron has joined #ruby
laaron has quit [Remote host closed the connection]
laaron has joined #ruby
hutch has quit [Ping timeout: 245 seconds]
<cthulchu_> I REALLY appreciate that String[0] works as one would expect
<cthulchu_> I tried many langs and every bloody time I was like "OMFG!" when it doesn't work like that
<phaul> leftylink: those are great, thanks for the link.
<baweaver> !connection laaron
laaron was kicked from #ruby by ruby[bot] [repeated join/part detected]
<phaul> yeah, I was a bit disappointed printing random chars on my screen first. then... whoa! that's cool!
* baweaver wanders in
mksybr has joined #ruby
GodFather has quit [Ping timeout: 244 seconds]
viaduct has joined #ruby
viaduct has quit [Remote host closed the connection]
ivanskie has quit [Quit: Textual IRC Client: www.textualapp.com]
Fernando-Basso has quit [Remote host closed the connection]
dellavg_ has quit [Ping timeout: 246 seconds]
hutch has joined #ruby
conta has joined #ruby
Dbugger has quit [Quit: Leaving]
conta has quit [Ping timeout: 268 seconds]
<mspo> cthulchu_: does it dtrt if that character is wide?
masterasia has joined #ruby
<mspo> (fyi ruby25 seems to)
<mspo> with the extra annoying string: ⚛⚛⚛ :)
<cthulchu_> gonna try
<cthulchu_> wowowowow
<cthulchu_> what a hack!
<mspo> cthulchu_: ?
<cthulchu_> 2.2.0 :022 > ⚛⚛⚛[0]
<cthulchu_> NameError: undefined local variable or method `⚛⚛⚛' for main:Object
<cthulchu_> oh
<cthulchu_> quotes
<cthulchu_> my bad
<mspo> put it in ""
<mspo> yeah :)
<cthulchu_> => "⚛"
<cthulchu_> works fine in 2.2.0
<mspo> cool
gix has quit [Ping timeout: 268 seconds]
cnsvc has joined #ruby