baweaver changed the topic of #ruby to: Rules & more: https://ruby-community.com | Ruby 2.5.1, 2.4.4, 2.3.7, 2.6.0-preview2: 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!
schneider has quit [Ping timeout: 252 seconds]
spiette has quit [Remote host closed the connection]
bkxd has quit [Ping timeout: 252 seconds]
cschneid_ has joined #ruby
schneider has joined #ruby
spiette has joined #ruby
schneider has quit [Ping timeout: 244 seconds]
ta_ has quit [Ping timeout: 252 seconds]
nertzy has joined #ruby
schneider has joined #ruby
SeepingN_ has quit [Quit: The system is going down for reboot NOW!]
schneider has quit [Ping timeout: 268 seconds]
schneider has joined #ruby
graphene has quit [Remote host closed the connection]
graphene has joined #ruby
darkhanb has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
schneider has quit [Ping timeout: 244 seconds]
deadnull has joined #ruby
wildermind has quit [Quit: Connection closed for inactivity]
schneider has joined #ruby
cschneid_ has quit [Ping timeout: 245 seconds]
schneider has quit [Ping timeout: 252 seconds]
deadnull has quit [Quit: Textual IRC Client: www.textualapp.com]
schneider has joined #ruby
nertzy has quit [Quit: This computer has gone to sleep]
schneider has quit [Ping timeout: 268 seconds]
uplime has joined #ruby
schneider has joined #ruby
MoritaShinobu has joined #ruby
schneider has quit [Ping timeout: 244 seconds]
schneider has joined #ruby
schneider has quit [Ping timeout: 252 seconds]
bkxd has joined #ruby
schneider has joined #ruby
schneider has quit [Ping timeout: 272 seconds]
schneider has joined #ruby
schneider has quit [Ping timeout: 252 seconds]
TomyLobo has quit [Read error: Connection reset by peer]
schneider has joined #ruby
schneider has quit [Ping timeout: 252 seconds]
dmitch has quit [Quit: Textual IRC Client: www.textualapp.com]
aleph- has joined #ruby
cthu| has quit [Ping timeout: 244 seconds]
devyn has quit [Remote host closed the connection]
schneider has joined #ruby
pskosinski has quit [Ping timeout: 246 seconds]
pskosinski has joined #ruby
darkhanb has joined #ruby
schneider has quit [Ping timeout: 244 seconds]
schneider has joined #ruby
schneider has quit [Ping timeout: 244 seconds]
dbz has joined #ruby
ramfjord has quit [Ping timeout: 246 seconds]
schneider has joined #ruby
schneider has quit [Ping timeout: 244 seconds]
<edwardthefma> Yawn
cagomez has joined #ruby
schneider has joined #ruby
segy has quit [Ping timeout: 272 seconds]
schneider has quit [Ping timeout: 272 seconds]
chouhoulis has joined #ruby
schneider has joined #ruby
schneider has quit [Ping timeout: 272 seconds]
schneider has joined #ruby
ta_ has joined #ruby
joast has quit [Remote host closed the connection]
schneider has quit [Ping timeout: 252 seconds]
joast has joined #ruby
za1b1tsu has joined #ruby
cschneid_ has joined #ruby
aleph- has quit [Ping timeout: 252 seconds]
schneider has joined #ruby
schneider has quit [Ping timeout: 244 seconds]
ta_ has quit [Ping timeout: 252 seconds]
schneider has joined #ruby
chouhoulis has quit [Remote host closed the connection]
chouhoulis has joined #ruby
schneider has quit [Ping timeout: 245 seconds]
schneider has joined #ruby
<zenspider> !connection schneider
schneider was kicked from #ruby by ruby[bot] [repeated join/part detected]
devyn has joined #ruby
<edwardthefma> Owch
gix has joined #ruby
braincrash has quit [Quit: bye bye]
cschneid_ has quit [Ping timeout: 272 seconds]
fluxAeon has joined #ruby
DecimPrime has joined #ruby
LenPayne has quit [Quit: ZNC 1.7.1 - https://znc.in]
braincrash has joined #ruby
bkxd has quit [Ping timeout: 252 seconds]
chouhoulis has quit [Remote host closed the connection]
LenPayne has joined #ruby
segy has joined #ruby
dbz has quit [Remote host closed the connection]
bkxd has joined #ruby
tdy has quit [Ping timeout: 245 seconds]
tdy has joined #ruby
d^sh has quit [Ping timeout: 252 seconds]
d^sh has joined #ruby
cschneid_ has joined #ruby
moei has quit [Quit: Leaving...]
cschneid_ has quit [Ping timeout: 246 seconds]
apeiros has joined #ruby
orbyt_ has joined #ruby
apeiros has quit [Ping timeout: 252 seconds]
savolla has joined #ruby
elphe has quit [Ping timeout: 246 seconds]
chouhoulis has joined #ruby
eckhardt has quit [Quit: Textual IRC Client: www.textualapp.com]
eckhardt has joined #ruby
chouhoulis has quit [Ping timeout: 252 seconds]
elphe has joined #ruby
duderonomy has joined #ruby
Puffball has joined #ruby
samort7 has quit [Read error: Connection reset by peer]
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Lytol has quit [Remote host closed the connection]
Miron has quit [Ping timeout: 244 seconds]
seggy has quit [Quit: leaving]
tdy has quit [Ping timeout: 244 seconds]
seggy has joined #ruby
ta_ has joined #ruby
tdy has joined #ruby
nertzy has joined #ruby
nertzy has quit [Quit: This computer has gone to sleep]
cagomez has quit [Remote host closed the connection]
cagomez has joined #ruby
Furai has quit [Quit: WeeChat 2.2]
nowhere_man has quit [Ping timeout: 252 seconds]
cagomez has quit [Ping timeout: 268 seconds]
ta_ has quit [Ping timeout: 268 seconds]
nowhere_man has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
savolla has quit [Ping timeout: 252 seconds]
DTZUZO has quit [Ping timeout: 245 seconds]
Furai has joined #ruby
savolla has joined #ruby
duderonomy has joined #ruby
cschneid_ has joined #ruby
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
moei has joined #ruby
apeiros has joined #ruby
elphe has quit [Ping timeout: 246 seconds]
cschneid_ has quit [Ping timeout: 252 seconds]
jcalla has quit [Quit: Leaving]
savolla has quit [Ping timeout: 246 seconds]
elphe has joined #ruby
duderonomy has joined #ruby
duderonomy has quit [Client Quit]
dellavg_ has joined #ruby
apeiros has quit [Remote host closed the connection]
apeiros has joined #ruby
_whitelogger has joined #ruby
ta_ has joined #ruby
dinfuehr has quit [Ping timeout: 260 seconds]
dinfuehr has joined #ruby
cschneid_ has joined #ruby
BloodyMary has joined #ruby
apeiros has quit [Remote host closed the connection]
apeiros has joined #ruby
BloodyMary has left #ruby [#ruby]
c0ncealed3 has quit [Remote host closed the connection]
duderonomy has joined #ruby
c0ncealed3 has joined #ruby
elphe has quit [Ping timeout: 252 seconds]
agent_white has quit [Quit: bbl]
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
za1b1tsu has quit [Ping timeout: 252 seconds]
tdy has quit [Ping timeout: 272 seconds]
reber has joined #ruby
dbz has joined #ruby
za1b1tsu has joined #ruby
doubledup has joined #ruby
maasha has joined #ruby
doubledup has quit [Max SendQ exceeded]
cschneid_ has quit [Ping timeout: 268 seconds]
doubledup has joined #ruby
<maasha> I have an array of hashes. I want to create a new array with the first hash value for each hash?
<maasha> [{a: 1, b: 2}, {a: 3, b: 4}] => [1, 3]
<maasha> hash slice flatten?
<apeiros> maasha: take a look at Array#map
<apeiros> why slice? for slice you need to know the key, not the position
<maasha> yeah, inject it was. This works ary.sort_by { |e| -1 * e[:score] }.inject([]) {|a, e| a << e[:relation] }
<apeiros> ok, that solution has like *nothing* to do with your question
<maasha> some sort of Schwartzian transform ;o)
<apeiros> why do oyu ask for "first hash value" when you actually know the key you want hte value of?
<apeiros> also -1 * e[:score] is a rather overcomplicated way to say -e[:score]
<maasha> :oD - but it is that structure
<apeiros> .inject([]) {|a, e| a << e[:relation] } --> .map { |e| e[:relation] }
<apeiros> so: ary.sort_by { |e| -e[:score] }.map { |e| e[:relation] }
<maasha> apeiros: great! I love ruby golfing !
<apeiros> I love ruby use-the-right-tool-for-the-job :-p, the compaction of the code is just fringe benefit.
<apeiros> is there a verb for "concise"?
<maasha> consize?
<apeiros> 🤣👍🏻
<VeryBewitching> apeiros: Distill.
<VeryBewitching> Probably the best fit.
<apeiros> also nice
<Radar> That word is very bewitching.
<VeryBewitching> Radar: o/
<Radar> o/
<apeiros> 👋🏻
phaul has joined #ruby
duderonomy has joined #ruby
ta_ has quit [Ping timeout: 272 seconds]
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
duderonomy has joined #ruby
ramfjord has joined #ruby
elphe has joined #ruby
ramfjord has quit [Ping timeout: 268 seconds]
phaul has quit [Quit: WeeChat 2.2]
phaul has joined #ruby
tdy has joined #ruby
phaul has quit [Client Quit]
phaul has joined #ruby
maasha has quit [Quit: Page closed]
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<lemur> ohai
lemur is now known as baweaver
<baweaver> ohai
<apeiros> moin
<baweaver> eve'n
<baweaver> apeiros: Have I told you about my new crazy thing yet?
<apeiros> since I've been offline for a while - probably not :D
<baweaver> What do you think this fellow is for? - https://twitter.com/keystonelemur/status/1047935342244851712
<baweaver> Came up with an interesting idea while musing on how Santa can scale and deliver presents, and came to an even more interesting answer: Mrs Claus does it all
DecimPrime has quit [Ping timeout: 252 seconds]
<baweaver> She's the one behind monitoring, logging, infra, scaling, ddos(anta) mitigation, all of it. Santa just does the deliveries
<baweaver> So Santa gets sick, and the lemurs get a call, which let to this fun little talk idea for December: https://gist.github.com/baweaver/512e901196d195c7dda5a3b394bd61d1
<apeiros> :)
<baweaver> Scaling Christmas - An Illustrated Adventure in Holiday Ops
LiftLeft has quit [Quit: Bye]
LiftLeft has joined #ruby
cschneid_ has joined #ruby
<VeryBewitching> No reindeer in your talk, I suppose Santa has a Fedex account?
<baweaver> Globally sharded distribution centers running sleigh manufacturing automation plants
<baweaver> The reindeer didn't scale past the first 100 million
<baweaver> but they have been used as a regional distribution avenue
<VeryBewitching> The Industrial North Pole: A Competitive Analysis of Shaped Wood in Sleigh Production
<baweaver> They prefer carbon fiber
<VeryBewitching> lol
<baweaver> lighter
<VeryBewitching> Those are smart elves.
<baweaver> ( mind I'm improv'ing the heck out of this )
<VeryBewitching> I love the idea, it's easy to have fun with while still being productive.
<baweaver> and I've done exactly this when I was working at Playstation, so it makes for a more realistic story too :D
<baweaver> It'll only be given 3 times and be a 10-15m talk, so quite an investment
<baweaver> but Christmas is special, so I want to spread the cheer :)
sauvin_ has joined #ruby
<baweaver> As to why I bring this up in October? It takes me 1-2 months to get an Illustrated Adventure ready
Sauvin has quit [Ping timeout: 260 seconds]
<baweaver> It's submitted to Fog City Ruby and WaffleJS in December, we'll see if they'
<baweaver> re interested in it
ellcs has joined #ruby
* apeiros afk for a while, got to continue my target disk mode experiments… last round now :)
apeiros has quit []
tdy has quit [Ping timeout: 252 seconds]
postmodern has quit [Quit: Leaving]
apeiros_ has joined #ruby
apeiros_ has quit [Remote host closed the connection]
doubledup has quit [Quit: Leaving]
doubledup has joined #ruby
cschneid_ has quit [Ping timeout: 252 seconds]
apeiros_ has joined #ruby
doubledup has quit [Quit: Leaving]
doubledup has joined #ruby
VeryBewitching has quit [Quit: Konversation terminated!]
xfbs has joined #ruby
conta has joined #ruby
doubledup has quit [Quit: Leaving]
doubledup has joined #ruby
graphene has quit [Remote host closed the connection]
tdy has joined #ruby
elphe has quit [Ping timeout: 268 seconds]
graphene has joined #ruby
sameerynho has joined #ruby
rprimus has quit [Remote host closed the connection]
ellcs has quit [Ping timeout: 240 seconds]
hahuang6- has joined #ruby
Fernando-Basso has joined #ruby
hahuang65 has quit [Ping timeout: 240 seconds]
elphe has joined #ruby
kapil____ has joined #ruby
sauvin_ is now known as Sauvin
aupadhye has joined #ruby
tdy has quit [Ping timeout: 268 seconds]
cschneid_ has joined #ruby
ramfjord has joined #ruby
ramfjord has quit [Ping timeout: 252 seconds]
Miron has joined #ruby
cschneid_ has quit [Ping timeout: 272 seconds]
aupadhye has quit [Quit: Leaving]
Miron has quit [Ping timeout: 260 seconds]
Miron has joined #ruby
<guardian> hello
<guardian> can someone please remind me how to solve that
<guardian> I'm debugging some code through rspec
<guardian> and I want to stop in pry with require 'pry' ; binding.pry
<guardian> except that rspec keeps outputing the current progress in the terminal
<guardian> it looks like it has a monitoring thread doing so
<guardian> is there a way to disable it?
conta has quit [Quit: conta]
d^sh has quit [Ping timeout: 246 seconds]
d^sh has joined #ruby
AJA4350 has joined #ruby
dbz has quit [Remote host closed the connection]
typeVoid has quit [Quit: The Lounge - https://thelounge.chat]
dbz has joined #ruby
MyMind has joined #ruby
Sembei has quit [Ping timeout: 252 seconds]
dbz has quit [Ping timeout: 268 seconds]
cschneid_ has joined #ruby
DTZUZO has joined #ruby
graphene has quit [Remote host closed the connection]
graphene has joined #ruby
DTZUZO has quit [Ping timeout: 272 seconds]
desperek has joined #ruby
DTZUZO has joined #ruby
tdy has joined #ruby
ramfjord has joined #ruby
cschneid_ has quit [Ping timeout: 252 seconds]
ramfjord has quit [Ping timeout: 246 seconds]
bkxd has quit [Ping timeout: 245 seconds]
RougeR has joined #ruby
tdy has quit [Ping timeout: 245 seconds]
conta has joined #ruby
xt233 has joined #ruby
za1b1tsu has quit [Ping timeout: 272 seconds]
akem has quit [Ping timeout: 246 seconds]
akem has joined #ruby
lypsis has quit [Quit: ZNC - http://znc.in]
xt233 has quit [Quit: Leaving]
lypsis has joined #ruby
cschneid_ has joined #ruby
wildermind has joined #ruby
bkxd has joined #ruby
za1b1tsu has joined #ruby
dreamthese has quit [Remote host closed the connection]
dreamthese has joined #ruby
za1b1tsu has quit [Ping timeout: 244 seconds]
ellcs has joined #ruby
MoritaShinobu has quit [Quit: Leaving]
dbz has joined #ruby
cschneid_ has quit [Ping timeout: 252 seconds]
ellcs has quit [Ping timeout: 260 seconds]
apeiros_ has quit []
za1b1tsu has joined #ruby
al2o3-cr has quit [Read error: Connection reset by peer]
za1b1tsu has quit [Ping timeout: 252 seconds]
ellcs has joined #ruby
al2o3-cr has joined #ruby
al2o3-cr has quit [Ping timeout: 246 seconds]
ramfjord has joined #ruby
nertzy has joined #ruby
al2o3-cr has joined #ruby
ramfjord has quit [Ping timeout: 252 seconds]
DTZUZU has quit [Quit: WeeChat 1.9]
ramfjord has joined #ruby
nertzy has quit [Quit: This computer has gone to sleep]
sgen has joined #ruby
dbz has quit [Remote host closed the connection]
dbz has joined #ruby
ellcs has quit [Remote host closed the connection]
ramfjord has quit [Ping timeout: 246 seconds]
ellcs has joined #ruby
nertzy has joined #ruby
za1b1tsu has joined #ruby
dbz has quit [Ping timeout: 272 seconds]
dbz has joined #ruby
tdy has joined #ruby
Dbugger has joined #ruby
cschneid_ has joined #ruby
akem__ has joined #ruby
nertzy has quit [Quit: This computer has gone to sleep]
za1b1tsu has quit [Ping timeout: 246 seconds]
akem has quit [Ping timeout: 260 seconds]
Nicmavr has quit [Read error: Connection reset by peer]
Nicmavr has joined #ruby
ellcs has quit [Ping timeout: 260 seconds]
nertzy has joined #ruby
_whitelogger has joined #ruby
dbz_ has joined #ruby
nertzy has quit [Quit: This computer has gone to sleep]
twe4ked has quit [Ping timeout: 240 seconds]
dbz has quit [Ping timeout: 252 seconds]
druonysus has quit [Ping timeout: 252 seconds]
GodFather has joined #ruby
twe4ked has joined #ruby
tdy has quit [Ping timeout: 252 seconds]
cschneid_ has quit [Ping timeout: 268 seconds]
xfbs has quit [Quit: afk]
xfbs has joined #ruby
za1b1tsu has joined #ruby
xfbs has quit [Client Quit]
za1b1tsu has quit [Ping timeout: 252 seconds]
chouhoulis has joined #ruby
apeiros_ has joined #ruby
RougeR has quit [Ping timeout: 252 seconds]
Tempesta has quit [Quit: See ya!]
GodFather has quit [Ping timeout: 240 seconds]
dbz_ has quit [Remote host closed the connection]
Tempesta has joined #ruby
dbz has joined #ruby
dbz has quit [Remote host closed the connection]
eckhardt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
eckhardt has joined #ruby
al2o3-cr has quit [Ping timeout: 246 seconds]
za1b1tsu has joined #ruby
eckhardt_ has joined #ruby
Emmanuel_Chanel has quit [Read error: No route to host]
za1b1tsu has quit [Ping timeout: 244 seconds]
chouhoulis has quit [Remote host closed the connection]
nertzy has joined #ruby
Emmanuel_Chanel has joined #ruby
tdy has joined #ruby
nertzy has quit [Quit: This computer has gone to sleep]
chouhoulis has joined #ruby
cschneid_ has joined #ruby
cschneid_ has quit [Read error: Connection reset by peer]
ellcs has joined #ruby
chouhoulis has quit [Ping timeout: 240 seconds]
chouhoulis has joined #ruby
Fr4n has quit [Read error: Connection reset by peer]
Fr4n has joined #ruby
za1b1tsu has joined #ruby
duderonomy has joined #ruby
za1b1tsu has quit [Ping timeout: 252 seconds]
rprimus has joined #ruby
duderonomy has quit [Client Quit]
za1b1tsu has joined #ruby
Emmanuel_Chanel has quit [Read error: Connection reset by peer]
bmurt has joined #ruby
Emmanuel_Chanel has joined #ruby
za1b1tsu has quit [Ping timeout: 260 seconds]
elphe has quit [Ping timeout: 272 seconds]
cschneid_ has joined #ruby
doubledup has quit [Quit: Leaving]
conta has quit [Quit: conta]
ogotai has joined #ruby
orbyt_ has joined #ruby
eckhardt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<ogotai> folks, what am I doing wrong with regexp repetition - if my input == ", a=true, c='d'", then this works - /^([, \w]*=['\w]*)([, \w]*=['\w]*)$/.match(input) --- but this doesn't - /^([, \w]*=['\w]*){2}$/.match(input)
<ogotai> it's exactly the same regex, second instance I'm just doing (pattern){2}, instead of (pattern)(pattern), and yet the (pattern){2} fails
<ogotai> when I say fails, it just matches the second instance, the ", c='d'" part of the string
Eiam has quit [Ping timeout: 252 seconds]
RougeR has joined #ruby
<baweaver> ogotai: What exactly are you trying to do?
cschneid_ has quit [Ping timeout: 240 seconds]
<baweaver> Could you not use `input.split(/, */).map { |pair| pair.split('=') }` ?
za1b1tsu has joined #ruby
<ogotai> baweaver: I could, but it's a much longer string with other complications, I thought I could have a nicely crafted regex to extract all I need and just iterate over match data
<baweaver> If you can avoid complicated regex, do so.
<ogotai> and now that it got under my skin, I'm really curious why this regex doesn't work :)
<ogotai> I know, it became an obsession more than anything
RougeR has quit [Ping timeout: 260 seconds]
za1b1tsu has quit [Ping timeout: 272 seconds]
<baweaver> rubular.com
<baweaver> That helps get a visual of why something does or does not work.
<ogotai> same result, I expect 2 match groups, but getting 1 -- http://rubular.com/r/nNir8FGbGY
<ogotai> I'm reading that "".scan() possibly behaves in the way I want, and .match() might not...
<ogotai> though not getting out of "".scan() the desired result either
eckhardt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
eckhardt has joined #ruby
<ogotai> okay, success -- input.scan(/([, \w]*=['\w]*)/) -- just had to abandon any indication of repetition in the regex itself (i.e. the {2} thing), and use String#scan() instead of Regexp#match() - ruby can be sometimes confusing
<apeiros_> ogotai: just replacing the second group with {2} still matches for me
<apeiros_> but ruby's regex engine does not repeat capturing groups
<apeiros_> so if you quantify a capturing group, you'll only get the last substring it matches
apeiros_ is now known as apeiros
<apeiros> personally I'd prefer if it'd match as arrays (or nested arrays in case of nested quantified capturing groups)
<apeiros> (or hashes and nested hashes/arrays in case of named capturing groups)
<ogotai> apeiros: yep, although supposedly (?=(regex)) is backtracking and matching everything, but that didn't work for me either
<apeiros> (?=) is a lookahead and does not consume
<apeiros> backtracking is a different mechanism
<ogotai> I see, well, there probably is a way to do this in match(), but seems like scan() is nicely returning all repeating matches as array, so happy with that
<apeiros> there is no way with quantified captures. rubys regex engine simply doesn't do that.
<apeiros> and yes, scan can be a way around that. and if scan is insufficient, there's also its bigger sibling StringScanner
<ogotai> thanks, will look into StringScanner
Dbugger has quit [Ping timeout: 252 seconds]
ellcs has quit [Ping timeout: 240 seconds]
al2o3-cr has joined #ruby
thinkpad has quit [Ping timeout: 244 seconds]
thinkpad has joined #ruby
dbz has joined #ruby
dbz has quit [Remote host closed the connection]
dbz has joined #ruby
dbz_ has joined #ruby
graphene has quit [Remote host closed the connection]
dbz has quit [Ping timeout: 244 seconds]
xfbs has joined #ruby
Fr4n has quit [Read error: Connection reset by peer]
Fr4n has joined #ruby
apeiros has quit [Read error: Connection reset by peer]
apeiros__ has joined #ruby
agent_white has joined #ruby
dellavg_ has quit [Ping timeout: 244 seconds]
Vapez has joined #ruby
pabs has joined #ruby
za1b1tsu has joined #ruby
grenierm has quit [Quit: grenierm]
za1b1tsu has quit [Ping timeout: 252 seconds]
wildermind has quit [Quit: Connection closed for inactivity]
grenierm has joined #ruby
grenierm has quit [Client Quit]
doubledup has joined #ruby
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
dbz_ has quit [Remote host closed the connection]
dbz has joined #ruby
craysiii has joined #ruby
dbz has quit [Remote host closed the connection]
dbz has joined #ruby
thinkpad has quit [Ping timeout: 268 seconds]
dbz has quit [Remote host closed the connection]
thinkpad has joined #ruby
Puffball has quit [Read error: Connection reset by peer]
Pisuke has joined #ruby
MyMind has quit [Ping timeout: 268 seconds]
grenierm has joined #ruby
Sembei has joined #ruby
Pisuke has quit [Ping timeout: 268 seconds]
dbz has joined #ruby
akem__ has quit [Ping timeout: 252 seconds]
grenierm has quit [Quit: grenierm]
Puffball has joined #ruby
kapil____ has quit [Quit: Connection closed for inactivity]
themsay has joined #ruby
al2o3-cr has quit [Quit: WeeChat 2.2]
tdy has quit [Quit: WeeChat 2.2]
dbz has quit [Remote host closed the connection]
al2o3-cr has joined #ruby
<zenspider> ogotai: you might prefer split
mroutis has joined #ruby
mroutis has quit [Remote host closed the connection]
cagomez has joined #ruby
tdy has joined #ruby
apeiros__ is now known as apeiros
za1b1tsu has joined #ruby
za1b1tsu has quit [Ping timeout: 252 seconds]
cagomez has quit [Remote host closed the connection]
reber has quit [Remote host closed the connection]
duderonomy has joined #ruby
cagomez has joined #ruby
mroutis has joined #ruby
<mroutis> What's a good way to read from IO (line by line) without a huge memory impact?
IanMalcolm has joined #ruby
elphe has joined #ruby
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
IanMalcolm has quit [Quit: Textual IRC Client: www.textualapp.com]
Nicmavr has quit [Quit: ZNC 1.7.0 - https://znc.in]
desperek has quit [Quit: xoxo]
<uplime> /b 4
<mroutis> uplime: ?
Nicmavr has joined #ruby
<al2o3-cr> mroutis: i think they're changing buffers.
<al2o3-cr> at a guess anyway.
<mroutis> ohh, right
<uplime> to a very important one too
clemens3 has joined #ruby
<apeiros> mroutis: sure, IO#foreach f.ex.
<apeiros> or things like IO#each_line, #gets, #read with a length arg, etc.
<mroutis> apeiros: what about each_line?
<mroutis> right, thanks
<apeiros> well, re #each_line - unless you have other things to do with the IO, there no point in needing the added code.
<mroutis> what added code are you refering to?
akem has joined #ruby
clemens3 has quit [Ping timeout: 252 seconds]
dbz has joined #ruby
<apeiros> mroutis: well, you have to open the file in order to have a filehandle to call #each_line on it
xfbs has quit [Quit: afk]
<mroutis> ohh, silly me, I was doing ARGF.each_line, wondering why it was consuming a lot of memory; I guess is trying to read everything at once
<apeiros> no, it doesn't
<apeiros> but feel free to gist your full code. maybe you do something which causes memory bloat
xfbs has joined #ruby
cagomez has quit [Remote host closed the connection]
phaul has quit [Quit: WeeChat 2.2]
IanMalcolm has joined #ruby
chouhoulis has quit [Remote host closed the connection]
<mroutis> sure, apeiros, I was trying to solve the first and easiest codechef problem using ruby: https://www.codechef.com/viewsolution/18471591
<mroutis> basically, you've a file with numbers, and you output just the lines that have `42` included
<apeiros> mroutis: that doesn't look like it should consume a lot of memory. unless your lines are huge.
<mroutis> using sed, it would be `sed -n /42/p`
<mroutis> lines are just a number
<mroutis> if you have a look at the proposed solution in their dashboard, it says that it consumes 28M !
RougeR has joined #ruby
<apeiros> break means it'll stop at the first 42
<apeiros> 28M might just be ruby + rubygems tbh :D
doubledup has quit [Quit: Leaving]
* mroutis facepalm
<apeiros> hm, though on my machine it's 11MB
<mroutis> right, it stops at the first 42 number
<mroutis> so, it would be `sed -n 1,/42/p`
uplime has quit [Ping timeout: 268 seconds]
<mroutis> It's weird, apeiros, because there are other solutions consuming 0M of memory
IanMalcolm has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
<mroutis> (in ruby)
dbz has quit [Remote host closed the connection]
<apeiros> 0M of memory is quite amazing. it means it doesn't even start ruby 😂
<mroutis> everyone is doing this `gets.chomp` thingy; it's more fun if you can write "efficient" and readable code
<mroutis> I think they don't take into account the memory accumulated before running the code
<apeiros> ok
<apeiros> not quite sure why it says your would use 28MB. the solution looks sensible (apart from the break vs. next mistake).
<apeiros> also not quite sure why the topmost solution uses chomp. to_i will throw away the newline anyway.
<mroutis> indeed
za1b1tsu has joined #ruby
<apeiros> hm, though those solutions all do stop at the first 42
<mroutis> yes, I misread my code, apeiros ... I thought it was intended to output just `42` (the `next` solution), but it's about printing until you match the first 42 (`break` one)
<mroutis> sorry for that one, hehe
Vapez has quit [Read error: Connection reset by peer]
za1b1tsu has quit [Ping timeout: 246 seconds]
<mroutis> lol, I copypasted the solution with 0M and submitted it again with my account
<mroutis> 27.6M
zapata has quit [Quit: WeeChat 2.2]
<mroutis> I don't know if they are loading more stuff than needed, or it is the base runtime memspace of ruby 2.3.3
<mroutis> well, mystery solved, thank you a lot, apeiros, it was bugging me like crazy
Freshnuts has joined #ruby
duderonomy has joined #ruby
<apeiros> mroutis: good to know. I guess their instrumentation was not updated along with other things.
duderonomy has quit [Client Quit]
duderonomy has joined #ruby
xfbs has quit [Quit: afk]
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
beeman has quit []
beeman has joined #ruby
sgen has quit [Ping timeout: 260 seconds]