<shevy>
hmm I have a string and I regex check on it
<shevy>
string =~ / (.*\.la)/
<shevy>
then I use $1
kitak has joined #ruby
<shevy>
is there a more elegant but shorter variant to the above?
<omosoj>
Don't know how to create an appropriate flow control structure.
phoo1234567 has quit [Quit: Leaving]
Nexus_x1__ has joined #ruby
lolmaus has quit [Ping timeout: 245 seconds]
<omosoj>
I think I need recursion but I don't know how to do it.
<arrubin>
shevy: end_with?
<arrubin>
shevy: Or might there be more after .la?
pen has quit [Remote host closed the connection]
* arrubin
assumes so.
binaryhat has joined #ruby
<shevy>
arrubin the regex is not the problem, the regex is complete
r0bby is now known as robbyoconnor
<shevy>
arrubin I try to avoid $1, but it seems so short hmm
sunya7a has joined #ruby
fgo has joined #ruby
rkazak_ has quit [Quit: rkazak_]
Hanmac has joined #ruby
oo_ has joined #ruby
_Andres has quit [Quit: My Mac Pro has gone to sleep. ZZZzzz…]
phutchins has joined #ruby
<shevy>
omosoj the problem is that that code isn't minimal yet
Olipro has joined #ruby
<shevy>
one requires quite a bit of thinking to come to it
<shevy>
if you could chunk it into smaller parts...
Olipro has quit [Max SendQ exceeded]
rkazak has joined #ruby
ErrantEgo has joined #ruby
ErrantEgo has left #ruby [#ruby]
justinxreese has joined #ruby
<omosoj>
shevy, hmm. I am trying to create a method that checks if a number is prime, and if so deletes a numeral, then runs the same function again recursively.
Spami has joined #ruby
<omosoj>
Is that not the best approach?
Olipro has joined #ruby
<shevy>
dunno, I would first make a method that checks if a number is a prime or not
Spami has quit [Max SendQ exceeded]
subbyyy_ has quit [Ping timeout: 245 seconds]
sunya7a has quit [Ping timeout: 240 seconds]
oo_ has quit [Remote host closed the connection]
<shevy>
the "if so deletes a numeral part" I would do outside of that method, with a .reject {} condition on my sample instead
fgo has quit [Ping timeout: 250 seconds]
<shevy>
it's easier to do this in english
<shevy>
"remove all non-primes from my array"
<omosoj>
Oh, whoa, I didn't even think of that.
<omosoj>
Wait, no. Why is that important?
Olipro has quit [Max SendQ exceeded]
<omosoj>
Only the first and the last digit need be primes.
<shevy>
well you wrote above that you will create a method that checks if a number is prime, and if yes, delete it
zorak8 has joined #ruby
kotk has joined #ruby
<shevy>
ok so then it is even simpler
<shevy>
you just catch the first and last element of your respective array/digit
mjs2600 has joined #ruby
razrunelord has joined #ruby
<omosoj>
That's like a disqualifier as I iterate up. But how do I write a recursive function to check for primes as I delete digits?
tkuchiki has quit [Remote host closed the connection]
<shevy>
do you have the method that checks for primes
<omosoj>
does it need to be more complicated than Prime.prime?(x) ?
Olipro has joined #ruby
aiguu has joined #ruby
<shevy>
I love methods
kotk_ has quit [Ping timeout: 240 seconds]
eighthbit has joined #ruby
<shevy>
where is Prime.prime? btw
<shevy>
huh
<omosoj>
In the gist?
LexicalScope has quit [Read error: Connection reset by peer]
<shevy>
so now what's left to do is to chunk down on the digits you require/want
aiguu has quit [Ping timeout: 258 seconds]
drago777 has quit [Ping timeout: 240 seconds]
qhartman has quit [Ping timeout: 240 seconds]
aspiers has joined #ruby
contradictioned_ has joined #ruby
tiagonobre_ has quit [Ping timeout: 240 seconds]
ccooke has quit [Ping timeout: 240 seconds]
Affix has quit [Ping timeout: 240 seconds]
jaredrhine has quit [Ping timeout: 240 seconds]
ccooke_ has joined #ruby
gyre007 has joined #ruby
kitak has quit [Read error: Connection reset by peer]
mateu has quit [Ping timeout: 240 seconds]
petems_ has quit [Ping timeout: 240 seconds]
kitak has joined #ruby
contradictioned has quit [Ping timeout: 240 seconds]
Cope has quit [Ping timeout: 240 seconds]
jaredrhine has joined #ruby
Cope has joined #ruby
petems has joined #ruby
drago777 has joined #ruby
mateu has joined #ruby
saltsa_ has quit [Ping timeout: 240 seconds]
tiagonobre_ has joined #ruby
Gooder has joined #ruby
Hanmac1 has joined #ruby
<omosoj>
Hmm. The problem says that you delete from each end, and each result needs to be prime.
spyderma_ has quit [Ping timeout: 250 seconds]
saltsa has joined #ruby
<omosoj>
like: abcd must be prime, bcd must be prime, cd, and d; then abc, ab, a
<shevy>
yeah not really sure I understand the problem at all
Hanmac has quit [Ping timeout: 276 seconds]
wereHamster has joined #ruby
<omosoj>
Lol
ozzloy_ has joined #ruby
<shevy>
you basically need to chop down an array from both ends simultaneously
chipotle has quit [Quit: cya]
patronus_ has joined #ruby
<omosoj>
Not simultaneously...
<shevy>
huh
wereHams1er has quit [Ping timeout: 240 seconds]
ozzloy has quit [Ping timeout: 240 seconds]
Olipro has quit [Read error: Connection reset by peer]
<shevy>
"The problem says that you delete from each end"
<shevy>
but it has two ends right?
<omosoj>
yeah, but chop from the right end, and each time the resulting number must be prime. then you start from the left end and do the same.
<shevy>
hmm
<omosoj>
so they are separate tasks
flowerha_ has joined #ruby
peeja_ has joined #ruby
sonofgam1keeper has joined #ruby
droptone_ has joined #ruby
xea_ has joined #ruby
flowerhack has quit [Ping timeout: 245 seconds]
jhass- has joined #ruby
xm_ has joined #ruby
Killerkeksdose_ has joined #ruby
jhass- is now known as jhass
bsutt_ has joined #ruby
Morrolan has quit [Ping timeout: 240 seconds]
peeja has quit [Ping timeout: 240 seconds]
xea has quit [Ping timeout: 240 seconds]
zzak_ has quit [Ping timeout: 240 seconds]
adamholt has quit [Ping timeout: 240 seconds]
Sonofgamekeeper has quit [Ping timeout: 240 seconds]
miah has quit [Ping timeout: 240 seconds]
xm has quit [Ping timeout: 240 seconds]
jhass|off has quit [Ping timeout: 240 seconds]
qubit has quit [Ping timeout: 240 seconds]
droptone has quit [Ping timeout: 240 seconds]
binaryhat has quit [Ping timeout: 240 seconds]
radic has quit [Ping timeout: 240 seconds]
axisys has quit [Ping timeout: 240 seconds]
Killerkeksdose has quit [Ping timeout: 240 seconds]
bsutt has quit [Ping timeout: 240 seconds]
msch has quit [Ping timeout: 240 seconds]
xybre has quit [Ping timeout: 240 seconds]
katlogic has quit [Ping timeout: 240 seconds]
bier has quit [Excess Flood]
mnemon has quit [Read error: Connection reset by peer]
RubyPanther has quit [Ping timeout: 240 seconds]
patronus has quit [Ping timeout: 240 seconds]
vitorbaptista has quit [Ping timeout: 240 seconds]
cescalante has quit [Ping timeout: 240 seconds]
peeja_ is now known as peeja
katlogic has joined #ruby
adamholt_ has joined #ruby
bier_ has joined #ruby
cescalante has joined #ruby
mclee has quit [Ping timeout: 240 seconds]
itman has quit [Ping timeout: 240 seconds]
dmead has quit [Ping timeout: 240 seconds]
ti-wali has quit [Remote host closed the connection]
itman has joined #ruby
RubyPanther has joined #ruby
Rydekull has quit [Ping timeout: 240 seconds]
matrixise has quit [Ping timeout: 240 seconds]
Scient has quit [Ping timeout: 240 seconds]
qhartman has joined #ruby
dmead has joined #ruby
Affix has joined #ruby
mityaz has quit [Ping timeout: 240 seconds]
andrewjf has quit [Ping timeout: 240 seconds]
spinx^ has quit [Ping timeout: 240 seconds]
shaman42 has quit [Ping timeout: 240 seconds]
likemike has quit [Ping timeout: 240 seconds]
zzak_ has joined #ruby
shaman42 has joined #ruby
flowerha_ has quit [Remote host closed the connection]
axisys has joined #ruby
matrixise has joined #ruby
miah has joined #ruby
qubit has joined #ruby
xybre has joined #ruby
xybre has joined #ruby
xybre has quit [Changing host]
mityaz has joined #ruby
Morrolan has joined #ruby
Rydekull has joined #ruby
vitorbaptista has joined #ruby
Affix is now known as Guest99774
vitorbaptista has quit [Changing host]
vitorbaptista has joined #ruby
binaryhat has joined #ruby
andrewjf has joined #ruby
mnemon has joined #ruby
likemike has joined #ruby
msch has joined #ruby
Scient has joined #ruby
radic has joined #ruby
IceDragon has quit [Quit: Space~~~]
thomasxie has quit [Ping timeout: 252 seconds]
spinx has joined #ruby
AGreyCrane has joined #ruby
meatherl_ has joined #ruby
lolmaus has joined #ruby
oo_ has joined #ruby
meatherly has quit [Read error: Connection reset by peer]
Lightsword has joined #ruby
aspires has quit []
thomasxie has joined #ruby
flowerhack has joined #ruby
omosoj has quit [Ping timeout: 240 seconds]
mrmargolis has quit [Remote host closed the connection]
cescalante is now known as ce_afk
io_syl has joined #ruby
codeurge has joined #ruby
sputnik13 has quit [Quit: My Mac Mini has gone to sleep. ZZZzzz…]
rkazak has quit [Quit: rkazak]
sevenseacat has joined #ruby
sevenseacat has left #ruby [#ruby]
sevenseacat has joined #ruby
<Lightsword>
I'm encoding information in serial numbers but am not sure how to use regex to extract the encoded information, the last 6 digits encode special numbers that I need to capture, the first 3 and last 3 of those 6 are what I need, leading 0's in the sets of 3 need to be stripped, here's an example of what I'm trying to capture https://gist.github.com/jameshilliard/003e23cf34aa6fa1e1ae
Jnco has quit [Quit: Jnco]
MZAWeb_ has joined #ruby
<Lightsword>
I know how to capture them individually but am not sure how to strip the leading zeros
shanlar- has joined #ruby
mrmargolis has joined #ruby
<Dysruption>
you don’t really need regex
<Dysruption>
do you?
<Lightsword>
I figured that would be the easiest way
tkuchiki has joined #ruby
<Lightsword>
or at least the most condensed
<Dysruption>
just get last 6 digits, split it into 3, then remove 0s in the front
hl has quit [Ping timeout: 255 seconds]
shanlar has quit [Read error: Connection reset by peer]
<Dysruption>
possible using regex for last step
<Lightsword>
is there a way to do that in a singe regex experession for each set of 3?
bean has quit [Read error: Connection reset by peer]
senayar_ has quit [Read error: Connection reset by peer]
dnordstrom has quit [Read error: Connection reset by peer]
aiguu has quit [Read error: Connection reset by peer]
gjvc has quit [Read error: Connection reset by peer]
Royalb15 has quit [Read error: Connection reset by peer]
SlvrDragn has quit [Ping timeout: 276 seconds]
vcoinminer___ has quit [Ping timeout: 276 seconds]
Derander has quit [Ping timeout: 276 seconds]
machete has quit [Ping timeout: 276 seconds]
guyz has quit [Ping timeout: 276 seconds]
alol has quit [Ping timeout: 276 seconds]
redondos has quit [Excess Flood]
matchaw has quit [Quit: No Ping reply in 180 seconds.]
yfeldblum has quit [Ping timeout: 276 seconds]
nwkr has quit [Ping timeout: 276 seconds]
hermanmunster has quit [Ping timeout: 276 seconds]
Solnse has quit [Ping timeout: 276 seconds]
drager has quit [Ping timeout: 276 seconds]
sj__ has quit [Ping timeout: 276 seconds]
sputnik1_ has quit [Ping timeout: 276 seconds]
divbell_ has quit [Ping timeout: 276 seconds]
graft has quit [Ping timeout: 276 seconds]
cHarNe2 has quit [Ping timeout: 276 seconds]
maZtah has quit [Ping timeout: 276 seconds]
_m_g_ has joined #ruby
jpinnix____ has quit [Ping timeout: 276 seconds]
ItSAN____ has quit [Ping timeout: 276 seconds]
ixx has quit [Ping timeout: 276 seconds]
xargoon has quit [Ping timeout: 276 seconds]
phreax_ has quit [Ping timeout: 276 seconds]
elektronaut has quit [Ping timeout: 276 seconds]
akosednar has quit [Ping timeout: 276 seconds]
LiquidInsect has quit [Ping timeout: 276 seconds]
hakunin has quit [Ping timeout: 276 seconds]
snath has quit [Ping timeout: 276 seconds]
vt102 has quit [Ping timeout: 276 seconds]
jmbrown412 has quit [Ping timeout: 276 seconds]
njs126 has quit [Ping timeout: 276 seconds]
fella6s has quit [Ping timeout: 276 seconds]
cwc has quit [Ping timeout: 276 seconds]
railsbro_ has quit [Ping timeout: 276 seconds]
zarul has quit [Ping timeout: 276 seconds]
go|dfish has quit [Ping timeout: 276 seconds]
devyn has quit [Ping timeout: 276 seconds]
sarlalian has quit [Ping timeout: 276 seconds]
Xuerian has quit [Ping timeout: 276 seconds]
avelldiroll has quit [Ping timeout: 276 seconds]
cHarNe2 has joined #ruby
joast has quit [Ping timeout: 276 seconds]
larsam has quit [Ping timeout: 276 seconds]
Jamo_ has joined #ruby
kmwhite has joined #ruby
mpajor_op5 has joined #ruby
alol_ is now known as alol
Xuerian has joined #ruby
crazysim has quit [Excess Flood]
snath has joined #ruby
qubit has joined #ruby
devyn has joined #ruby
jpinnix_____ is now known as jpinnix____
rkazak has joined #ruby
ptierno has joined #ruby
sonofgam1keeper has quit [Ping timeout: 252 seconds]
zorak8 has joined #ruby
Derander has joined #ruby
Bish_ has joined #ruby
fumduq has joined #ruby
maZtah_ is now known as maZtah
vcoinminer____ is now known as vcoinminer___
devdazed has joined #ruby
michaeldeol has joined #ruby
Royalb15 has joined #ruby
Royalb15 has quit [Remote host closed the connection]
akosednar has joined #ruby
elektronaut has joined #ruby
quantsini has joined #ruby
xargoon has joined #ruby
jumblemuddle has joined #ruby
oo_ has quit [Remote host closed the connection]
machete has joined #ruby
ClarusCogitatio has joined #ruby
LadyRainicorn has joined #ruby
aep has joined #ruby
cwc has joined #ruby
cjk101010 has joined #ruby
digifiv5e has joined #ruby
digifiv5e is now known as Guest4165
segv has joined #ruby
nomadic has joined #ruby
verto has joined #ruby
momomomomo has joined #ruby
jrdnull has joined #ruby
flowerhack has quit [Remote host closed the connection]
flowerhack has joined #ruby
lethjakman has joined #ruby
Riking has joined #ruby
raspberryfan has joined #ruby
flowerha_ has joined #ruby
flowerhack has quit [Remote host closed the connection]
oo_ has joined #ruby
tyll_ has joined #ruby
zylophone has joined #ruby
crazysim has joined #ruby
<zylophone>
why might passenger prematurely close the connection?
hamakn has joined #ruby
<zylophone>
trying to get gitlab to work on nginx with it, but hitting the signin page is fine, but as soon as i fill in the credentials, i get a 502, with the nginx error that upstream has prematurely closed the connectino
flughafen has joined #ruby
hamakn has quit [Read error: Connection reset by peer]
cba has joined #ruby
mr_snowf1ake has joined #ruby
WormDrink has joined #ruby
hamakn has joined #ruby
tyll has quit [Ping timeout: 255 seconds]
Avahey_ has joined #ruby
go|dfish has joined #ruby
Dysruption has quit [Quit: Dysruption]
willb1 has joined #ruby
combusean has joined #ruby
njs126 has joined #ruby
vt102 has joined #ruby
meatherl_ has quit [Remote host closed the connection]
elico has joined #ruby
avelldiroll has joined #ruby
LadyRainicorn has quit [Ping timeout: 252 seconds]
Cache_Money has joined #ruby
sarlalian has joined #ruby
Solnse has joined #ruby
lethjakman has quit [Ping timeout: 245 seconds]
braincra- has joined #ruby
flowerha_ has quit [Remote host closed the connection]
redondos has joined #ruby
<dideler>
i came across the following in a rakefile: system %(cd #{project} && #{$0} test:isolated)
flowerhack has joined #ruby
<dideler>
what does the %() mean? a substitute for a string?
braincrash has quit [Ping timeout: 250 seconds]
havenwood has joined #ruby
phutchins has quit [Ping timeout: 264 seconds]
agrinb has quit [Remote host closed the connection]
<benzrf>
dideler: string literal
<benzrf>
> %/sdfjsdoifjsodifj/
<benzrf>
>> %/sdfjsdoifjsodifj/
sepp2k1 has quit [Read error: Connection reset by peer]
Avahey_ has quit [Quit: Connection closed for inactivity]
aspiers has joined #ruby
mjs2600 has joined #ruby
benzrf|offline has joined #ruby
benzrf|offline is now known as benzrf
mjs2600 has quit [Ping timeout: 245 seconds]
ktun has joined #ruby
sqwirl has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
meatherly has joined #ruby
bluOxigen has joined #ruby
JBreit has joined #ruby
LexicalScope has joined #ruby
LexicalScope has quit [Changing host]
LexicalScope has joined #ruby
JBreit has left #ruby [#ruby]
skysploit has quit []
meatherly has quit [Ping timeout: 240 seconds]
LexicalScope` has quit [Ping timeout: 252 seconds]
crucify_me has joined #ruby
crucify_me has quit [Remote host closed the connection]
blueOxigen has quit [Ping timeout: 276 seconds]
raspberryfan has quit [Remote host closed the connection]
raspberryfan has joined #ruby
mercwithamouth has quit [Ping timeout: 245 seconds]
tagrudev has joined #ruby
michaeldeol has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
sunya7a has joined #ruby
aspiers has quit [Ping timeout: 252 seconds]
rshetty has joined #ruby
JasmeetQA1 has joined #ruby
lw has quit [Quit: s]
mercwithamouth has joined #ruby
raspberry has quit [Ping timeout: 240 seconds]
rshetty has quit [Client Quit]
raspberryfan has quit [Ping timeout: 255 seconds]
JasmeetQA has quit [Ping timeout: 245 seconds]
rshetty has joined #ruby
sinkensabe has quit [Remote host closed the connection]
nanoyak has joined #ruby
xcesariox has joined #ruby
sinkensabe has joined #ruby
sunya7a has quit [Ping timeout: 258 seconds]
michaeldeol has joined #ruby
Olipro has joined #ruby
sinkensabe has quit [Ping timeout: 240 seconds]
ktun has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
benzrf has quit [Ping timeout: 245 seconds]
michaeldeol has quit [Ping timeout: 258 seconds]
benzrf|offline has joined #ruby
benzrf|offline is now known as benzrf
razrunelord has joined #ruby
freerobby has joined #ruby
codabrink has joined #ruby
RohanRNS has quit [Quit: Connection closed for inactivity]
Matix has quit [Quit: Leaving]
razrunelord has quit [Ping timeout: 240 seconds]
timonv has joined #ruby
subraminion has joined #ruby
freerobby has quit [Ping timeout: 240 seconds]
crucify_me has joined #ruby
blueOxigen has joined #ruby
dumdedum has joined #ruby
codabrink has quit [Ping timeout: 264 seconds]
bluOxigen has quit [Ping timeout: 252 seconds]
zkay11 has left #ruby [#ruby]
mengu has joined #ruby
<crucify_me>
http://pastie.org/9167582 hi with a hash like this when you have the block arguments |count_hash, word| is the key argument always second?
nanoyak has quit [Quit: Computer has gone to sleep.]
meatherly has joined #ruby
<crucify_me>
^ this returns {"ruby" => 3} etc.
timonv has quit [Remote host closed the connection]
Burgestrand has joined #ruby
except has quit [Ping timeout: 252 seconds]
crucify_me is now known as n_blownapart
meatherly has quit [Read error: Connection reset by peer]
meatherly has joined #ruby
mrmargolis has joined #ruby
raspberry has joined #ruby
raspberryfan has joined #ruby
hermanmu_ has quit [Remote host closed the connection]
Macaveli has joined #ruby
yacks has joined #ruby
KAO has joined #ruby
Mon_Ouie has quit [Ping timeout: 252 seconds]
meatherly has quit [Ping timeout: 258 seconds]
sinkensabe has joined #ruby
predator217 has quit [Ping timeout: 258 seconds]
hermanmu_ has joined #ruby
predator117 has joined #ruby
<popl>
n_blownapart: your answer is in the documentation for Enumerable#inject
jackneill has joined #ruby
mrmargolis has quit [Ping timeout: 264 seconds]
Cork has quit [Ping timeout: 260 seconds]
except has joined #ruby
KAO has quit [Ping timeout: 240 seconds]
bal has joined #ruby
supershabam has left #ruby [#ruby]
bluOxigen has joined #ruby
frosgy has quit [Ping timeout: 258 seconds]
kiri has joined #ruby
Cork has joined #ruby
timonv has joined #ruby
m_3 has quit [Ping timeout: 252 seconds]
froy has quit [Ping timeout: 252 seconds]
froy has joined #ruby
Darryl has joined #ruby
nevans has joined #ruby
m_3 has joined #ruby
except has quit [Ping timeout: 252 seconds]
mercwithamouth has quit [Ping timeout: 240 seconds]
blueOxigen has quit [Ping timeout: 258 seconds]
<popl>
n_blownapart: are you trying to create a hash from the paired array elements?
benzrf has quit [Ping timeout: 258 seconds]
<n_blownapart>
I guess the enumerable is coming in as a string. I was curious about line 3 popl
<popl>
did you read the documentation?
blueOxigen has joined #ruby
Hobogrammer_ has quit [Read error: Connection reset by peer]
benzrf|offline has joined #ruby
benzrf|offline is now known as benzrf
<n_blownapart>
where [word] is acting as the index, it never occurred to me that a key in a key/value pair was notated like an index, if that is indeed correct. popl sorry I got sidetracked.
Hobogrammer_ has joined #ruby
bluOxigen has quit [Read error: No route to host]
bluOxigen has joined #ruby
noop has joined #ruby
railsbro__ has quit [Quit: Leaving]
<n_blownapart>
popl: but thanks for your time.. I gotta go
n_blownapart has quit [Remote host closed the connection]
blueOxigen has quit [Ping timeout: 240 seconds]
anarang has joined #ruby
bluOxigen has quit [Read error: No route to host]
x1337807x has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
bluOxigen has joined #ruby
frosgy has joined #ruby
roshanavand has joined #ruby
alem0lars has joined #ruby
cina has joined #ruby
jimbauds has quit [Quit: Leaving]
KAO has joined #ruby
meatherly has joined #ruby
Alina-malina has quit [Ping timeout: 240 seconds]
alem0lars has quit [Client Quit]
alexju has quit [Remote host closed the connection]
lolmaus has quit [Read error: Connection reset by peer]
blueOxigen has joined #ruby
alem0lars has joined #ruby
kiri has quit [Ping timeout: 245 seconds]
KAO has quit [Ping timeout: 265 seconds]
meatherly has quit [Ping timeout: 252 seconds]
bluOxigen has quit [Ping timeout: 252 seconds]
claymore has joined #ruby
apeiros has quit [Remote host closed the connection]
apeiros has joined #ruby
bigkevmcd has joined #ruby
Xeago has joined #ruby
sunya7a has joined #ruby
yacks has quit [Remote host closed the connection]
jprovazn has joined #ruby
sensen has quit [Ping timeout: 255 seconds]
kiri has joined #ruby
cina has quit [Quit: leaving]
ktun has joined #ruby
apeiros has quit [Ping timeout: 265 seconds]
flowerhack has quit [Remote host closed the connection]
sinkensa_ has joined #ruby
sunya7a has quit [Ping timeout: 258 seconds]
sinkensabe has quit [Read error: Connection reset by peer]
<apeiros>
skinkitten: begin; …code which raises…; rescue => exception; puts "#{exception.class}: #{exception.message}\n #{exception.backtrace.first}"; end
mengu has joined #ruby
mengu has quit [Changing host]
mengu has joined #ruby
<skinkitten>
tried that, could have done it wrong, giving it another go
memorozovm has quit [Remote host closed the connection]
<skinkitten>
its a helper method that is throwing the error, could I be missing something?
tsunamie has quit [Max SendQ exceeded]
<apeiros>
exceptions are raised, not thrown. throw is a separate thing in ruby.
<apeiros>
yes, you could be missing something. no idea what, from what you've showed.
tsunamie has joined #ruby
chrisseaton has joined #ruby
JacobHayes has quit []
nari has joined #ruby
alex88 has joined #ruby
oo_ has quit [Remote host closed the connection]
<skinkitten>
thanks apeiros its works
phoo1234567 has joined #ruby
meatherly has joined #ruby
narendraj9 has joined #ruby
adammcarth has joined #ruby
VTLob has joined #ruby
<adammcarth>
is there a common way of removing if statements from code?
<enricostn>
hi there, can anyone please share some resource that illustrates how we can use "first/rest" aka "head/tail" recursively for an Enumerable?
jujui has joined #ruby
<enricostn>
For instance how to split (partition) an Array like [1, 2, 3] in [1, 2] and [3] based on a predicate like element == 2
XThief has joined #ruby
nari has quit [Ping timeout: 240 seconds]
jxf has quit [Ping timeout: 240 seconds]
diegoviola has quit [Remote host closed the connection]
meatherly has quit [Ping timeout: 240 seconds]
oo_ has joined #ruby
brtdv has quit []
tatsuya__ has joined #ruby
tatsuya_o has quit [Ping timeout: 265 seconds]
kyb3r_ has quit [Read error: Connection reset by peer]
<Hanmac>
>>['a', 'b', 'c', 'd', 'e'].slice_before.with_index{|a, i| i == 2}.to_a
<eval-in__>
Hanmac => wrong number of arguments (0 for 1) (ArgumentError) ... (https://eval.in/149965)
<workmad3>
Hanmac: no, because you can't call slice_before without a param
sinkensa_ has joined #ruby
moritzs has joined #ruby
tjsousa_ has joined #ruby
sinkensabe has quit [Read error: Connection reset by peer]
tjsousa_ has quit [Remote host closed the connection]
tjsousa_ has joined #ruby
tjsousa has quit [Read error: Connection reset by peer]
<workmad3>
Hanmac: you'd need to do '.each.with_index.slice_before{|a, i| i == 2}'
codabrink has joined #ruby
benzrf has quit [Ping timeout: 255 seconds]
Blaze_Boy has joined #ruby
Sonofgamekeeper has joined #ruby
tjsousa__ has joined #ruby
tjsousa__ has quit [Remote host closed the connection]
freerobby has joined #ruby
tjsousa__ has joined #ruby
tjsousa_ has quit [Read error: Connection reset by peer]
mr_snowf1ake has joined #ruby
Marfu has joined #ruby
<AntelopeSalad>
hey workmad3, you're the only person i know using puma, have you upgraded to 2.8.x?
<Marfu>
hello
benzrf|offline has joined #ruby
benzrf|offline is now known as benzrf
<Marfu>
I'm looking for easy media player lib
<workmad3>
AntelopeSalad: I'm using 2.8.2 on my current project
<AntelopeSalad>
workmad3: me too, have you tried sending a USR2 to it lately?
<workmad3>
AntelopeSalad: no, I'm using usr1 for phased restarts nowadays
Shidash has joined #ruby
blueOxigen has quit [Ping timeout: 258 seconds]
<AntelopeSalad>
workmad3: i'm noticing with 2 workers in cluster mode the workers always die when i try
<AntelopeSalad>
then it just gets stuck in some unresponsive state with a master+no workers
<AntelopeSalad>
are you sending this exact command? kill -s SIGUSR1 <pid of master>?
tjsousa___ has joined #ruby
<workmad3>
AntelopeSalad: no, I'm using runit
brtdv has joined #ruby
tjsousa___ has quit [Remote host closed the connection]
adamholt_ is now known as adamholt
tjsousa__ has quit [Read error: Connection reset by peer]
freerobby has quit [Ping timeout: 252 seconds]
tjsousa___ has joined #ruby
<AntelopeSalad>
what is runit sending to it?
razrunelord has joined #ruby
CorpusCallosum has quit [Quit: Computer has gone to sleep.]
memorozovm has joined #ruby
<workmad3>
AntelopeSalad: tbh, I haven't checked that... but sending a usr2 manually to my 2.8.2 service did a graceful shutdown and restart fine
<AntelopeSalad>
did you try accessing the server or looking at the output of ps?
<enricostn>
workmad3, what if I need to include the "pivot" element too? e.g. [1, 2, 3].slice_before{ |a| a == 2 }.to_a => [[1, 2], [3]]
<workmad3>
AntelopeSalad: I looked at the log file
hermanmunster has joined #ruby
<workmad3>
AntelopeSalad: and then accessed the server
<AntelopeSalad>
what ruby version or are you using and how many workers are you running?
<workmad3>
enricostn: as I said, slice_before was the closest I found, but it put the 'pivot' on the wrong side (it is slice *before* after all, not slice after, which annoyingly doesn't seem to exist)
<enricostn>
yep
mr_snowf1ake has quit [Ping timeout: 250 seconds]
<workmad3>
AntelopeSalad: I'm using ruby 2.1.1 with puma 2.8.2 and 2 workers with up to 32 threads each
<workmad3>
AntelopeSalad: on ubuntu 14.04
<enricostn>
would be interesting to see how we could achieve this using first/rest recursively
razrunelord has quit [Ping timeout: 258 seconds]
<AntelopeSalad>
workmad3: 0/32?
<workmad3>
AntelopeSalad: yeah
fabrice31 has quit [Remote host closed the connection]
jackneill has quit [Remote host closed the connection]
<AntelopeSalad>
hmm our env is pretty close to the same, i wonder what's going on
Martxel has quit [Read error: Connection reset by peer]
<AntelopeSalad>
mine is the same
Martxel has joined #ruby
dANOKELOFF has quit [Remote host closed the connection]
mr_snowf1ake has joined #ruby
yfeldblu_ has quit [Remote host closed the connection]
<AntelopeSalad>
the only difference is i have my restart command set to call a systemv action
canton7-mac has joined #ruby
<workmad3>
AntelopeSalad: hmm... isn't that kinda important though as a USR2 will restart using that command?
mjs2600 has joined #ruby
badhatter^ has quit [Ping timeout: 252 seconds]
<AntelopeSalad>
maybe, i'm provisioning a server now to try it with a modified restart command
<AntelopeSalad>
but you're saying i should be using USR1?
nfk has quit [Ping timeout: 252 seconds]
<AntelopeSalad>
since USR2 is a typical full blown restart?
fabrice31 has joined #ruby
<workmad3>
AntelopeSalad: well, if you want a phased, 0-downtime restart then yeah
nfk has joined #ruby
<workmad3>
AntelopeSalad: usr2 is a graceful, hot restart
<workmad3>
AntelopeSalad: usr1 is a phased restart which always leaves at least 1 worker available for handling requests
Marfu has left #ruby ["Wychodzi"]
<AntelopeSalad>
workmad3: what's the difference between usr2 and just sending QUIT then starting?
<workmad3>
AntelopeSalad: thinking about it, either could be using the restart command... I've not investigated tbh
sooik has joined #ruby
fantasticsid has quit [Ping timeout: 252 seconds]
Xeago has joined #ruby
<workmad3>
AntelopeSalad: a hot restart doesn't drop connections, but it can leave them hanging while the new workers boot
<AntelopeSalad>
and a QUIT+start will 502?
<workmad3>
AntelopeSalad: a quit/start (or normal restart) cycle will drop connections and will also end up with a 404 or 500 on any connections coming in (or, if you're hitting puma directly, the browser will say the server isn't there)
oo_ has quit [Remote host closed the connection]
mjs2600 has quit [Ping timeout: 250 seconds]
nicoulaj has joined #ruby
<AntelopeSalad>
hmm, but a usr2 will fully reload the env on the master/processes -- as in, there's no reason to ever quit+start?
spinx is now known as spinx^
<AntelopeSalad>
unless maybe you wanted to upgrade puma itself?
Aaaal has quit [Quit: Aaaal]
<workmad3>
I haven't investigated that fully, tbh
<workmad3>
but it sounds reasonable
oo_ has joined #ruby
<AntelopeSalad>
i was trolling through gitlab's configs and they never USR2'd, they always did a quit/start for their restart
craigp has quit [Remote host closed the connection]
<workmad3>
heh :)
<AntelopeSalad>
they are using unicorn but i figured both servers are similar (even tho their implementation is much different with diff pros/cons)
<AntelopeSalad>
it's still "load a master then have workers do stuff"
<workmad3>
ah, but unicorn doesn't have threaded workers
<workmad3>
it has a master, and then worker processes
Aaaal has joined #ruby
<workmad3>
and you have to handle a 0-downtime restart in a slightly different manner
<AntelopeSalad>
from their script it seemed to be the same as puma, just send a USR1
<workmad3>
yes, which gets the current unicorn master to spawn a new master process
<workmad3>
but, last time I checked, it *doesn't* kill the old master, because that master lacks the ability to know when the new master is available for requests
craigp has joined #ruby
<AntelopeSalad>
how does it know to die off?
Sonofgamekeeper has quit [Ping timeout: 264 seconds]
<workmad3>
it doesn't
<AntelopeSalad>
they are not running anything like runit/monit to check
<workmad3>
that's kinda what I said
mrmargolis has joined #ruby
<AntelopeSalad>
wouldn't it know based on the workers of the new master?
<workmad3>
the old master can't do anything with the new master's workers
<AntelopeSalad>
like "if new master spawned workers and workers are ready then old master can retire?"
<workmad3>
not if the new workers aren't preloading the app
<AntelopeSalad>
btw i noticed in your config that you're not using redis, have you experimenting with putting redis disconnects in the worker boot block?
<AntelopeSalad>
*experimented
<workmad3>
no, because I don't use redis
Centime has joined #ruby
ziyadb_ has quit [Quit: Connection closed for inactivity]
<Centime>
Hi. After installing compass on archlinux, I have this error : Unfortunately, a fatal error has occurred. Please see the Bundler troubleshooting documentation at http://bit.ly/bundler-issues. Thanks!
<Centime>
I'm new to ruby enviromnent, and I really don't know what it means
<canton7-mac>
Centime, looks like you don't have write permissions to your currently directory?
mr_snowf1ake has quit [Ping timeout: 252 seconds]
<Centime>
Sure I have
<AntelopeSalad>
workmad3: ok thanks, going to test it now -- gl puma
<canton7-mac>
can you create the folder it fails to create?
tatsuya_o has joined #ruby
mrmargolis has quit [Ping timeout: 252 seconds]
mr_snowf1ake has joined #ruby
_m_g_ has quit [Ping timeout: 276 seconds]
<Centime>
Yes, and I even set the rights to 777 then
<Centime>
We're talking about /usr/lib/ruby/2.1.0 right ?
Martxel has quit [Read error: Connection reset by peer]
<canton7>
no. the current working dir
gheegh has quit [Ping timeout: 264 seconds]
<workmad3>
which may change
tatsuya__ has quit [Ping timeout: 252 seconds]
Martxel has joined #ruby
<Centime>
How can I know the current directory at the time of the call ?
shiin has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Marfu has joined #ruby
codabrink has quit [Ping timeout: 245 seconds]
<Marfu>
is any working example with audio player ?
chrisramon has joined #ruby
<AntelopeSalad>
workmad3: well, USR2 crashes puma with a bad file descriptor error
<AntelopeSalad>
but USR1 does kick off a phased restart according to the output of puma "stopping PID for phased upgrade... TERM sent to PID"
_m_g_ has joined #ruby
toretore has joined #ruby
Aaaal has quit [Quit: Aaaal]
robbyoconnor has quit [Ping timeout: 240 seconds]
<workmad3>
AntelopeSalad: does the server then restart and come back up?
postmodern has quit [Quit: Leaving]
<AntelopeSalad>
on the USR1? yes it's all good
<AntelopeSalad>
on the USR2? nope, the puma process completely crashes out
<AntelopeSalad>
i ran it in the foreground to check
<AntelopeSalad>
puma-2.8.2/lib/puma/binder.rb:290:in `for_fd': Bad file descriptor - fstat(2) (Errno::EBADF)
aiguu_ has quit [Ping timeout: 255 seconds]
sooik has quit [Ping timeout: 252 seconds]
troulouliou_dev has joined #ruby
Martxel has quit [Quit: Leaving]
_Andres has quit [Read error: Connection reset by peer]
sooik has joined #ruby
<skinkitten>
can I return different output depending if the method was called directly or another method has called it?
sputnik1_ has joined #ruby
dangerousdave has joined #ruby
<apeiros>
skinkitten: you could. but it's a rather bad idea.
AGreyCrane has quit [Quit: This computer has gone to sleep]
mr_snowf1ake has quit [Ping timeout: 252 seconds]
Marfu has quit [Quit: Wychodzi]
<skinkitten>
hm
<apeiros>
Kernel#caller_locations, #caller and __callee__ contain information about the calling method
<apeiros>
use parametrization instead
* workmad3
wonders what the difference is between 'called directly' and 'another method called it' is
<toretore>
hah
<apeiros>
workmad3: I bet it's in a script context
<apeiros>
i.e. toplevel method call
obs has quit [Remote host closed the connection]
akonny has joined #ruby
meatherly has joined #ruby
AlexRussia has quit [Read error: Connection reset by peer]
<skinkitten>
parametrization? like method (a, option=false)
timonv has quit [Read error: Connection reset by peer]
yfeldblum has joined #ruby
claymore has joined #ruby
<apeiros>
skinkitten: yes
benzrf has quit [Ping timeout: 240 seconds]
timonv has joined #ruby
tvw has joined #ruby
<AntelopeSalad>
workmad3: kind of curious, in that restart_command is it smart enough to use the ENV that was passed to it when you started the actual process initially?
<workmad3>
AntelopeSalad: pass? :)
<skinkitten>
thanks, the case is Class.new('w').method1 or Class.new('w').method2 which calls method1 using its output in a different way.
<AntelopeSalad>
yeah, like if you had chef set the environment to start the puma service
<AntelopeSalad>
you wouldn't need to source the env again before bundle exec'ing puma in its restart_command?
meatherly has quit [Ping timeout: 265 seconds]
benzrf|offline has joined #ruby
benzrf|offline is now known as benzrf
yfeldblum has quit [Ping timeout: 255 seconds]
tatsuya_o has quit []
flowerhack has quit [Ping timeout: 265 seconds]
<apeiros>
skinkitten: that's not really an explanation of your use-case ;-)
dANOKELOFF has joined #ruby
SlvrDragn has joined #ruby
robbyoconnor has joined #ruby
andrewlio has quit [Ping timeout: 240 seconds]
_m_g_ has quit [Ping timeout: 276 seconds]
chrisseaton has quit []
sunya7a has joined #ruby
fukuyamaken has quit [Remote host closed the connection]
<skinkitten>
I'm taking method2 out of the class. Class.new('w').method1 returns default output. method2 creates a new instance of that class, calling method 1 but receiving different output.
<skinkitten>
sorry is this clearer?
bluenemo has joined #ruby
bluenemo has quit [Changing host]
bluenemo has joined #ruby
_m_g_ has joined #ruby
Martxel has joined #ruby
<skinkitten>
calling method 1 with the default parameter changed so it releases the output wanted.
chrisseaton has joined #ruby
SlvrDragn has quit [Ping timeout: 276 seconds]
_m_g_ is now known as SlvrDragn
Martxel has quit [Client Quit]
sunya7a has quit [Ping timeout: 252 seconds]
Martxel has joined #ruby
subraminion has quit [Quit: Computer has gone to sleep.]
<toretore>
skinkitten: sounds like a stupid thing to do
subraminion has joined #ruby
shvelo has joined #ruby
karupa is now known as zz_karupa
kirun has joined #ruby
sk87 has quit [Quit: My Mac Mini has gone to sleep. ZZZzzz…]
XThief has quit [Quit: XThief]
arturaz has quit [Quit: Leaving]
benzrf has quit [Ping timeout: 264 seconds]
govind has joined #ruby
grzywacz has quit [Ping timeout: 240 seconds]
govind has quit [Remote host closed the connection]
benzrf|offline has joined #ruby
<skinkitten>
toretore, go enlighten me.
benzrf|offline is now known as benzrf
robbyoconnor has quit [Excess Flood]
<toretore>
can you show some real code?
ker2x has joined #ruby
robbyoconnor has joined #ruby
<shevy>
I don't even understand what you are trying to do
<ker2x>
friendly greetings ! anyone playing with ragel ? i have a problem with a token followed by a space, it include the space and i can't find any reason why the space is included (space as a single token is recognized correctly)
sambao21 has joined #ruby
andrewlio has joined #ruby
sooik has quit [Ping timeout: 265 seconds]
<ker2x>
same for every defined token excepted the last one before EOF which is correct
<shevy>
why not have a class method, so you can avoid .new ?
flowerhack has quit [Remote host closed the connection]
<shevy>
besides
<shevy>
why is options set to true
<shevy>
if you dont make use of that var lateron?
mr_snowf1ake has quit [Ping timeout: 250 seconds]
ldnunes has joined #ruby
<skinkitten>
shevy, show me in code please
Aaaal has left #ruby [#ruby]
<shevy>
huh
<shevy>
you mean the class method?
<skinkitten>
yes
Cymew has joined #ruby
<shevy>
general syntax is
mr_snowf1ake has joined #ruby
<shevy>
class Foo; def self.name_of_your_method_here(arguments_here); # now comes the code part, i.e. you may want to create a new instance of itself here; end; end
mjs2600_ has joined #ruby
mark_locklear has joined #ruby
sooik has joined #ruby
tjr9898 has joined #ruby
<toretore>
skinkitten: ok, so what is the problem you're trying to fix with this code?
<shevy>
lol toretore
<shevy>
we are back to start again :)
<skinkitten>
toretore, you guys are the experts
aviator7 has quit [Quit: Leaving]
Ardenzi has joined #ruby
<shevy>
ok but who wrote the code!
<skinkitten>
:)
paulfm has joined #ruby
<toretore>
skinkitten: you were saying something earlier without showing the code. now that we have the code you have to explain what it is you're trying to do
Megtastique has joined #ruby
<skinkitten>
I have the output in the pasteall, thats its.
spyderman4g63 has quit [Remote host closed the connection]
<Cymew>
I'm trying to grab som data from a XML file. Can someone who knows Nokogiri tell me how I from the kind of data found in http://pastebin.com/47REuQDg can grab the IP number in that blob? I guess the css or xpath might help me, but I think I need some pointers on how to get at things beneath the Attribute level.
spyderman4g63 has joined #ruby
<skinkitten>
now its just code education. with shevy toretore apeiros :)
<toretore>
Cymew: yes, xpath would do it
<shevy>
but from the three of us, only apeiros understood you
<skinkitten>
shevy, I'm digesting that general syntax you mentioned. can you make it clearer?
<Cymew>
toretore: ok, I'm on the right track at least
<toretore>
"datumType"
<shevy>
skinkitten, we have eval-in__ here
<shevy>
>> class Foo; def self.bla; puts 'HI from bla'; end; end; Foo.bla
<shevy>
so replace Foo with the name of your class
<shevy>
also you may have to pass one or two arguments
<toretore>
skinkitten: ok so you just want advice on the code in general?
<shevy>
but you can assign default arguments too
<skinkitten>
toretore, of course.
<skinkitten>
toretore, wait
<skinkitten>
toretore, advice that is specific to the code yes. improving the code yes. :)
<toretore>
options = true
<skinkitten>
it sucks doesn't help :)
<toretore>
doesn't make any sense
<skinkitten>
ok
chipotle has quit [Quit: cya]
<toretore>
git_score(true)
<skinkitten>
why?
_justin has quit [Quit: _justin]
<toretore>
you are assigning a local variable
<skinkitten>
yes
<toretore>
if you see `options = true` in the docs it just means that `options` defaults to `true`
<skinkitten>
right
workmad3 is now known as wm3|away
matled has quit [Remote host closed the connection]
<skinkitten>
shevy, so make top_ten into self.ten_latest?
<shevy>
skinkitten ohhh you copy pasted that from an example? :D
<shevy>
it is your code
tkuchiki has quit [Ping timeout: 276 seconds]
<shevy>
I can not tell you how to design it specifically because it was you who designed it; I can only tell you how it is done, the syntax etc...
<skinkitten>
what example?
<shevy>
you need to feel comfortable with your own APIs
<shevy>
top_ten
<shevy>
dunno
mjs2600_ has quit [Remote host closed the connection]
<shevy>
why did you assign to a variable called options?
zorak8 has joined #ruby
frobrob has quit [Ping timeout: 250 seconds]
<skinkitten>
so that ScoreCalculator.new('shevy').git_score works
<skinkitten>
two ways to call git_score
<skinkitten>
directly like that
<skinkitten>
or getting the hot_ten
_justin has joined #ruby
<toretore>
git_score from the paste doesn't take an argument
<skinkitten>
which calls git_score for ten git ids
troulouliou_dev has joined #ruby
rails4444 has joined #ruby
<skinkitten>
toretore, its optional
nvrch has quit [Quit: nvrch]
<alex88>
in warden, after trying to authenticate an user, is there a way to clear the temporary data and try to authenticate again?
<alex88>
since I've tried to authenticate an user, if it's not existing, create one from another user table, the problem is that when I make it try to authenticate again it doesn't searches for the user in the database again
<skinkitten>
shevy, self.blah gets its arguments from where?
agrinb has joined #ruby
XThief has joined #ruby
vpretzel has joined #ruby
thesheff17 has quit [Ping timeout: 240 seconds]
Rojo has joined #ruby
rshetty has joined #ruby
mercwithamouth has joined #ruby
saarinen has quit [Quit: saarinen]
robbyoconnor has quit [Ping timeout: 258 seconds]
garndt has joined #ruby
thesheff17 has joined #ruby
<shevy>
skinkitten just like any other argument to a method
<shevy>
def foo(i = 'bla')
<shevy>
def self.foo(i = 'bla')
fgo has quit []
<shevy>
foo()
<shevy>
foo('yo')
benzrf is now known as benzrf|offline
<shevy>
Foo.foo('yo')
Asher has quit [Quit: Leaving.]
spyderma_ has joined #ruby
spyderma_ has quit [Remote host closed the connection]
spyderman4g63 has quit [Read error: No route to host]
<shevy>
skinkitten btw for future pasties, it is easier to put the whole code into one file for pastie
<Cymew>
Nokogirir question. "<Attribute id="38286" definitionID="55" name="Monitored Address" datumType="String">192.168.1.50</Attribute>" is a node, and I can access it as a hash. So, how can I access the IP#? node['datumType'] gives me the "String", but how do I move beyond that?
grzywacz has joined #ruby
<Cymew>
I'm missing something about how it works as a hash...
<Hanmac>
apeiros: Enumerable#reverse_each generates an Array first
<workmad3>
Cymew: node.text
<workmad3>
Cymew: I thinxk
<workmad3>
*think
<DouweM>
Hanmac: that's a bit disappointing
kevind has joined #ruby
<apeiros>
Hanmac: ah, was too busy to check the source. so it doesn't use self.pred or similar?
<apeiros>
Hanmac: i.e. it just does .to_a.reverse_each?
<DouweM>
apeiros: nope, straight #to_a and loop from length to 0
<apeiros>
lol
<Hanmac>
apeiros: nope :( pred is not used for Enumerable ... only Array.reverse_each is faster
<kraljev6>
lol indeed
<apeiros>
should have just dropped that
<DouweM>
yeah that's a pointless addition
saarinen has quit [Quit: saarinen]
mary5030_ has quit [Remote host closed the connection]
centrx has joined #ruby
_justin has quit [Ping timeout: 245 seconds]
<kraljev6>
we should make ruby right in 3.0 and for once not care for backwards compatibility
<workmad3>
kraljev6: woo, lets make ruby 3.0 the same as python 3.0! practically unused...
eka has quit [Quit: My computer has gone to sleep. ZZZzzz…]
<kraljev6>
1. remove duplicate metods, like #map, #collect, #flat_map, #collect_concat
aiguu_ has joined #ruby
banister has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<kraljev6>
2. make al enumerables lazy
<Hanmac>
kraljev6: infomation before you say it: find_all and select are not duplicate
sunya7a has joined #ruby
dmead has quit [Remote host closed the connection]
_justin has joined #ruby
aganov has quit [Remote host closed the connection]
sooik has quit [Ping timeout: 240 seconds]
gr33n7007h has joined #ruby
<apeiros>
kraljev6: let bang methods return true/false instead of self/nil
Megtastique has quit []
<apeiros>
the latter promotes errors and isn't more performant
sinkensa_ has quit [Remote host closed the connection]
<apeiros>
alternatively let them return self all the time, but I'd rather have this:
<kraljev6>
yes, bang methods definitely shouldn't return self
sambao21 has quit [Quit: Computer has gone to sleep.]
<gr33n7007h>
Whats the difference between `&&` `and` `||` `or` if any?
<kraljev6>
from asthetical standpoint
sinkensabe has joined #ruby
<apeiros>
introduce syntax to have the return value of a method be self
<apeiros>
(smalltalk has that, I think)
<apeiros>
gr33n7007h: precedence
<Cymew>
workmad3: That worked. Thanks. Now I only wonder why, but maybe I can find that in the docs.
anaeem1 has joined #ruby
<benzrf>
gr33n7007h: prcedence
<gr33n7007h>
apeiros, benzrf Thanks :)
<kraljev6>
4. definition of a method should return Method instead of Symbol
<workmad3>
Cymew: it's because [] is for accessing attributes on a node, but the text isn't an attribute it's a special kind of child node (assuming I'm remembering my XML correctly :) )
<benzrf>
foo bar && baz == foo(bar && baz)
<benzrf>
foo bar and baz == foo(bar) and baz
<gr33n7007h>
benzrf, Ah! got ya :) cheers
rizzatti has joined #ruby
aiguu_ has quit [Ping timeout: 252 seconds]
noop has quit [Ping timeout: 240 seconds]
<Cymew>
workmad3: I'm not up to par regarding xml. It makes my head spin. I'm absorbing wisdom. ;)
fukuyamaken has quit [Read error: Connection reset by peer]
<apeiros>
kraljev6: na, you can trivially get the method from the symbol
<kraljev6>
apeiros: This #select vs #find_all difference goes also against POLA
<apeiros>
kraljev6: and creating a throw away method object for rare use cases - pointless
fukuyamaken has joined #ruby
<workmad3>
Cymew: it's been a while since I've done much with XML... JSON ftw! :)
<Cymew>
you don't say...
<apeiros>
1. agreed. aliases considered harmful (except semantic aliases - e.g. when == and .equal? are the same for a given class)
gr33n7007h has quit [Client Quit]
<apeiros>
2. not sure. but understandable motivation
<apeiros>
for 2., I prefer the .lazy approach I think. however I see some inconsistencies in how a couple of methods work
<kraljev6>
apeiros, I'd like ruby to be more functional
<apeiros>
I think I missed 3.
<kraljev6>
to have things like compositum of enumerator
axl_ has joined #ruby
LadyRainicorn has joined #ruby
<apeiros>
kraljev6: you can build that
<kraljev6>
3. wasn't present :)
VTLob has quit [Remote host closed the connection]
<workmad3>
apeiros: so, with 1. are we going to go with pleasing old smalltalkers, functional peeps, or piss the hell out of both and keep '.map' over '.collect' and '.inject' over '.reduce'? :)
sinkensabe has quit [Ping timeout: 250 seconds]
<apeiros>
workmad3: tbh, I don't really care. I have a set of preferred methods. but I'd happily switch for the benefit of having only a single name.
<workmad3>
:)
<apeiros>
workmad3: trying to appease to everybody all too often makes it worse for everybody
<kraljev6>
apeiros, does .permutation.each_slice.map greedily evaulate perumtations?
havenwood has joined #ruby
<kraljev6>
this is what i mean by compositum
<apeiros>
kraljev6: you mean whether it is lazy or not?
<kraljev6>
i mean do I use 6 gigs of ram?
<kraljev6>
or just enough for one slice
<apeiros>
that depends on your map
<apeiros>
but up to each_slice, you get an Enumerator
<apeiros>
i.e., lazy
<kraljev6>
that's great
<apeiros>
.map will return an array. you can make it return an Enumerator too by using .lazy
<kraljev6>
i'd like that way for more methods
<kraljev6>
for example, #drop
<kraljev6>
should also work lazily
Macaveli has joined #ruby
<apeiros>
yes. drop right now is IMO pointless.
<workmad3>
apeiros: hmm... .map gives me an enumerator back, not an array...
<workmad3>
>> [1,2,3,4].map
<apeiros>
workmad3: you didn't pass a block
<apeiros>
:-p
ffranz has joined #ruby
<workmad3>
apeiros: I didn't see a block in the sample chain either ;)
<apeiros>
workmad3: he didn't pass an arg to each_slice either
<apeiros>
workmad3: so you could as well say "that expression will raise"
<workmad3>
apeiros: :D
<apeiros>
but yes
baweaver has joined #ruby
mary5030 has joined #ruby
<apeiros>
.map.with_index is an actual application of a lazy/blockless map
mary5030 has quit [Remote host closed the connection]
<kraljev6>
apeiros, I like .map.with_index
mary5030 has joined #ruby
<kraljev6>
does .permutation.with_index also work?
<kraljev6>
good
zz_jrhorn424 is now known as jrhorn424
<apeiros>
define "work". up to that point it's lazy
<workmad3>
I think .with_index is just on enumerator, so it should do
<apeiros>
there are a couple of methods on Enumerator which won't return an Enumerator. (that's what I said about 2. and consistencies)
omosoj has joined #ruby
<kraljev6>
apeiros, do you like #zip in Enumerator
<kraljev6>
does it belong there?
<kraljev6>
*Enumerable
codabrink has joined #ruby
rails4444 has quit [Ping timeout: 240 seconds]
<workmad3>
zip seems like it belongs on Enumerator to me... used for composing together multiple other enumerators
lw has joined #ruby
aspiers has joined #ruby
<cout>
I always thought zip belonged in Compressable
chrisseaton has quit []
<havenwood>
Zipperable
<workmad3>
cout: well, yeah... I think the name is somewhat unfortunate :)
<apeiros>
it's fine in Enumerable. problem is as with other methods - sometimes you need .lazy, sometimes you don't.
<apeiros>
-> consistency
<workmad3>
cout: as it's 'zipping' in the sense of a zipper, not zipping as in compressing :)
tylerkern has quit [Ping timeout: 265 seconds]
tjr9898 has quit [Remote host closed the connection]
<havenwood>
my pants inherit from Zipperable
cba has quit [Ping timeout: 252 seconds]
<workmad3>
havenwood: and if you're lazy, I suspect you experience pain?
chrisseaton has joined #ruby
agrinb has joined #ruby
<cout>
workmad3: :)
tjr9898 has joined #ruby
sputnik1_ has quit [Quit: My Mac Mini has gone to sleep. ZZZzzz…]
<havenwood>
workmad3: yeah, i didn't use to have lazy but it was added in recent versions of me and now i may overuse it
sputnik1_ has joined #ruby
zergood_ has joined #ruby
axl_ has quit [Quit: axl_]
VTLob has joined #ruby
fukuyamaken has quit [Read error: Connection reset by peer]
<workmad3>
:)
<Hanmac>
imo zip should return an Enumerator too
fukuyamaken has joined #ruby
codabrink has quit [Ping timeout: 276 seconds]
axl_ has joined #ruby
codabrin_ has joined #ruby
dstynchula has joined #ruby
<Hanmac>
havenwood: recent DoctorWho episode or are you finish with Season4?
axisys has quit [Changing host]
axisys has joined #ruby
razrunelord has joined #ruby
dstynchula has quit [Remote host closed the connection]
rostam has quit [Remote host closed the connection]
chrisseaton has quit [Client Quit]
<havenwood>
now if Hash#most_things would return a Hash..
kiri has quit [Read error: Connection reset by peer]
<havenwood>
Hanmac: s4e15 but i fell asleep so not exactly sure
kiri has joined #ruby
agrinb has quit [Remote host closed the connection]
chrisseaton has joined #ruby
<Hanmac>
havenwood: hm ok i think you are not 100% finish yet ... what was your reaction to "TurnLeft" ? ;P
AlexRussia has quit [Remote host closed the connection]
sputnik1_ has quit [Ping timeout: 258 seconds]
chrisseaton has quit [Client Quit]
segfalt has joined #ruby
<cout>
Hanmac: turnleft?
<workmad3>
cout: dr who episode
AlexRussia has joined #ruby
<havenwood>
#turn_left
<segfalt>
Has anything changed in 1.8->2.1 the way Ruby handles signals, specifically with forks? I'm hitting this crazy scenario where I'm working a child, with a trap set up in the parent for SIGUSR1 and the child is raising SignalException SIGUSR1 when that signal *should* be getting sent to the parent. The same code worked in 1.8.7.
razrunelord has quit [Ping timeout: 258 seconds]
rostam has joined #ruby
qubit has left #ruby [#ruby]
iceden has joined #ruby
<cout>
workmad3: I think I didn't like that one. I don't like many that davies wrote.
Megtastique has joined #ruby
<Hanmac>
cout: i tihnk NielGaiman need to write more DoctorWho episodes ;P
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<kraljev6>
Can i get a verdict on Enumerable#reverse_each
relix has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<kraljev6>
Should we file a bug report for deprecation?
<kraljev6>
it clearly doesn't fit there
<cout>
Hanmac: YES!
xerxas has joined #ruby
<cout>
Hanmac: both the ones he wrote are in my top 20
<kraljev6>
apeiros: it seems to me sapphire is no longer being developed
ccooke_ is now known as ccooke
<apeiros>
rubinius X might indeed be the better choice
wnoronha has joined #ruby
aspiers has quit [Ping timeout: 252 seconds]
<apeiros>
they've got the backing and the mission statement
bal has quit [Quit: bal]
duggiefresh has quit [Ping timeout: 240 seconds]
<Edelwin>
5/51
<Edelwin>
whooooops
<canton7-mac>
# => 0
ben3 has quit [Ping timeout: 240 seconds]
<havenwood>
# => 0.0980392
<havenwood>
mruby style :P
badhatter has quit [Read error: Connection reset by peer]
i_s has joined #ruby
tjr9898 has quit [Remote host closed the connection]
i_s has quit [Read error: Connection reset by peer]
oo_ has joined #ruby
i_s has joined #ruby
Spami has joined #ruby
joast has joined #ruby
mrnugget has quit [Read error: Connection reset by peer]
wnoronha has quit [Quit: Computer has gone to sleep.]
Beoran_ has quit [Ping timeout: 265 seconds]
codeurge has joined #ruby
tjr9898 has joined #ruby
chrisseaton has joined #ruby
yakko has quit []
mrnugget has joined #ruby
tylerkern has joined #ruby
mordocai has joined #ruby
Sonofgamekeeper has quit [Quit: leaving]
except has quit [Ping timeout: 264 seconds]
lolmaus has quit [Ping timeout: 265 seconds]
Sonofgamekeeper has joined #ruby
codeurge has quit [Ping timeout: 240 seconds]
axl_ has quit [Ping timeout: 240 seconds]
Hanmac1 has joined #ruby
<mordocai>
Hello. I am thinking about forking https://github.com/bluemonk/net-dns but I am unsure of the legality of the License clause in the Readme. I emailed the author but haven't heard back. Any thoughts? I would need to use it for work and, unfortunately, work doesn't have a legal team to ask.
benzrf is now known as benzrf|offline
mrnugget has quit [Read error: Connection reset by peer]
axl_ has joined #ruby
Hanmac has quit [Ping timeout: 240 seconds]
sambao21 has quit [Quit: Computer has gone to sleep.]
Bumptious has joined #ruby
jespada has quit [Ping timeout: 250 seconds]
lmickh has joined #ruby
Kricir has joined #ruby
<canton7-mac>
mordocai, what's your worry?
ben1 has joined #ruby
<apeiros>
mordocai: the ruby license is rather permissive
<mordocai>
havenwood: I could, he has 14 pull requests that haven't been dealt with though. Which is why I want to fork in the first place
<havenwood>
mordocai: the only question to me is whether they meant just Ruby license, or like Ruby, both BSDL and Ruby
idoru has quit [Quit: Working as programmed]
mikepack has joined #ruby
juanmnl has joined #ruby
idoru has joined #ruby
rippa has joined #ruby
<mordocai>
Also, is there a procedure for forking/taking over a rubygem? Assuming he never answers the bugfixes I'm making(and the ones sitting in pull requests) should probably be available to the community
kevind has quit [Quit: kevind]
<mordocai>
Assuming he never answers,*
Rainicorn has joined #ruby
<havenwood>
mordocai: i guess at the time net-dns initially stated "same license Ruby is", Ruby was choice of GPL2 or Ruby license.
binaryhat has joined #ruby
sambao21 has joined #ruby
LadyRainicorn has quit [Ping timeout: 245 seconds]
<mordocai>
havenwood: Hmmm... if I fork I guess I should probably put it under specifically the ruby license then
<mordocai>
havenwood: Since it changed from GPL to BSD
<havenwood>
mordocai: It will still be encumbered by whatever this license is, which is certainly Ruby license and arguably both GPL2 and 2-clause BSDL.
Emmanuel_Chanel has quit [Quit: Leaving]
wnoronha has joined #ruby
agrinb has joined #ruby
<havenwood>
pick your poison
<apeiros>
mordocai: there's no procedure, no
Elhu has joined #ruby
<apeiros>
mordocai: you fork it and release it under a different name
<apeiros>
e.g. Net::DNS2
<apeiros>
err, net-dns2
codeurge has joined #ruby
i_s has quit [Remote host closed the connection]
razrunelord has joined #ruby
tylerkern has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
kilk_ has joined #ruby
Rainicorn has quit [Read error: Connection reset by peer]
mercerist has quit [Quit: Computer has gone to sleep.]
danshultz has quit [Ping timeout: 245 seconds]
<apeiros>
workmad3: no, it wasn't in 1.8.6 definitively
<shevy>
that reads so wrong
<apeiros>
1.8.7 contains some 1.9 backports, so might be
<workmad3>
apeiros: ok, so 1.8.7 :)
<shevy>
1.8.7 was cool
<apeiros>
hey, I do ruby since 1.8.0, I know my stuff :-p
akonny has joined #ruby
<workmad3>
apeiros: it's possible that the alias was added by activesupport in 1.8.x :)
<havenwood>
here, problem solved: module Enumerable; undef :reduce end
beef-wellington has quit [Ping timeout: 255 seconds]
<Hanmac>
yeah the funny thing that 1.8.6 and 1.8.7 are neigther ABI nor API compatible ;P
<jxf>
I think my personal preference is #reduce (just because that's a number of other langs call it), but I'm hesitant to use it if it's not really established as an idiom yet
<apeiros>
workmad3: well possible, yes
<workmad3>
apeiros: and I've tended to do stuff in the rails ecosystem more often than not
<apeiros>
jxf: a number of langs call it inject
<apeiros>
jxf: so it's really "a number of langs *I* know" ;-p
Spami has quit [Quit: This computer has gone to sleep]
<apeiros>
</pedant>
<workmad3>
jxf: basically, inject has a smalltalk heritage, reduce has a functional heritage
<apeiros>
oh, whom do I lie to… of course I never </pedant> :D
wallerdev has quit [Quit: wallerdev]
<jxf>
apeiros: sorry, yes, I should have said "a number of other FP-flavored langs"
nvrch has quit [Quit: nvrch]
<jxf>
(that I know :) )
mrnugget has quit [Read error: Connection reset by peer]
kevind has joined #ruby
* havenwood
opens pull request to add a #fold alias to #inject and #reduce.
<apeiros>
hrm, "2003 12/25 | 1.8.1", so it's indeed >10y by now that I do ruby
senayar has quit []
<workmad3>
jxf: I have noticed that many ruby programmers (myself included) seem to prefer 'map' over 'collect' (fp over smalltalk) but then 'inject' over 'reduce' (smalltalk over fp) :)
<shevy>
but not 1.8.0!
<shevy>
jxf we'll beat you into .inject eventually
<jxf>
workmad3: that's true, I don't think I've ever written "collect"
maximski has quit []
<apeiros>
map over collect is for 2 reasons: a) shorter, b) expresses IMO better what it does
<apeiros>
with inject vs reject it's mostly habit for me
<shevy>
.collect is for greedy people
<shevy>
.map is for careful people
<apeiros>
*reduce
<workmad3>
apeiros: yeah, I started with collect/inject and have shifted my collect habit to map... should work on my inject habit :)
mrnugget has joined #ruby
canton7-mac has quit [Quit: Leaving]
<shevy>
\o/
<shevy>
all hail king workmad3
<shevy>
A~A~A
<shevy>
here an ascii crown for ya
* workmad3
nods our regal head
<shevy>
hehe
<havenwood>
isn't #fold really the functional programming term? :P
<shevy>
#fold so sounds origami
<apeiros>
foldl, no?
<shevy>
foldyes
* apeiros
folds shevy
aiguu_ has joined #ruby
dblessing has quit [Quit: dblessing]
Valesk has joined #ruby
timonv has joined #ruby
<workmad3>
havenwood: I think 'reduce' is a special case of 'fold'
<workmad3>
havenwood: however, in many cases, inject/reduce is used as a fold, from my very quick reading :)
<Hanmac>
is #fold a sister function from #pack ?
<jxf>
but I'm also the only person I know that actually uses rubocop, so...
<havenwood>
foldr foldl dunno
Valesk has quit [Client Quit]
<Mon_Ouie>
lisps usually use reduce, Haskell calls it foldl, OCaml calls it fold_left
<workmad3>
havenwood: my quick reading suggests that 'fold' folds a list into a single value, but it doesn't have to be of the same type as the list items, while 'reduce' does
gigetoo has quit [Remote host closed the connection]
<workmad3>
very quick reading on an area I don't know a lot about though... so I could have picked up some bad info :)
gigetoo has joined #ruby
<apeiros>
jxf: my rubocop enforces inject over reduce :)
shvelo has joined #ruby
<jxf>
apeiros: hehe
<Hanmac>
haha Rubocop should not be trusted ;P it thinks #find_all and #select are the same ;D
<apeiros>
jxf: that said, I have ~300 line long rubocop config (most of it is comments on the rationale)
<apeiros>
Hanmac: fork, bugfix and PR
<Hanmac>
apeiros: its because Hash#select returns a Hash, while Enumerable#find_all still returns an Array ... *just said*
<Mon_Ouie>
When do they do something different?
<Mon_Ouie>
Oh
Elhu has quit [Quit: Computer has gone to sleep.]
olivier_bK has quit [Ping timeout: 265 seconds]
Valesk has joined #ruby
AlSquire has quit [Quit: Quitte]
coder_neo has joined #ruby
coder_neo has quit [Client Quit]
<havenwood>
the whitespace errors are all i've found helpful
<havenwood>
and easier ways to do that :P
<workmad3>
havenwood: what whitespace errors does robocop tell you about?
ce_afk is now known as cescalante
Rylee has quit [Max SendQ exceeded]
<banister>
Mon_Ouie is there another fancy name for foldr ?
Ardenzi has quit [Read error: Connection reset by peer]
<workmad3>
havenwood: is it just the basic things that never happen with a decent error? trailing whitespace, mixed tabs and spaces and inconsistent indents?
<Mon_Ouie>
I don't know. I've seen just 'fold' be used to refer to foldr though.
<workmad3>
s/decent error/decent editor/
blackmesa has joined #ruby
tjr9898 has quit [Remote host closed the connection]
thesheff17 has quit [Remote host closed the connection]
<shevy>
workmad3 do you mean rubocop
<banister>
Mon_Ouie apparently foldr is more fundamental as foldr can be written in terms of it but not the other way round?
<banister>
as foldl can be written in terms of it*
<havenwood>
workmad3: a variety it seems, not really sure
<Mon_Ouie>
Yess
<banister>
Mon_Ouie You sound excited
<banister>
;)
jeregrine has joined #ruby
wookiehangover has joined #ruby
jiriki- has quit [Quit: leaving]
<banister>
Mon_Ouie have you messed much with Ocaml?
twiceday has quit [Ping timeout: 240 seconds]
tjr9898__ has joined #ruby
<Mon_Ouie>
Not really, I think the only two things I wrote in it were a Sudoku-solver and a game of life
<Mon_Ouie>
(apart from hello world-level stuff)
<banister>
Mon_Ouie what do you think of OCaml from your limited exposure? And how does it compare to haskell?
dblessing has joined #ruby
<apeiros>
havenwood: I don't think I need rubocop for my personal code. my code style is overall IMO quite consistent.
saarinen has quit [Quit: saarinen]
<apeiros>
havenwood: but I added it for my framework. in the hopes that somebody might actually contribute some time and I want a somewhat consistent style :)
danshultz has joined #ruby
<havenwood>
apeiros: yup, i guess for a team setting it up could make sense, but for personal code you *are* you
<apeiros>
havenwood: depending on my experiences, I will add it at work
danshultz has quit [Read error: Connection reset by peer]
<apeiros>
not all of my coworkers share my OCD wrt code style :D
<banister>
apeiros i'm never consistent with "" vs ''
<Mon_Ouie>
It feels less 'clean' than Haskell. I found that it not being pure was annoying because the compiler assumes a function is and optimizes accordingly unless you have an argument. So you can't have a function that returns a random number of type int, it has to be unit -> int otherwise the compiler optimizes it away.
<apeiros>
banister: haha, yes, that was my biggest offense too
saarinen has joined #ruby
danshultz has joined #ruby
<apeiros>
500, no matter which variant I chose
<havenwood>
banister: i usually use '' unless it breaks without ""
<Mon_Ouie>
Also you run into exceptions more often than in Haskell (vs. compilation errors), and those exceptions provide no backtrace
lessless has quit [Read error: Connection reset by peer]
mansi_ has quit [Remote host closed the connection]
<havenwood>
banister: but i've seen some really weird conventions, like '' for requires then "" thereafter :O
wallerdev has joined #ruby
<havenwood>
which is terrible!
<banister>
Mon_Ouie it's object oriented though right? does it combine OO and functional style pretty nicely or does it feel kind of messy?
<ker2x_>
i have a supernoob question and i'll apreciate a link to a manual if the answer isn't easy : i have a file that look like this : module foo; class bar ... end; buz = new.bar() .... end. i don't know if it's clear but ... when the code after the class definition is executed please ?
<joelteon>
we just hardly ever use regex so this hasn't come up
<joelteon>
and to be honest I really do like not using magic globals in my code
mrnugget has quit [Read error: Connection reset by peer]
<ker2x_>
(well, bar.new() not new bar)
<joelteon>
even if it's just a placebo effect
Burgestrand has quit [Quit: Burgestrand]
meth has joined #ruby
combusean has joined #ruby
chipotle has joined #ruby
<Mon_Ouie>
workmad3: Someone who doesn't know what $1 may not guess that it is related to regexps though
yfeldblum has joined #ruby
<meth>
is it possible to point gem at a local gem server that caches gems as they get requested?
<ker2x_>
should i create a pastebin to make my question easier to read ? :)
<workmad3>
Mon_Ouie: so it being used right there with a method that replaces a regexp with a string doesn't give enough of a hint? :)
<banister>
Mon_Ouie is ruby still your favorite language or are you being seduced away to other glittering castles
<Mon_Ouie>
ker2x_: You probably should
Fire-Dragon-DoL has joined #ruby
<ker2x_>
ok, brb
sambao21 has joined #ruby
<workmad3>
Mon_Ouie: or am I being overly expectant that people who are writing code should be able to pick stuff up from context?
mrnugget has joined #ruby
xcesariox has joined #ruby
<joelteon>
workmad3: so you'd prefer $1 over last_match?
ce_afk is now known as cescalante
momomomomo has quit [Quit: momomomomo]
<workmad3>
joelteon: I preferred '$1 + yield($2) + $3' over 'match = Regexp.last_match; match[1] + yield(match[2]) + match[3]'
timonv has quit [Remote host closed the connection]
<joelteon>
how do you feel about $_ in perl?
<Mon_Ouie>
workmad3: hadn't noticed it said regexp on that line (I thought it called it pattern or something). It could still happen in other cases. Not that I'd rather use the long form over $N.
<apeiros>
joelteon: I would prefer gsub to yield matchdata
ffranz has quit [Quit: Leaving]
agrinb has joined #ruby
<apeiros>
joelteon: since you write monkey patches anyway - write one?
ffranz has joined #ruby
troyreadyyy has quit [Quit: Leaving]
froy has quit [Quit: kablam!]
<apeiros>
class String; def gsubm(regexp); gsub(regex) { yield(Regexp.last_match) }; end; end
<apeiros>
and then use that :)
ffranz has quit [Read error: Connection reset by peer]
danshultz has quit [Remote host closed the connection]
<workmad3>
joelteon: third alternative would be for your regexp to use lookahead and lookbehind so that the arg passed to gsub only contains the bit to yield ;)
<Mon_Ouie>
banister: It's still the one I know the most in depth at least, and my go-to language for doing random stuff quickly
momomomomo has joined #ruby
ffranz has joined #ruby
combusean has joined #ruby
<joelteon>
yeah, that would be more elegant
<joelteon>
but it is passed in by third parties and I don't know where, and I don't have the time to figure it out
danshultz has joined #ruby
<Mon_Ouie>
ker2x_: It's executed when you load that file, right after evaluating the class definition
<workmad3>
joelteon: :)
yfeldblum has quit [Ping timeout: 258 seconds]
nathancahill has joined #ruby
<Mon_Ouie>
(i.e. Bar#stuff will exist at that point)
<joelteon>
i just have to figure out the acceptable level of magic
<workmad3>
joelteon: well, Regexp.last_match is still magic
<joelteon>
regex matches are probably safe, but the line has to be drawn somewhere
<apeiros>
workmad3: thought about suggesting that, but won't work universally
zastern_ has quit [Quit: WeeChat 0.4.3]
<joelteon>
yes, but it's a self-documenting name
<apeiros>
workmad3: lookbehinds must e.g. not have quantifiers
pen has quit [Remote host closed the connection]
<workmad3>
apeiros: hey, stop that... I suggested lookaheads and lookbehinds knowing that it was probably unworkable due to large-scale changes
froy has joined #ruby
<workmad3>
apeiros: that way I can say 'well, you're already compromising on decent code, so why not just use $1' ;)
dik_dak has joined #ruby
<apeiros>
lol
mrnugget has quit [Read error: Connection reset by peer]
<apeiros>
ooookay
cpruitt has joined #ruby
<ker2x_>
Mon_Ouie: when require is called the code below the class definition is executed ? correct ? so if there is "puts someting" here then "something" will be printed even before my "main" stuff is executed ? (considering i have the "require" before my main code)
* apeiros
off to write an url parser
rokob has joined #ruby
<workmad3>
ker2x_: the class definition is also code that's executed
atraylen has joined #ruby
<ker2x_>
hummmm
<workmad3>
>> class Foobar; puts "hey, I'm just code too!"; end
<Mon_Ouie>
It's not a local variable, it's a constant define in the module Lyly
Solnse has joined #ruby
sooik has joined #ruby
<Mon_Ouie>
Which does mean that it's accessible in that second place
<ker2x_>
So it's visible from anything that is in the same module ?
Beoran has joined #ruby
codeurge has joined #ruby
<Mon_Ouie>
You can access it from other places too, just not directly
<ker2x_>
ok
<Mon_Ouie>
You can just do Lyly::RuntimeObject
<ker2x_>
well... Thank you \o/
creativeembassy has joined #ruby
davedev2_ has joined #ruby
SegFaultAX has quit [Excess Flood]
obs has joined #ruby
SegFaultAX has joined #ruby
fantazo has joined #ruby
freerobby has joined #ruby
nowthatsamatt has joined #ruby
ExceptionlCatch has joined #ruby
davidcollom_zzz has joined #ruby
m8 has joined #ruby
<ker2x_>
That's weird stuff, i'm wondering if i could avoid doing that. it's probably a very clever hack but... meh
<ExceptionlCatch>
i'm using ruby with the 'cgi' module and want use websockets. it seems everyone is using em-websockets or faye, is the original websockets unpopular?
<havenwood>
ExceptionlCatch: a lot of attention went to SSE
RSTJNII has quit [Remote host closed the connection]
RSTJNII has joined #ruby
jack_rabbit has joined #ruby
<banister>
havenwood i used to be all about websockets but now i think sse is cooler
Spami has joined #ruby
<banister>
apparently it's faster and you can also use it without having to host a separate websockets server, sse just uses your regular web server on teh standard ports
Spami_ has quit [Quit: Leaving]
Spami has quit [Client Quit]
<ker2x_>
See you later ! thank you for the help. enough code for tonight :)
<havenwood>
banister: like SOAP versus REST
Spami has joined #ruby
<havenwood>
banister: text/event-stream ftw
ker2x_ has quit [Quit: ChatZilla 0.9.90.1 [Firefox 29.0.1/20140506152807]]
<ExceptionlCatch>
oh nifty, thanks havenwood and banister for the clarification
<happytux_>
So there is a Rakefile and a FileList defined inside: puppet_files = FileList['**/*.pp'].exclude('.*', 'doc/', 'vendor/', 'modules/')
<happytux_>
Now how can I run a command with a path to each of those files in FileList?
<happytux_>
Because the command in question does only support one file at time.
zorak has joined #ruby
AlexRussia has quit [Read error: Connection reset by peer]
bubbajones has quit [Remote host closed the connection]
AlexRussia has joined #ruby
Olipro has quit [*.net *.split]
davidcollom has quit [*.net *.split]
justinxreese has quit [*.net *.split]
davidcollom_zzz is now known as davidcollom
jackneill has joined #ruby
kraljev6 has joined #ruby
geggam has joined #ruby
<kraljev6>
Hey, what does Hash#keep_if do without a block?
<kraljev6>
It returns an enumerator, but I don't understand what this enumerator is good for.
combusean has quit [Ping timeout: 240 seconds]
kenneth has joined #ruby
MZAWeb_ has quit [Ping timeout: 265 seconds]
vpretzel|215 is now known as vpretzel|910
<rgiscard>
ExceptionalCatch: If you go Rails (4.x) way, consider ActionController::Live to build yer SSE
Sirupsen has joined #ruby
lw has quit [Quit: s]
<terrellt>
kraljev6: It's an object that responds to the basic enumeration methods.
<terrellt>
kraljev6: All the enumerable methods return that without a block.
mansi_ has quit [Remote host closed the connection]
beef-wellington has quit [Ping timeout: 240 seconds]
<Mon_Ouie>
kraljev6: Probably calling with_index or with_object are the only two things you'd ever do to the enumerator returned by a method like #keep_if
<terrellt>
shevy: Boot time and dollars spent have an inverse relationship.
lw has joined #ruby
<shevy>
it's more of a design problem, all those one-after-the-other shell scripts that are run before one can login
mrnugget has quit [Read error: Connection reset by peer]
<Mon_Ouie>
(most other additional methods pass it a block that doesn't return anything useful)
rizzatti has joined #ruby
kraljev6 has quit [Ping timeout: 245 seconds]
kraljev6 has joined #ruby
combusean has joined #ruby
dangerousdave has joined #ruby
moritzs has quit [Ping timeout: 252 seconds]
<kraljev6>
so, anyone? What does Hash#keep_if do without a block
<Cadmi>
yes shevy you can look the problem also if you want
rgiscard has quit [Ping timeout: 265 seconds]
<Cadmi>
it is a 2d matrix to find a bomb
<atmosx>
guys, I wanna grab a stream... I wrote a script could be execute through chrome, 5 days a week at 8:30 but... how do I stop it after 2 hours and 10 minutes?
<apeiros>
Cadmi: find_index, as I said
<atmosx>
should I something else like eventmachine (never used it don't know if the task)
<Cadmi>
find_index? find value
<jhass>
Cadmi: or each_with_index and explicit return
<atmosx>
I could get the pid of the process and kill it? hm
<Jnco>
Ive been a sys admin my whole career then jumped into devops writing some shell scripts in python, php, bash-- you guys think I can handle ruby?
<apeiros>
Cadmi: *maybe* you should read the docs of the method
<_havenn>
Jnco: yes
<Jnco>
why did I decide to now to take on programming seriously
Aaaal has quit [Quit: Aaaal]
<Jnco>
after like 15 years haha
<apeiros>
Jnco: sure. ruby isn't that different from python
poguez_ has joined #ruby
<apeiros>
and if you've survived the hell that is php…
<Jnco>
yeah i like the gems
<Hanmac>
shock_one: Person.new.instance_exec(&callable) works for me
<divbell>
jnco, you've been a sysadmin your entire career but you've never written any code to help you with that?
<Jnco>
some vb
nathancahill has joined #ruby
* divbell
backs away slowly
<Jnco>
startup scripts.. windows shell script
<Jnco>
lol
<Jnco>
was windows admin
<Jnco>
for a long time
sepp2k has joined #ruby
<Jnco>
I like linux for servers now more pretty obvious why
djbkd has quit [Remote host closed the connection]
<shock_one>
Hanmac, yeah, for me too. But instance_eval works too, and it's strange since 1. instance_eval passes self as an argument 2. lambdas force arity.
<shevy>
ruby works on linux and windows
<Jnco>
windows seems to get fatter and fatter the more I use linux
<shevy>
and even on toy OS like osx
<Jnco>
why arnt more people using it
<shevy>
ruby?
<yxhuvud>
shevy: how is osx a toy?
<Jnco>
yea
<Hanmac>
shock_one: it totally depends on the block args
<shevy>
yxhuvud it has the eyecandy
<shevy>
Jnco there is a cost involved when learning a programming language
<xybre>
" Darwin, the system on which Apple's Mac OS X is built, is a derivative of 4.4BSD-Lite2 and FreeBSD"
<xybre>
Of course most operating systems contain BSD's network stack code, including Solaris and Windows (up until 7, I think) but OSX is literally BSD.
<shevy>
with ports?
<webgen>
and how do i check if a string consists of a legit binary number ?
<shock_one>
Hanmac, mystery is revealed, thank you.
<shevy>
Hanmac how is rwx going
<shevy>
can I gem install it?
<xybre>
shock_one: Yes, they all have ports.
razrunelord has quit [Remote host closed the connection]
tylerkern has joined #ruby
<terrellt>
webgen: Umm..
<Hanmac>
shevy not yet, did work on patches for wx itself recently ... but have more important stuff todo
<shock_one>
xybre, TCP ports?
aspiers has joined #ruby
<divbell>
windows ipv4 tcp/ip stack is from bsd
<xybre>
You're probably talking about Berkeley Sockets, not jsut ports.
<shevy>
been like 8 years since I last tried freebsd
<terrellt>
^ That
<xybre>
shevy: You mean "port" as in there's a way to compile Ruby on it?
<terrellt>
Although it'd probably break with leading zeros.
<xybre>
lulz
<shevy>
xybre I mean that ports system that they use to compile software, and where they say that they don't need a package manager like linux distributions because they have ports
agrinb has quit [Remote host closed the connection]
agrinb has joined #ruby
<mostlybadfly>
Hey guys what is the rails channel?
<mostlybadfly>
Prob obvious lol
<shevy>
#rubyonrails
<shevy>
I remember you mostlybadfly
aspires has quit []
<shock_one>
shevy, cool kids use brew nowadays.
<shevy>
but I dont remember from which channel
mikepack has quit [Remote host closed the connection]
<shevy>
mostlybadfly not #nixos right?
<mostlybadfly>
shevy: this one :)
<shevy>
whoa cool
<mostlybadfly>
You've helped me quite a few times
<shevy>
I don't remember really
randomnick_ has joined #ruby
<mostlybadfly>
Nae just starting with rails and wanted to join a channel in case I have questions
mikepack_ has joined #ruby
<shevy>
but the two coolest ideas found in distributions had been in gobolinux and in nixos
<xybre>
shevy: Ah. OSX has a few port systems. I use homebrew, which is pretty great and manages packages and dependencies. I actually wish for a similar system on Linux.
<shevy>
cool
<shevy>
well I know nothing about rails really but if there are ruby questions I might be able to help!
<xybre>
Note that Portage/Emerge is not at all the same thing as Homebrew.
robbyoconnor has joined #ruby
<shevy>
unless it is meta-instance-eval mega stuff
<xybre>
Homebrew is written in Ruby also.
oo_ has joined #ruby
<shevy>
and only for osx folks :(
<shevy>
it reminds me of textmate
<shevy>
"if you want to use it, get a mac"
<xybre>
There's a ... uh.. port of Homebrew for Linux in progress.
<shock_one>
shevy, well, all the package managers are only for pick-an-OS.
<shevy>
shock_one hmm, I guess some package managers on linux could work on osx too
chipotle has quit [Quit: cya]
robbyoconnor has quit [Client Quit]
<shock_one>
shevy, I doubt that it's possible to run pacman on ubuntu or yum on debian, not to say about other OSes.
mansi_ has quit [Read error: Connection reset by peer]
<shevy>
haha oh my god gentoo...
rgiscard` has quit [Remote host closed the connection]
<shevy>
I compiled the whole system on a laptop in gentoo once
<shevy>
late at night
mansi has joined #ruby
<shevy>
I woke up early in the morning to see some stupid error fail and stop the whole cycle
mansi has quit [Read error: Connection reset by peer]
MrWharfsnort has quit [Ping timeout: 255 seconds]
<wallerdev>
haha that's the worst
<xybre>
I've successfully run Gentoo on servers and laptops, but considering how slowly they update their source repos and their stupid fights with upstream maintainers its really jsut not worth it anymore.
mansi has joined #ruby
alvaro_o has joined #ruby
saarinen has quit [Quit: saarinen]
<shock_one>
xybre, what's your choice?
<wallerdev>
the true linux choice these days is mac os x
<shevy>
xybre what do they fight over?
sinkensabe has joined #ruby
<shevy>
wallerdev I like linux from scratch + beyond linux from scratch simply because it teaches people core things
<yxhuvud>
wallerdev: by definition, no. osx is not a linux.
danshultz has joined #ruby
<wallerdev>
unix, w/e same thing
<wallerdev>
:)
<_havenn>
bsd
<shock_one>
wallerdev, kind of, until you dig deeper.
<xybre>
shock_one: Right now I use Ubuntu Server for my servers, and I use Crunchbang and Manjaro a bit for desktop use. Haiku is also a great OS, but requires some legwork for certain apps.
<shevy>
cool
<wallerdev>
did you guys watch silicon valley last night
<shevy>
haiku was nice
<shevy>
I only ran it in qemu though
<wallerdev>
ruby on rails came up on it lol
<shevy>
wallerdev really? why was it featured?
jonahR has joined #ruby
<wallerdev>
the main character was like "i learned ruby on rails in a weekend, i can figure out this cloud stuff"
<wallerdev>
but he couldnt figure out cloud
<wallerdev>
D:
<xybre>
shevy: For example Gentoo bans nethack because of Gentoo's broken security design. Gentoo blames Nethack for opening a security hole while Nethack is perfectly secure on every other distro and OS.
<shock_one>
xybre, Is Manjaro for people who didn't manage to install Arch?
<xybre>
shock_one: Yep!
<yxhuvud>
xybre: I've heard very ugly things about the nethack code base though, so I can kinda understand that.
<shock_one>
xybre, those should not touch my Arch.
<shevy>
xybre wow
<shevy>
that is evil
<shevy>
to ban nethack
<shevy>
that's like attacking ancient games
<xybre>
yxhuvud: Oh man, don't get me wrong, I'm not justifying the casebase. It's called "nethack" because its a big hack a couple of people came up with via email source code back and forth.
<_havenn>
OS X is fully POSIX-compliant unlike most mostly compliant Linux distros :O
<shevy>
shock_one I can't make too much fun of emacs because matz is using it
<xybre>
Wow, OSx has never been POSIX compliant before. I mean, really, thats probably becasue POSIX as a standard has some pretty silly edge cases in places.
<wallerdev>
the good thing about emacs is the shortcuts work everywehre
Eiam_ has joined #ruby
<xybre>
shevy: I've never gotten around to even booting HURD. But I did use Menuet for a little while.
<wallerdev>
vim you learn but cant use it anywhere besides vim lol
<Xeago>
wallerdev: I disagree
<Xeago>
readline has a vimmode
<Xeago>
sorry vimode*
phutchins has quit [Ping timeout: 250 seconds]
<wallerdev>
sure you can hack it into various other applications
<Xeago>
wallerdev: no, you just control readline
<Xeago>
my irb, pry, shell
<Xeago>
they all have vimode
<happytux_>
Anyone here using Rake?
<shock_one>
Did you guys know that emaks's C-p and C-n work in Skype and Chrome on OS X? Like to edit messages and autocomplete omnibar search suggestions.
<xybre>
I use Emacs shortcuts in Vim.
<wallerdev>
but like i can open a web browser and type in an input file and use ctrl+a and ctrl+e to go to beginning and end of lines of text fields
<wallerdev>
etc
debajit has joined #ruby
<xybre>
I could never decide if viml or emacslisp was the worse language though.
<wallerdev>
any applciation on a mac i can use my emacs shortcuts
<shock_one>
xybre, some centuries ago you would be burned down.
<xybre>
shock_one: Vim doesn't have very good commandline editing shortcuts, so patching in Emacs shortcuts makes sense. Best of both worlds.
benzrf|offline is now known as benzrf
Eiam has quit [Ping timeout: 260 seconds]
<wallerdev>
elisp is awful lol
<wallerdev>
configuring emacs sucks haha
<shock_one>
xybre, I use vi keymap in console. Especially I miss M-,
<xybre>
So is viml, but yeah.
<benzrf>
it has /dynamic scoping/ tho
<benzrf>
*elisp does
<wallerdev>
i just use textmate now though haha
prc has left #ruby [#ruby]
<debajit>
Newbie question: How do I get the maximum Integer in Ruby?
ktun has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<debajit>
wallerdev: I know, I’m trying to write a test where I need to basically get any integer. I’d like to generate a number from INT_MIN to INT_MAX. How do I do that? I’m writing a static function: Any.int_value
<debajit>
workmad3: I know I could use up all the memory :P Lets say I’m looking for the largest value less than a BigNum (sorry, I’m not sure how big that is)
<shock_one>
xybre, use Rational, Luke.
combusean has quit [Ping timeout: 255 seconds]
<baweaver>
It's normally around 2.14 billion
<workmad3>
debajit: depends on if you're on a 32 or 64 bit ruby
<workmad3>
hmm, interesting, with exponentials '3 ** 3 ** 3 ** 3' gives Infinity, but 'a = 3; 4.times { a **= 3}' doesn't crap out :)
nwertman has joined #ruby
shashank_rs has joined #ruby
<benzrf>
>> 3 ** 3 ** 3 ** 3
<eval-in__>
benzrf => /tmp/execpad-099e665ad75b/source-099e665ad75b:2: warning: in a**b, b may be too big ... (https://eval.in/150252)
<benzrf>
o=
aspiers has quit [Ping timeout: 255 seconds]
<debajit>
terrellt: Got it :) Thanks. Is there a way to get to the largest fixnum without having to calculate it?
<shevy>
god man
<benzrf>
workmad3: im guessing its grouping
<benzrf>
i.e.
<terrellt>
debajit: No.
<terrellt>
debajit: It's dependent on environment.
<benzrf>
3**(3**(3**3))
<RubyPanther>
workmad3: the shortcuts are different depending on the methods
<benzrf>
((3**3)**3)**3
<benzrf>
^not the same!!!
<workmad3>
benzrf: yeah... I currently have a bignum that's almost 7 million digits long...
binaryhat has quit [Quit: Leaving]
Bumptious has quit [Read error: Connection reset by peer]
<workmad3>
ah, I've reached 'Infinity' in bignums after trying to cube that
<terrellt>
workmad3 likes to break the world.
<RubyPanther>
debajit: You should generally NOT NOT NOT NOT NOT be worrying about that as a "limit'
<debajit>
terrellt: Got it :) Thanks a ton :) I’m still getting the hang of Ruby, I love it so far :) very beautiful language. I’m surprised its not used as much as languages like Java
<RubyPanther>
Also note that a Bignum is still an integer
<shevy>
ur mom is a fixnum!!!
_justin has joined #ruby
Bumptious has joined #ruby
diegoviola has joined #ruby
<debajit>
RubyPanther: Ah, thanks. Where could I see a class hierarchy of Numeric?
<RubyPanther>
shevy: ur moms is so fat, she tried to get an integer representation and exceeded the stack limit
<shevy>
lol
jhass is now known as jhass|off
<benzrf>
ur moms so fat, she follows the 8.3 naming cheme
<benzrf>
*scheme
ktun has joined #ruby
<RubyPanther>
debajit: we don't normally worry about siblings or children of classes, they are under their own care, so we don't usually have class hierarchy diagrams. They are only useful in Ruby when you're doing things very wrong.
sinkensabe has quit [Ping timeout: 252 seconds]
<RubyPanther>
debajit: You should be worrying ONLY about if the objects you're getting have the methods you need
<workmad3>
benzrf: hmm, so it looks like ruby can do 'a **= 3' 17 times in ruby before bignum goes to infinity
<debajit>
RubyPanther: Got it. I just wanted to see how Numeric’s and Bignums and Integers were related that’s all actually :) (I’m just trying to learn Ruby in a few weeks)
<workmad3>
also interestingly... it uses Float::Infinity for that...
jackneill has quit [Remote host closed the connection]
<RubyPanther>
when you need an int, you say foo.to_i to get an integer representation. If the number is somehow "too big," then foo's #to_i method should be written to handle that. More often you would simply have a max value that comes out of your problem domain, instead of out of the limits of the host machine. In general in Ruby we want to be free of caring about the machine, we want to think, and have our code reflect, the problem domain as se
<RubyPanther>
en from a human perspective, not as seen from a C perspective. This is true even when writing C extensions
<workmad3>
so (a **= 3).class will go from Fixnum to Bignum to Float...
bijan07077 has joined #ruby
<benzrf>
<debajit>
RubyPanther: Awesome :) Thanks a ton :) That helps
sambao21 has quit [Quit: Computer has gone to sleep.]
timonv has quit [Remote host closed the connection]
decoponio has quit [Quit: Leaving...]
tobago has quit [Remote host closed the connection]
timonv has joined #ruby
alem0lars has quit [Quit: alem0lars]
<workmad3>
webgen: because ruby uses 0-indexing
nanoyak has quit [Quit: Computer has gone to sleep.]
anaeem1__ has joined #ruby
<workmad3>
webgen: what are you wanting to do there btw?
<webgen>
workmad3, so it start from array.length+1 in my case?
<webgen>
workmad3 to check if last to digits are 0
djbkd has quit [Remote host closed the connection]
_lazarevsky has joined #ruby
<_lazarevsky>
howdy all
anaeem1 has quit [Ping timeout: 240 seconds]
<workmad3>
webgen: I'm somewhat concerned about the method name 'binary multiple of 4'... as that's implying that a number may be a multiple of 4 in decimal but not in binary...
<_lazarevsky>
before I kick things off I've got a confession to make.. coming from .NET and Java I wanna say that I really dig the Ruby community
mehlah has joined #ruby
kraljev6 has quit [Ping timeout: 240 seconds]
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
<_lazarevsky>
I would say the average Ruby programmer is a better programmer (or computer scientist) than the aforementioned
<RubyPanther>
debajit: They inherit from Numeric, but most of the methods are implemented for each class. Very little is shared. The things that are shared are mainly things that coerce into a float first. For example Numeric provides a #ceil that converts to a float, and uses the float ceil method, which returns an int.
nowthatsamatt has joined #ruby
rOOb has joined #ruby
nowthatsamatt has quit [Client Quit]
creativeembassy has quit [Quit: FO SHO]
<_lazarevsky>
now I wanna ask you, if there exists a built in function in ruby whereby I can say "give me the n last elements in the array with the lowest value"
jhass|off is now known as jhass
reset has joined #ruby
<workmad3>
_lazarevsky: example input and output would be useful
<segfalt>
webgen: If you need to see if the last two characters of a string are "0", you can do string[-2..-1] == "00", but there's probably something more math-y you can use for that method.
<_lazarevsky>
I know this may be a stretch but again and again I've come across pretty zen built in functions in ruby so I thought I'd give it a try before setting about implementing it myself
<debajit>
RubyPanther: got it
<webgen>
workmad3, i would ignore method name on your place :D
<yxhuvud>
_lazarevsky, : arr.sort.take n
<RubyPanther>
IMO that is the only useful part of numeric to understand the details of. Mixed types are expected to be converted to floats. You can use a backwards coerce method to change this, for example in a money class where you want it to return money objects when added to a float, or when a float is added to it
timonv has quit [Ping timeout: 240 seconds]
<_lazarevsky>
yxhuvud: yea I thought about doing something like that
<_lazarevsky>
but I was hoping for
<_lazarevsky>
arr.take.last_n
<_lazarevsky>
:P
<_lazarevsky>
or something along those lines..
<banister>
_lav sort the array ? :)
<_lazarevsky>
banister: dude yea I know how to do that.. I just wanted to see if there's something cool built in in ruby
<workmad3>
_lazarevsky: right... so you're talking 'lowest 5 elements in the array'... yeah, 'arr.sort.take(n)' or even 'arr.sort[0...n]'
benzrf is now known as benzrf|offline
<MrWharfsnort>
apeiros: thanks :)
Wolland has joined #ruby
Wolland has joined #ruby
<_lazarevsky>
btw
<workmad3>
_lazarevsky: you could always add said method ;)
<_lazarevsky>
does any of you fellows use vim?
* segfalt
used to
<_lazarevsky>
I wrote a pretty cool macro :P
<_lazarevsky>
which, when you press F8, prints console.log("currentLine")
<_lazarevsky>
hehe :)
<_lazarevsky>
actually it opens a new line, and prints console.log("lineNumber")
<shock_one>
_lazarevsky, very funny. That's probably so hard to write.
<_lazarevsky>
well.. it's not super hard.. it's a one liner.. but it takes a lot of reading
<_lazarevsky>
I wanna figure out how to print the function name
<_lazarevsky>
or maybe create a stack trace macro
<_lazarevsky>
that would be kewl
bluOxigen has joined #ruby
<shock_one>
By the way, if you guys ever need to take, say, 3 lowest values of 1 000 000 elements array, that's where insertion sort shines.
<workmad3>
_lazarevsky: I'd prefer a macro that does 'binding.pry' (or removes that if it's already the line)
<_lazarevsky>
print on enter and before exit from a function
<workmad3>
call it a 'breakpoint' :)
saarinen has joined #ruby
razrunelord has joined #ruby
<_lazarevsky>
lol
<segfalt>
workmad3:
<_lazarevsky>
I will write it for ya
<segfalt>
binding.pry drops you into pry right there?
<_lazarevsky>
segfalt: correct
<workmad3>
segfalt: yup
<segfalt>
that is very slick.
* segfalt
will be using that a lot.
<workmad3>
segfalt: you need pry installed
carraroj has joined #ruby
<_lazarevsky>
I miss the good one netbeans debugger
vjt has joined #ruby
asteros has joined #ruby
<_lazarevsky>
and especially the Visual Studio debuggers
<shock_one>
_lazarevsky, aspect oriented programming can print on enter and exit.
<_lazarevsky>
they were fantabulous
<workmad3>
shock_one, _lazarevsky: or a trace function
nanoyak has joined #ruby
<_lazarevsky>
shock_one: I dont think I've ever heard about aspect oriented programming. *googling it*
<workmad3>
(I think)
Cadmi has quit []
<_lazarevsky>
aaaaaanyway fellows
jonahR has quit [Quit: ¡Adios amigos, me fui para el carajo!]
<_lazarevsky>
How would you like to work for Amazon.com?
<_lazarevsky>
in the EC2 department?
<_lazarevsky>
we're doing a lot of ruby dev here
<shock_one>
workmad3, with stack trace you can only see callers. What if I want to see "neighbours"?
<_lazarevsky>
and we're hiring
<_lazarevsky>
if you're interested in applying. please do let me know
<banister>
_lazarevsky no offense but u seem kind of noobed-out to be working for amazon, r u an intern? ;)
<_lazarevsky>
banister: noobed-out. Ouch that hurt! I'm good with analysis of Algorithms haha
<_lazarevsky>
;)
<banister>
:P
<banister>
sry
<banister>
brb
ktun has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<RubyPanther>
I was reading that in bed last night, thinking, wow, I'm sure glad I have time in my life to relax and read silly nonsense before bed
<_lazarevsky>
RubyPanther: well you won't be packing boxes mate
phutchins has joined #ruby
akonny has quit [Quit: akonny]
<shock_one>
_lazarevsky, how many boxes can be packed in a school bus?
<RubyPanther>
_lazarevsky: packing boxes are probably the best jobs they have, in that they're not worse than box-packing other places
<RubyPanther>
_lazarevsky: read the article, it isn't talking about box-packing
<RubyPanther>
it is talking about professionals, top to bottom
<workmad3>
shock_one: I was thinking 'set_trace_func' and yes, if you have a block that picks up c-call and c-return events, you can set a trace function that prints out when you're entering and leaving a method :)
<workmad3>
shock_one: so not just a stack trace
<_lazarevsky>
and to wrap it all off "Despite hefty monetary incentives for getting someone hired, I don't refer people."
<_lazarevsky>
haha
<_lazarevsky>
that's true tho.. They have a very lucrative peer referral programme :P
omosoj has joined #ruby
txdv has quit [Read error: Connection reset by peer]
<RubyPanther>
You need that when you're churning through talent constantly
txdv has joined #ruby
ktun has joined #ruby
<_lazarevsky>
ok well.. it's too bad no one's interested
chrisseaton has joined #ruby
<RubyPanther>
If you're hiring great engineers and paying them well and the consider the experience "soul-crushing" and on average only stay a year and a half... wow, that is bad
datafirm has joined #ruby
wontoner_io has joined #ruby
<_lazarevsky>
I don't know how things are run in Seatlle mate
<shock_one>
_lazarevsky, I wrote you a private message.
<_lazarevsky>
EC2 is developed in Cape Town, South Africa
<_lazarevsky>
here it's pretty chilled.. Teams act as start-ups
<_lazarevsky>
everyone walks bare-foot
<_lazarevsky>
and it's super relaxed..
<_lazarevsky>
long working hours tho.. but it's a stimulating atmosphere which drives you
<vpretzel|910>
I wouldn't be able to work with stinky feet people
<_lazarevsky>
at least that's been my experience
<RubyPanther>
"teams act as start-ups" is code for "80 hrs a week, no overtime"
<_lazarevsky>
RubyPanther: HAAHAHAHA
<_lazarevsky>
hahahahaha
cjsarette has quit [Max SendQ exceeded]
<_lazarevsky>
i lol'd so hard
<_lazarevsky>
hahahhaa
freerobby has quit [Read error: Connection reset by peer]
<RubyPanther>
it is after the laughing stops the melancholy sets in
zachallett has quit [Remote host closed the connection]
<_lazarevsky>
as Xtina Aguillera would say "words can't bring me doooown. oooh nooo I am beautiful"
<workmad3>
cross-tina?
<atmosx>
are you?
<wontoner_io>
RubyPanther: Programmer's Nirvana! Once you have a beer helmet you're good..
<RubyPanther>
it only devolves to weeping if you're been there past a year and a half
codeurge has quit [Ping timeout: 276 seconds]
freerobby has joined #ruby
debajit_ has joined #ruby
rsuey has joined #ruby
claymore has quit [Quit: Leaving]
zachallett has joined #ruby
<_lazarevsky>
anyway you guys are a cool bunch
<RubyPanther>
I remember going into TripWire's offices on a saturday during the .com boom... there was nobody else there. At all. The entire company was either working normal hours, or getting paid for on-call time. That is what a successful startup looks like.
mercerist has quit [Quit: Computer has gone to sleep.]
<_lazarevsky>
RubyPanther: I admit, not everyone could cope with such a pace
<_lazarevsky>
but I find it very rewarding.. I mean in less than 6 months I learned so many new technologies
kevind has joined #ruby
debajit_ has joined #ruby
<_lazarevsky>
so my hands dirty in open source projects
<RubyPanther>
"coping" is something you do to overcome bad things that happen to you. You should have to "cope" with your job. It means your job SUCKS.
sambao21 has joined #ruby
<_lazarevsky>
am slowly mastering vim.. It's a cool place to work if you're driven
freerobby1 has joined #ruby
<_lazarevsky>
I dig it
<RubyPanther>
"shouldn't"
<_lazarevsky>
yea I did not express myself correctly there I guess.. English is not my mother tongue as you noticed
MrWharfsnort has quit [Ping timeout: 255 seconds]
<skinkitten>
i LIKe ruby, and panthers, RubyPanther hiring? :>
<RubyPanther>
It is not a question of expressing yourself "correctly," it is that you're putting lipstick on a pig
debajit has quit [Ping timeout: 240 seconds]
freerobby has quit [Ping timeout: 245 seconds]
<_lazarevsky>
RubyPanther: geez.. you're bitter.. Did you have a traumatic experience in the early days of your career. Please lay down and tell me all about it :P
<RubyPanther>
skinkitten: I'm never hiring, but like everybody else I'd always love to find more subcontractors that can do high quality illustration of customer products! But I doubt I'll find many sell-out artists in a programming channel. :/
<skinkitten>
when in doubt ____________________________
debajit_ has quit [Client Quit]
<RubyPanther>
_lazarevsky: I said no to all that crap without having to go there. I've had bad clients, but I've never had a bad job. So no, I'm not traumatized at all.
carlyle has quit [Remote host closed the connection]
jwest has quit [Quit: WeeChat 0.4.2]
cjsarette has joined #ruby
Sirupsen has joined #ruby
nowthatsamatt has joined #ruby
wallerdev has joined #ruby
bijan07077 has quit [Quit: bijan07077]
Sirupsen has quit [Client Quit]
sambao21 has quit [Quit: Computer has gone to sleep.]
debajit has joined #ruby
codeurge has quit [Ping timeout: 252 seconds]
MrWharfsnort has joined #ruby
agrinb has quit [Remote host closed the connection]
nanoyak has joined #ruby
shvelo has joined #ruby
SegFaultAX has quit [Excess Flood]
terrell_t has joined #ruby
Jnco has quit [Remote host closed the connection]
mr_snowf1ake has joined #ruby
Jnco has joined #ruby
codeurge has joined #ruby
codeurge has quit [Max SendQ exceeded]
<vim_shim>
If you're working long hours consistently, it's not for your own personal business, and you have no problem with it - you've already drank the cool-aid.
<vim_shim>
The previously linked article reminds me a lot of books I've read on the experience of Unification Church cult members (Moonies).
<wallerdev>
yeah i worked long hours at my last job
<wallerdev>
kills your soul
KanKava has joined #ruby
<wallerdev>
haha
sambao21 has joined #ruby
<_lazarevsky>
how did you break the vicious cycle?
saarinen has quit [Client Quit]
SegFaultAX has joined #ruby
<vim_shim>
Command and control coercion techniques can be ported to any social environment if you own the platform. eg. the building (whether it be church or office)
<shevy>
wtf
<shevy>
coercion
kyb3r_ has joined #ruby
<shevy>
you can put chains on the heels and lipstick on a pig
<shevy>
but it stays a pig!
AlexRussia has quit [Read error: Connection reset by peer]
x1337807x has joined #ruby
debajit has quit [Client Quit]
<shevy>
hmm if I have a method in a file called foo.rb
<shevy>
def foo; puts 'hi from foo'; end
debajit has joined #ruby
<shevy>
is there a way to load this file into a namespace?
<wallerdev>
put it in a module in that file
shvelo has quit [Ping timeout: 255 seconds]
<wallerdev>
then you can extend your current module with it
<workmad3>
wallerdev: selecting the parent based on child elements, last I checked
<wallerdev>
:(
<Burgestrand>
workmad3: continuations, exceptions, throw/catch; all are poison
<Rickmasta>
so how different is doing a css path than xpath?
Bumptious has quit [Remote host closed the connection]
<Burgestrand>
!
<shevy>
damn, workmad3 is using more javascript than ruby
<Rickmasta>
I'm having no luck with xpath.
<centrx>
CSS is much simpler
<wallerdev>
didnt realize you could do that with xpath haha
nwertman has joined #ruby
ukd1 has joined #ruby
<workmad3>
wallerdev: ;)
<centrx>
div.my_class, div#my_id
snuffeluffegus has joined #ruby
<workmad3>
wallerdev: it's rare I need xpath... but I'm glad it's there when I do :)
<debajit>
centrx: Thanks!
<debajit>
centrx: There seems to be a ruby-doc.org and a ruby-doc.com :)
snuffeluffegus has quit [Remote host closed the connection]
<debajit>
centrx: Seems they are mirrors
snuffeluffegus has joined #ruby
zachallett has quit [Remote host closed the connection]
saarinen has joined #ruby
<Rickmasta>
it only outputted the html?
<Rickmasta>
I mean the tags, with no content.
<centrx>
Both XPath and CSS should return a Nokogori Node/NodeSet
michaeldeol has joined #ruby
<centrx>
#xpath, #css, #search
saarinen has quit [Client Quit]
djbkd has joined #ruby
razrunelord has quit [Remote host closed the connection]
<mordocai>
Alright, so I have officially forked the rubygem net-dns. Now has implemented support for source address spoofing. https://rubygems.org/gems/net-dns2. Please start using it and filing issues against it! net-dns is no longer maintained.
agrinb has quit [Remote host closed the connection]
tylerkern has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
jeregrine has quit [Quit: Connection closed for inactivity]
terrell_t has quit [Remote host closed the connection]
shock_one has quit [Ping timeout: 255 seconds]
iMe has joined #ruby
fangari has joined #ruby
tylerkern has joined #ruby
razrunelord has joined #ruby
terrellt has joined #ruby
<happytux_>
hm, am I on ignore list? :/
<webgen>
guys I am having trouble at raise argumenterror, how can I raise argumenterror if the class initializer gets an empty string as a parameter? I couldnt find a concise example on google :S
debajit has joined #ruby
<webgen>
happytux_, nop
sunya7a has quit [Ping timeout: 245 seconds]
spider-mario has quit [Remote host closed the connection]
<omosoj>
Quick q: is there a way to quickly add multiple values to an array with the '<<'? Like a=[]; a << 5, 6, 7
baweaver has quit [Remote host closed the connection]
michaeldeol has quit [Read error: Connection reset by peer]
cpruitt has quit [Quit: cpruitt]
x1337807x has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<omosoj>
And if not what's the simplest way to do that?
<workmad3>
omosoj: a << 5 << 6 << 7
michaeldeol has joined #ruby
agrinb has joined #ruby
<omosoj>
workmad3, haha, awesome!
<omosoj>
(thanks!)
debajit has quit [Client Quit]
saarinen has joined #ruby
<shevy>
happytux_ no
debajit has joined #ruby
<shevy>
webgen first off we must start with the little details
debajit has quit [Client Quit]
<shevy>
they are important
<shevy>
webgen, it is not argumenterror but ArgumentError
<shevy>
I used to do this in the past:
debajit has joined #ruby
<shevy>
begin
<shevy>
require 'yeah'
<shevy>
rescue Loaderror; end
<shevy>
and it failed!
<workmad3>
shevy: unknown constant? :D
duggiefresh has quit [Remote host closed the connection]
<shevy>
:(
<shevy>
I also used to do this:
<shevy>
class Foo
<shevy>
def intialize
<shevy>
and it failed!
beef-wellington has quit [Ping timeout: 264 seconds]
<webgen>
why ?
sinkensabe has joined #ruby
<shevy>
webgen, you need better eyes if you do not see ;)
<benzrf>
intialize
<shevy>
lol benzrf
<shevy>
webgen ok now that we fixed that first problem let's look at the second
<wallerdev>
i always screw up SQL typing SELECT * FORM abc
<wallerdev>
cant type the word from :|
* workmad3
wonders if newcomers to coding should be given 100 pages of printed sheets and told to find the mistake
XanderA has joined #ruby
<shevy>
webgen in your class, you simply: raise ArgumentError, 'wtf you stupid idiot, you must pass a non empty string to us!' if input.to_s.empty? # or similar
<XanderA>
ok
<webgen>
shevy deep thanks ! :D
<shevy>
man I hate sql queries
<webgen>
that was concise hahaha
cjsarette has quit [Excess Flood]
Striki has joined #ruby
<shevy>
select * from 'wtf"double quotes" shit yeah IF wtf ''" also insert utf strings here'
<shevy>
I think the only reason sql is so popular is because, in essence, it is primitive
asteros has quit [Quit: asteros]
<shevy>
lolquery would be more fun
saarinen has quit [Client Quit]
<shevy>
"gimme all tables start with ab"
creativeembassy has quit [Quit: FO SHO]
<shevy>
"gimme all tables start with ab less than 8 chars"
Megtastique has quit []
djbkd has quit [Remote host closed the connection]
michaeldeol has quit [Read error: Connection reset by peer]
jhass has quit [Read error: Connection reset by peer]
jxf has quit [Ping timeout: 240 seconds]
michaeldeol has joined #ruby
x1337807x has joined #ruby
saarinen has joined #ruby
terrellt has quit [Remote host closed the connection]
s2013_ has joined #ruby
<Rickmasta>
it's boggling my mind, when I do the css search, it just returns "<ul id="list"></ul>"
danshultz has quit [Remote host closed the connection]
thumpba has joined #ruby
cjsarette has joined #ruby
jjbohn has joined #ruby
<wallerdev>
mindbottling
danshultz has joined #ruby
Bumptious has joined #ruby
<Rickmasta>
lol
ascarter has joined #ruby
ascarter has quit [Max SendQ exceeded]
ascarter has joined #ruby
s2013 has quit [Ping timeout: 252 seconds]
<shevy>
I gave up on xml a long time ago
<shevy>
I am so glad to no longer have to use stuff like xpath
ldnunes has quit [Quit: Leaving]
jobewan has quit [Ping timeout: 265 seconds]
s2013_ is now known as s2013
asteros has joined #ruby
<omosoj>
Can a recursion mastermind help me out with this algorithm. It's prob 37 from Project Euler.
<omosoj>
I want to make a function that removes a digit from the left, then checks to see if prime; if prime, redoes the process until the entire integer is checked, then tell me if it was successful.
zeh- has joined #ruby
ktun has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
blackmesa has quit [Ping timeout: 264 seconds]
jhass|off has joined #ruby
jhass|off is now known as jhass
cpruitt has joined #ruby
Morkel has quit [Quit: Morkel]
<debajit>
is it general convention to write everything in snake_case in Ruby, or do people use camelCase as well?
combusean has joined #ruby
brtdv has quit []
<atmosx>
what are truncatable nubers?
<atmosx>
dachi: snakecase for methods camel-case for classes
<shevy>
your nick is a bit similar to "holz", german for wood/timber
amundj has joined #ruby
SCommette_ has joined #ruby
jhass has quit [Remote host closed the connection]
snuffeluffegus has quit [Quit: Leaving]
<RubyPanther>
read-only wood, does that mean a protected forest?
franzip has quit [Quit: ...]
SCommette has quit [Ping timeout: 252 seconds]
SCommette_ is now known as SCommette
<Hanmac>
maybe its some kind of unwritable paper? ;P
baweaver has quit [Ping timeout: 240 seconds]
diegoviola has quit [Quit: WeeChat 0.4.3]
saarinen has quit [Quit: saarinen]
<happytux_>
So I want to use File::SEPARATOR in a Rakefile. What do I have to do/require in order to use it? Because currently it is just empty (on the linux system it should be ':').
cescalante is now known as ce_afk
beef-wellington has quit [Ping timeout: 245 seconds]
chipotle has joined #ruby
garndt has quit [Quit: Connection closed for inactivity]
<Hanmac>
happytux_: i think you want the Path separator, not the other one
jhass|off is now known as jhass
beef-wellington has joined #ruby
danman has quit [Quit: danman]
freggles has quit [Remote host closed the connection]
Kricir has quit [Remote host closed the connection]
jessehs_ has joined #ruby
jessehs_ has left #ruby [#ruby]
Kricir has joined #ruby
<happytux_>
Hanmac: yes, this was it. Thanks
<shevy>
what is File::SEPARATOR on windows?
doodlehaus has quit [Remote host closed the connection]
phoo1234567 has quit [Read error: Connection reset by peer]
amundj has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
beef-wellington has quit [Ping timeout: 252 seconds]
<workmad3>
shevy: /
<slash_nick>
shevy: i tried it but got BSOD
Hanmac1 has joined #ruby
Burgestrand has quit [Quit: Burgestrand]
tylerkern has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<shevy>
hmm
relix has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<shevy>
when is File::SEPARATOR ever not '/' ?
phoo1234567 has joined #ruby
<workmad3>
shevy: it's not
<shevy>
I mean I saw people do this a lot:
<shevy>
File.join(File::SEPARATOR)
<shevy>
or similar
Kricir has quit [Ping timeout: 240 seconds]
<workmad3>
shevy: when I realised that the ruby File class transparently handles / to \ on windows, so you just use / all the time, I stopped doing stuff like 'File.join("foo", "bar", "buzz")' and instead just did 'foo/bar/buzz'
Hanmac has quit [Ping timeout: 252 seconds]
livcd has quit [Ping timeout: 264 seconds]
timonv has joined #ruby
omosoj has quit [Ping timeout: 240 seconds]
tkuchiki has joined #ruby
nowthatsamatt has quit [Quit: nowthatsamatt]
phutchins has quit [Ping timeout: 252 seconds]
razrunelord has quit [Remote host closed the connection]
<shevy>
yeah
<shevy>
it just makes me wonder why people kept on using the above so often
zigomir has quit [Remote host closed the connection]
mrmargolis has quit [Remote host closed the connection]
saarinen has joined #ruby
<Hanmac1>
shevy: in rubytrunk you can do this: Pathname.new("abc") / "def" / "xyz" => #<Pathname:abc/def/xyz>
meatherly has quit [Remote host closed the connection]
freerobby has joined #ruby
cjsarette has quit [Excess Flood]
<shevy>
I dont use pathname, it has an awful API
EagleDelta has quit []
zigomir has quit [Ping timeout: 255 seconds]
eka has joined #ruby
lw has quit [Quit: s]
fukuyamaken has quit [Read error: Connection reset by peer]
cpruitt has quit [Quit: cpruitt]
ffranz has quit [Quit: Leaving]
danijoo has quit [Quit: Leaving...]
fukuyamaken has joined #ruby
mary5030 has quit [Remote host closed the connection]
shashank_rs has quit [Read error: Connection reset by peer]
cjsarette has joined #ruby
saarinen has quit [Client Quit]
aiguu has joined #ruby
aspires has quit []
codeurge has quit [Ping timeout: 250 seconds]
cjsarette has quit [Max SendQ exceeded]
mjs2600 has quit [Remote host closed the connection]
freerobby has quit [Ping timeout: 245 seconds]
asteros has quit [Quit: asteros]
aiguu_ has quit [Ping timeout: 255 seconds]
cjsarette has joined #ruby
cjsarette has quit [Max SendQ exceeded]
maximski has joined #ruby
codeurge has joined #ruby
R3D5H311 has joined #ruby
jxf has joined #ruby
SegFaultAX has quit [Excess Flood]
aspires has joined #ruby
nwertman has quit [Quit: leaving]
blackmesa has joined #ruby
cjsarette has joined #ruby
djbkd has joined #ruby
cjsarette has quit [Max SendQ exceeded]
cjsarette has joined #ruby
chipotle has quit [Quit: cya]
SegFaultAX has joined #ruby
rsuey has quit [Remote host closed the connection]
Squarepy has quit [Quit: Leaving]
qwyeth has quit [Remote host closed the connection]
razrunelord has joined #ruby
cpruitt has joined #ruby
XanderA has quit [Quit: Leaving]
danijoo has joined #ruby
tjr9898 has joined #ruby
aspires has quit []
blackmesa has quit [Ping timeout: 240 seconds]
Xeago has quit [Ping timeout: 240 seconds]
EasyCo has joined #ruby
VTLob has quit [Quit: VTLob]
saarinen has joined #ruby
aspires has joined #ruby
nfk has quit [Quit: yawn]
Wolland has joined #ruby
Wolland has quit [Client Quit]
freezey has quit []
mary5030 has joined #ruby
happytux_ has quit [Ping timeout: 255 seconds]
nwertman has joined #ruby
ukd1 has quit [Quit: Leaving...]
maximski has quit []
<benzrf>
can you use something like '>= 2.1' in a ruby version in a gemfile
livcd has joined #ruby
<benzrf>
or does it have to be a precise versoin
<benzrf>
>.>
saarinen has quit [Client Quit]
<EasyCo>
Hey guys, can somebody please provide clarity on block as arguments. I'm obviously new to Ruby and am slightly confused with the syntax used when sending an argument and a block to a method: some_method arg1 do #stuff end
_Andres has quit [Quit: My Mac Pro has gone to sleep. ZZZzzz…]
agrinb has quit [Remote host closed the connection]
<EasyCo>
I just find it weird that the first argument and the block aren't seperated by a comma
<benzrf>
EasyCo: the block is a separate entity, syntactically
<EasyCo>
The same way you would if sending 2 args: some_method arg1, arg2
<benzrf>
foo() {block}
<benzrf>
^ not an argument in the list
blackmesa has joined #ruby
happytux has joined #ruby
<benzrf>
{|thing| that} <- this is NOT an expression
randomnick_ has quit [Quit: Leaving]
<benzrf>
it's a special syntactic thing that goes after an argument list
<EasyCo>
Right, so that's the actual syntax when wrapped
geggam has quit [Remote host closed the connection]
<EasyCo>
So foo(arg1, arg2) { block }
<EasyCo>
Is valid
<Rickmasta>
So I found out what was the issue with my nokogiri parse. I'm guessing because the content is loaded via jquery, it doesn't come up in the source.
<benzrf>
EasyCo: y
<EasyCo>
benzrf: Thanks for that, makes sense. Coming from JS and PHP it's a new syntax for me.
<benzrf>
ew, gross languages
<benzrf>
purge them from your brain before continuing !
mary5030 has quit [Remote host closed the connection]
<EasyCo>
Haha, I'd say different, not gross but yah :)
<Rickmasta>
Like so: http://cl.ly/VTRN When I inspect the element of the content I want to srape, it should be withiin the <ul id="list"></us> tags
voodoofish has joined #ruby
livcd has quit [Ping timeout: 245 seconds]
voodoofish1 has quit [Ping timeout: 264 seconds]
thesheff17 has quit [Ping timeout: 255 seconds]
agrinb has joined #ruby
jjbohn has quit [Ping timeout: 240 seconds]
AlexRussia has joined #ruby
andrewjanssen has quit [Quit: Leaving...]
momomomomo has joined #ruby
axl_ has quit [Quit: axl_]
binaryhat has joined #ruby
AlSquire has joined #ruby
axl_ has joined #ruby
blackmesa has quit [Ping timeout: 240 seconds]
saarinen has joined #ruby
axl_ has quit [Client Quit]
mansi has quit [Remote host closed the connection]
mansi has joined #ruby
saarinen has quit [Client Quit]
razrunelord has quit [Remote host closed the connection]
Kricir has joined #ruby
skinkitten has quit [Quit: Leaving]
andrewlio has quit [Quit: Leaving.]
mr_snowf1ake has joined #ruby
nateberkopec has quit [Quit: Leaving...]
dsdeiz_ has joined #ruby
agrinb has quit [Remote host closed the connection]
AlSquire has quit [Quit: Quitte]
AlSquire has joined #ruby
jahrichie has joined #ruby
dsdeiz has quit [Ping timeout: 245 seconds]
mansi has quit [Ping timeout: 240 seconds]
<_lazarevsky>
anyone here?
obs has quit [Quit: Saliendo]
aspires has quit []
newbabe has quit [Ping timeout: 240 seconds]
jxf has quit [Ping timeout: 258 seconds]
aspires has joined #ruby
DouweM has joined #ruby
djbkd has quit [Remote host closed the connection]
sdwrage has joined #ruby
<benzrf>
_lazarevsky: sup dude
elaptics`away is now known as elaptics
alpha123 has joined #ruby
<happytux>
hi again
snath has quit [Ping timeout: 255 seconds]
<_lazarevsky>
I was gonna ask whether I need to reload all rake tasks in order for the code changes to take effect, but it turns out the changes were not reflected because I changed a file name, but vim did not reload the file, so I kept making changes to a file that no longer exists.
<happytux>
So File.symlink is used to create a new symlink. Now I want that if there is already such a symlink, it is only overwritten whether it 1) is not a symlink at all or 2) points to another path than the newly created symlink would to.
<happytux>
What would be the easiest way?
<happytux>
I thought about somehow extracting the target path from the symlink and then comparing it, when it isn't a symlink at all, the thing would fail anyway.
Kricir has quit [Ping timeout: 265 seconds]
dideler has joined #ruby
tvw has quit []
hermanmu_ has quit [Remote host closed the connection]
treehug88 has quit []
djbkd has joined #ruby
ce_afk is now known as cescalante
hermanmunster has joined #ruby
<shevy>
happytux there is File.readlink
<shevy>
and File.exist?
mjsmith2 has joined #ruby
<shevy>
combine the two to check for equality or non-equality, and act on that outcome. it is really a simple if/else in the end, either your symlink exists, or it does not. and IF the symlink exists, you may have to add another check to test for equality
scotje has joined #ruby
<havenwood>
and File.symlink?
<havenwood>
though i don't get what the goal is
<shevy>
lol
iMe has quit [Quit: Bye Bye]
<shevy>
I think he wants to symlink something
einarj has quit [Remote host closed the connection]
<benzrf>
havenwood: parently lots of people do or why would we have module_function etc
<benzrf>
havenwood: gp
<havenwood>
shevy: if not just one method ^
<benzrf>
bbiab guise
<shevy>
havenwood yeah, I need to have it available as mixin but also standalone
wldcordeiro_work has quit [Read error: Connection reset by peer]
<havenwood>
shevy: extend self
thomasxie has joined #ruby
<shevy>
hmm
benzrf is now known as benzrf|offline
terrell_t has quit [Remote host closed the connection]
<shevy>
now I am a bit confused... why is there module_function? is that doing the same as extend self?
fantazo has quit [Ping timeout: 252 seconds]
<havenwood>
shevy: people use that to get the class instance method in the first place ^ (which i disagree with), but if you want both it is a good way
<havenwood>
shevy: a single method though
terrellt has joined #ruby
<havenwood>
one at a time versus in bulkl
<havenwood>
en masse
Joel has left #ruby ["Leaving"]
<shevy>
hehe
<shevy>
well those are mini modules
<shevy>
they have only two methods
terrellt has quit [Read error: Connection reset by peer]
terrellt has joined #ruby
<havenwood>
shevy: `extend self` at the top, done
kotk has joined #ruby
<shevy>
hmm
<shevy>
not at the bottom?
<havenwood>
shevy: top
<shevy>
hehe
<havenwood>
:P
djbkd has quit [Remote host closed the connection]
timonv has quit [Ping timeout: 240 seconds]
ss__ has quit [Ping timeout: 258 seconds]
kotk_ has quit [Ping timeout: 240 seconds]
diegoviola has quit [Quit: WeeChat 0.4.3]
dayepa has joined #ruby
<havenwood>
shevy: i vote `module_function` immediately below each method if cherry picking, otherwise `extend self` at the top of the module.
<shevy>
ok but is there a difference?
<shevy>
I mean these modules have basically just one method
dayepa has quit [Client Quit]
<shevy>
I am tempted to use module_function right after the end of the first method
dayepa has joined #ruby
<shevy>
module Foo; def foo;end; module_function :foo; end
scotje has left #ruby [#ruby]
<shevy>
that kinda seems more explicit to my eyes than extend self?
eka has quit [Quit: My computer has gone to sleep. ZZZzzz…]
<shevy>
oh well
momomomomo has quit [Quit: momomomomo]
codeurge has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
kenneth has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<shevy>
I just noticed
<shevy>
it is not the same
debajit has joined #ruby
<shevy>
module_function does not work in my example at all, but extend self does
kevind has quit [Quit: kevind]
<havenwood>
shevy: ah, interesting
<havenwood>
shevy: do you need the constants?
kenneth has joined #ruby
<shevy>
hmm which ones?
R3D5H311 has left #ruby ["Good day"]
<havenwood>
shevy: i haven't seen the code
<havenwood>
shevy: just assuming
<shevy>
nono it's really just basically one method, that gets wrapped into a module with the same name of that method, and then also gets a class method
<shevy>
so def foo becomes
<shevy>
module Foo; def foo; well, and now also extend self \o/ ; end
redondos has quit [Excess Flood]
<havenwood>
shevy: `extend self` is idiomatic in my opinion when that's actually what you're wanting to do
redondos has joined #ruby
<shevy>
yeah
<shevy>
now I need to find out when to use module_function
<havenwood>
i only dislike it when it's used to mean `class << self`, nasty to willy nilly expose methods ;P