<glaksmono>
anyone had experience with couchrest_model gem?
marcdel has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
siwica has quit [Ping timeout: 245 seconds]
ffranz has quit [Quit: Leaving]
mikeg has quit [Ping timeout: 240 seconds]
siwica has joined #ruby
mercwithamouth has quit [Ping timeout: 240 seconds]
Mars` has quit [Read error: Connection reset by peer]
DonRichie has quit [Read error: Operation timed out]
Mars` has joined #ruby
DonRichie has joined #ruby
Davey has joined #ruby
burlyscudd has joined #ruby
c0rn has quit [Quit: Computer has gone to sleep.]
fixl has joined #ruby
Mars` has quit [Ping timeout: 245 seconds]
Mars` has joined #ruby
Fire-Dragon-DoL has quit [Ping timeout: 248 seconds]
fourqqq has left #ruby [#ruby]
|PiP| has quit [Ping timeout: 240 seconds]
<havenwood>
Alth: times it by 2: n * 2
kaspergr_ has quit [Remote host closed the connection]
Travis-42 has joined #ruby
burlyscudd has quit [Ping timeout: 265 seconds]
lfox has joined #ruby
kaspergrubbe has joined #ruby
shanlar has quit [Quit: Be back later]
<havenwood>
Alth: (like you would in a calculator)
theRoUS has quit [Read error: Operation timed out]
jmkeyes has left #ruby [#ruby]
kaspergrubbe has quit [Ping timeout: 248 seconds]
aspires has joined #ruby
<Travis-42>
I have a hash of multiple hashes with x,y keys and want to find the first 3 with the lowest y values (and if the y values match, by lowest x value)
<Travis-42>
I've been trying to figure it out with min_by and sort_by, but am getting stuck. Any thoughts?
Fire-Dragon-DoL has joined #ruby
b1nd_ has joined #ruby
alx- has joined #ruby
stkowski has quit [Quit: stkowski]
Mars` has quit [Remote host closed the connection]
endash has quit [Quit: endash]
Mars` has joined #ruby
blischalk has joined #ruby
shanlar has joined #ruby
sdouglas has quit [Quit: sdouglas]
obs has quit [Quit: ChatZilla 0.9.87 [Iceape 2.7.12/20130119095535]]
Mars` has quit [Ping timeout: 248 seconds]
blackmesa has quit [Quit: WeeChat 0.4.1]
renderful has quit [Remote host closed the connection]
weeems has joined #ruby
siwica has quit [Ping timeout: 245 seconds]
weems has quit [Read error: Connection reset by peer]
asym has joined #ruby
monomyth has quit [Ping timeout: 248 seconds]
asteros has quit [Quit: asteros]
monomyth has joined #ruby
maletor has quit [Quit: Computer has gone to sleep.]
julweber_ has quit [Remote host closed the connection]
julweber_ has joined #ruby
aspires has quit [Quit: sudo making a sandwich]
julweber has quit [Ping timeout: 272 seconds]
brianpWins has joined #ruby
ephemerian has left #ruby [#ruby]
asteros has quit [Quit: asteros]
popl has quit [Read error: Operation timed out]
asteros has joined #ruby
orien has quit [Quit: Computer has gone to sleep.]
Mars` has joined #ruby
julweber_ has quit [Ping timeout: 240 seconds]
Jetchisel has left #ruby ["Unfortunately time is always against us -- *Morpheus*"]
duggiefresh has joined #ruby
leynos has quit [Quit: Off to dreams of Laserdiscs and Neo-Geos]
kaspergrubbe has quit [Ping timeout: 272 seconds]
aryaching_ has joined #ruby
asteros has quit [Quit: asteros]
Flashmasterson has joined #ruby
Gooder has joined #ruby
benlieb has joined #ruby
<Flashmasterson>
i'm trying to request information through irb by entering 'irb —simple-prompt' but i get this error: yntaxError: (irb):6: syntax error, unexpected unary-, expecting keyword_do or '{' or '('
<Flashmasterson>
irb --simple-prompt --rrbconfig
<Flashmasterson>
^
<Flashmasterson>
from /Users/toreystriffolino/.rvm/rubies/ruby-2.0.0-p247/bin/irb:16:in `<main>'
<Flashmasterson>
sorry, by entering *irb —simple-prompt rrbconfig'
musty has joined #ruby
rgbdev has quit [Quit: rgbdev]
aryaching has quit [Ping timeout: 240 seconds]
<Flashmasterson>
that's while i'm in irb though
xk_id has quit [Quit:
Mars` has quit [Remote host closed the connection]
duggiefresh has quit [Ping timeout: 272 seconds]
sdouglas has joined #ruby
Mars` has joined #ruby
drumsrgr8forn8 has quit [Remote host closed the connection]
Orez has left #ruby [#ruby]
drumsrgr8forn8 has joined #ruby
beilabs has quit [Ping timeout: 265 seconds]
b00stfr3ak has quit [Ping timeout: 272 seconds]
musty_ has joined #ruby
Mars` has quit [Ping timeout: 245 seconds]
Voodoofish430 has quit [Quit: Leaving.]
zzz_taion809 is now known as taion809
drumsrgr8forn8 has quit [Ping timeout: 240 seconds]
mfridh has quit [Read error: Connection reset by peer]
musty has quit [Read error: Connection reset by peer]
felixjet_ has joined #ruby
Xiti has quit [Read error: Connection reset by peer]
Xiti has joined #ruby
musty_ is now known as musty
xxpor has joined #ruby
sepp2k1 has quit [Quit: Leaving.]
jrhe has quit [Quit: jrhe]
burlyscudd has joined #ruby
felixjet has quit [Ping timeout: 248 seconds]
kazuuu has quit [Remote host closed the connection]
kazuuu has joined #ruby
theRoUS has joined #ruby
yano has quit [Ping timeout: 624 seconds]
whunt has quit [Quit: Computer has gone to sleep.]
heidi has quit [Quit: Leaving.]
jrhe has joined #ruby
burlyscudd has quit [Ping timeout: 248 seconds]
beilabs has joined #ruby
musty_ has joined #ruby
kazuuu has quit [Ping timeout: 265 seconds]
julweber has joined #ruby
musty has quit [Read error: Connection reset by peer]
Guest__ has joined #ruby
soheil_ has quit [Remote host closed the connection]
<Flashmasterson>
'the well-grounded rubyist' is showing me the names and functions of some ruby files, but i can't see where it explains how to open them
<Flashmasterson>
in the ruby directory
musty_ has quit [Ping timeout: 248 seconds]
soheil has joined #ruby
jkline has joined #ruby
Soda has quit [Read error: Connection reset by peer]
soheil has quit [Remote host closed the connection]
jrhe has quit [Quit: jrhe]
axsuul has joined #ruby
sdouglas has quit [Quit: sdouglas]
tharindu has joined #ruby
guns has joined #ruby
randomnick_ has quit [Remote host closed the connection]
jkline has quit [Client Quit]
jalcine_ is now known as jalcine
mva3212 has joined #ruby
julweber has quit [Ping timeout: 248 seconds]
Guest__ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Travis-42 has left #ruby [#ruby]
jalcine is now known as jalcine_
preller has quit [Ping timeout: 240 seconds]
finnomenon has quit [Ping timeout: 248 seconds]
jonahR has joined #ruby
finnomenon has joined #ruby
preller has joined #ruby
<havenwood>
Flashmasterson: it is two dashes: irb --simple-prompt
<havenwood>
Flashmasterson: Usually you open a Ruby file with a text editor, is that what you mean?
<Flashmasterson>
havenwood: ah, it showed as a single line on here (before 'simple'), and i guess that's what i mean - i'm very new to this
DrShoggoth has quit [Ping timeout: 260 seconds]
T__T has quit [Remote host closed the connection]
amacgregor_ has joined #ruby
<Flashmasterson>
havenwood: so i'm unsure about how to get cgi.rb for example, to open it's innards and let me study it's coding
T__T has joined #ruby
amacgregor has quit [Ping timeout: 265 seconds]
pwh has quit []
dhruvasagar has quit [Read error: Operation timed out]
mrsolo has quit [Quit: This computer has gone to sleep]
pwu has joined #ruby
duggiefresh has joined #ruby
DanBoy has joined #ruby
fuhgeddaboudit has joined #ruby
narcan has quit [Quit: -[AppDelegate installMalware]: unrecognized selector sent to instance 0x156109c0]
<Flashmasterson>
havenwood: without the use of Finder or anything but my terminal/text editor
<Flashmasterson>
*or text editor
T__T has quit [Remote host closed the connection]
preller has quit [Ping timeout: 240 seconds]
devoldmx3 has joined #ruby
devoldmx has quit [Ping timeout: 248 seconds]
<DanBoy>
you get iterm2 yet Flashmasterson
hamakn has joined #ruby
<Flashmasterson>
DanBoy: shit, no - is it free? i just have the first one
<DanBoy>
try using it in full screen and swipe between desktops to get to it
<DanBoy>
much faster
<it_tard>
if i want to evaluate some expression and increment a variable that would carry over to the next time it's called (a lambda?) then how do i do that
<heftig>
no need for closures; you could store state in an object
<Flashmasterson>
DanBoy: man since mountain lion made that hard to do, i used to just be able to swing my four fingers left or right to get that - how is it done now?
<DanBoy>
just three finger swipe
<DanBoy>
im on lion though but im sure it hasn't changed
bradhe has quit [Remote host closed the connection]
pwu has quit [Quit: Leaving]
kaspergrubbe has joined #ruby
<DanBoy>
i keep sublime and the terminal in full screen and swipe back and forth
bradhe has joined #ruby
<DanBoy>
and one screen for the book if your using an ebook
<DanBoy>
three fingers upward should show you all your desktops
<it_tard>
heftig, but how do i pass it to the block?
<DanBoy>
and three fingers left/right swaps
mercwithamouth has joined #ruby
<it_tard>
30.times {if arr[p rand 5] counter=counter+1} #counter is left untouched
<it_tard>
wait
<it_tard>
worse, irb itself is derping at the code
<Flashmasterson>
yeaah that's the one i want DanBoy how is it named in your system preferences? i
<Flashmasterson>
'll try to find it
<it_tard>
oops, where did that p come from
<DanBoy>
you mean in the applications list?
<DanBoy>
or the swipe config
<DanBoy>
i don't think i had to change anything there
<DanBoy>
i keep it like this
aspires has joined #ruby
cathyquack has joined #ruby
renderful has quit [Remote host closed the connection]
<DanBoy>
main desktop -> book -> sublime -> terminal
<it_tard>
i can't believe i have forgotten how to do control logic in ruby again
radic_ has joined #ruby
radic has quit [Disconnected by services]
<DanBoy>
and of course spotify :D at the end is optional
<cathyquack>
hi
<DanBoy>
yo
mercwithamouth has quit [Read error: Operation timed out]
<Flashmasterson>
DanBoy: haha yeah. nah i mean how is it named in system preferences/track pad/gestures or whatever yours is called
<cathyquack>
is this an appropriate channel for rails talk?
preller has joined #ruby
<DanBoy>
i don't know but you shouldn't have to change anything there
<DanBoy>
three swipes upward will show you your desktops and you can add them
<Flashmasterson>
fuckin' mountain lion...
<it_tard>
cathyquack, no
<DanBoy>
should be a plus button to the right
bradhe has quit [Ping timeout: 272 seconds]
<cathyquack>
ok. thanks.
<Flashmasterson>
oh oh
<it_tard>
cathyquack, have you tried #RubyOnRails ?
<DanBoy>
you need to be registered for that chan
<cathyquack>
i was just looking for the right channel. thanks
mmitchell has joined #ruby
<Flashmasterson>
DanBoy: the only thing i see with a plus button, is on the bottom left and in the wondow that the F4 button brings - with the widgets
Vivekananda_ has quit [Quit: Leaving]
b1nd_ has quit [Quit: Leaving]
<DanBoy>
you need to hover up near the top right
<DanBoy>
after three swipes upward
<DanBoy>
by default you should see like 4 desktops
<DanBoy>
if you hover your mouse in the upper right you'll see a plus button
guns has quit [Quit: guns]
<DanBoy>
if you install iterm2 and set it full screen it'll use its own desktop anyway though you shouldn't need to create one
<Flashmasterson>
DanBoy: hahhaha wow. what a trip
<DanBoy>
same with sublime
Jdubs_ has joined #ruby
burlyscudd has joined #ruby
reppard has joined #ruby
mmitchell has quit [Ping timeout: 265 seconds]
<Flashmasterson>
DanBoy: so you suggest assigning each of those things you listed to a different desktop, then switch between using the three-fingers-up method?
<DanBoy>
yes highly
Mars` has joined #ruby
<DanBoy>
i mean swipe right or left with 3 fingers
<DanBoy>
three up just shows you them
reppard has quit [Client Quit]
drumsrgr8forn8 has joined #ruby
<DanBoy>
and lets you drag apps to other desktops
<DanBoy>
your using an ebook right?
Jdubs has quit [Ping timeout: 248 seconds]
<Flashmasterson>
no ebook, paper on my desk
<Flashmasterson>
so sublime text2 > iterm2 > adium > itunes
<DanBoy>
just give sublime and iterm full screen though
<Flashmasterson>
cool and we can choose different wallpaper for each.
<Flashmasterson>
ooh
Mars` has quit [Ping timeout: 272 seconds]
theRoUS has quit [Ping timeout: 245 seconds]
drumsrgr8forn8 has quit [Ping timeout: 272 seconds]
<Flashmasterson>
alright i got it
<Flashmasterson>
so ruby question:
aep has quit [Ping timeout: 248 seconds]
<Flashmasterson>
i want to check out the Ruby code of cgi.rb but don't see instructions on how to bring it up through the terminal, just finder… which i can't find using; ironically
<it_tard>
if i wasn't so tired, i'd check if i'm doing it correctly
aep has joined #ruby
Mars` has joined #ruby
danshultz has joined #ruby
<Flashmasterson>
DanBoy: me?
<DanBoy>
type "pwd" for me
<DanBoy>
ya
<DanBoy>
without the quotes
<DanBoy>
and show me
<Flashmasterson>
it said: /users/toreystriffolino/desktop/rubystuf/rubysamplecode"
kaspergrubbe has quit [Read error: Connection reset by peer]
<Flashmasterson>
sorry * /rubystuff
kaspergrubbe has joined #ruby
ewnd9 has joined #ruby
<DanBoy>
on your mac to copy and paste easily just highlight your text and hit command -> C and command -V to paste
lusory has joined #ruby
<DanBoy>
ok so now type
<Flashmasterson>
yeah i did that but adium said the irc couldn't read it
<Flashmasterson>
or it "received a message it did not understand"
<DanBoy>
ok so you can't find this file right
tharindu has quit [Quit: Leaving...]
<Flashmasterson>
right
<DanBoy>
try this
<Flashmasterson>
but i have ruby.2.0.0.
threesome has quit [Ping timeout: 248 seconds]
<DanBoy>
ls -al | grep -i cgi.rb
<DanBoy>
you should make a Projects directory to work in
soheil has joined #ruby
<DanBoy>
not on the desktop
jonathanwallace has joined #ruby
<Flashmasterson>
i have that but it's in a folder in the desktop, that should be ok right?
<DanBoy>
it'll work
benlieb has quit [Quit: benlieb]
<DanBoy>
for now i guess
kaspergrubbe has quit [Remote host closed the connection]
<Flashmasterson>
ok i got this Macintosh:rubysamplecode toreystriffolino$ ls -al | grep -i cgi.rb
<Flashmasterson>
-rw-r--r-- 1 toreystriffolino staff 0 Oct 18 21:59 cgi.rb
<DanBoy>
there you
<DanBoy>
its in that directory
<DanBoy>
you wanna see whats in it?
<Flashmasterson>
yeah
<DanBoy>
cat cgi.rb
benlieb has joined #ruby
<Flashmasterson>
'cat' stands for categorize ?
<DanBoy>
or load it up in sublime if you have that yet
<DanBoy>
i dunno is been like 14 years i forgot what it stands for :P
<Flashmasterson>
ah. ok i tried loading cgi.rb and it just pulled up a black file
<DanBoy>
do you have sublime?
<Flashmasterson>
yeah sublime text 2
soheil has quit [Ping timeout: 240 seconds]
<DanBoy>
i would load it up in sublime verses the terminal
<Flashmasterson>
because it's easier to read?
tjad has joined #ruby
danshultz has quit [Remote host closed the connection]
<DanBoy>
ya
danshultz has joined #ruby
<Flashmasterson>
ok i tried doing that but cgi.rb is just a blank file
<Flashmasterson>
when it loads into sublime
<DanBoy>
you should make a directory to work out of for the remainder of the book
<DanBoy>
ok run
<DanBoy>
cat cgi.rb | wc -l
<Flashmasterson>
the number 0 appeared
<DanBoy>
its blank then
<DanBoy>
or empty
<Flashmasterson>
hmm
<Flashmasterson>
i'm confused
tjad has quit [Ping timeout: 240 seconds]
<Flashmasterson>
it says "tools to facilitate CGI programming"
<DanBoy>
whered you get that file
jackjackdrpr has quit [Quit: Leaving.]
<Flashmasterson>
apparently i created it
danshultz has quit [Ping timeout: 245 seconds]
<Flashmasterson>
but black says it comes with ruby when we install it
<Flashmasterson>
the standard library subdirectory
<Flashmasterson>
for Ruby
aspires has quit [Quit: sudo making a sandwich]
<DanBoy>
type
<DanBoy>
which ruby
mercwithamouth has joined #ruby
<DanBoy>
dude you just got an empty file there
<Flashmasterson>
2.0.0.
<Flashmasterson>
i know that's why i'm confused
Mars` has quit [Remote host closed the connection]
<DanBoy>
well you gotta put some code in it
<Flashmasterson>
so this is what he says about it:
Mars` has joined #ruby
Shidash1 has joined #ruby
petey_ has joined #ruby
Shidash has quit [Read error: Connection reset by peer]
<DanBoy>
when you say 'black' you mean the author right
<Flashmasterson>
yeah
<DanBoy>
ok
kcin has joined #ruby
aspires has joined #ruby
maycon has quit [Ping timeout: 272 seconds]
<Flashmasterson>
Section 1.2.1 The Ruby standard library subdirectory.In rubylibdir, you'll find program files written in Ruby. These files provide standard library facilities, which you can require from your own programs if you need the functionality they provide
<Flashmasterson>
Here's a sampling of the files you'll find in this directory:
<Flashmasterson>
and the first one he lists is cgi.rb
<Flashmasterson>
it's function being "Tools to facilitate CGI programming"
it_tard has quit [Quit: yawn]
petey_ has quit [Remote host closed the connection]
<DanBoy>
ya im guessing hes telling you about some libraries
heidi has quit [Quit: Leaving.]
<DanBoy>
if you wanted to do cgi coding you could "require" them
petey_ has joined #ruby
lfox has joined #ruby
<Flashmasterson>
well i just wanna see the Ruby code for any of the files he lists as samples of that directory
havenwood has quit [Remote host closed the connection]
<Flashmasterson>
to study and compare with the little that i already know
Mars` has quit [Ping timeout: 272 seconds]
<DanBoy>
type
benlieb has quit [Quit: benlieb]
<DanBoy>
ls -al | grep -i rubylibdir
<DanBoy>
did you download the source code for the book somewhere
shanlar- has joined #ruby
heidi has joined #ruby
heidi has quit [Client Quit]
shanlar has quit [Ping timeout: 248 seconds]
tjad has joined #ruby
ravster has quit [Quit: Leaving.]
<Flashmasterson>
well he assumes that i have ruby downloaded already
<Flashmasterson>
and i got this btw "Macintosh:rubysamplecode toreystriffolino$ ls -al | grep -i rubylibdir
devoldmx has quit [Read error: Connection reset by peer]
havenwood has joined #ruby
mmitchell has joined #ruby
duggiefresh has quit [Remote host closed the connection]
mmitchel_ has joined #ruby
mmitchell has quit [Ping timeout: 272 seconds]
pwh has quit []
sayan has joined #ruby
orien has quit []
end_guy has joined #ruby
deens has quit [Remote host closed the connection]
pwh has joined #ruby
mklappstuhl has joined #ruby
aspires has joined #ruby
<robert_>
so I'm going to be working with large lists of data. of like, 6,000+ items in a hash and repetitively looking to see if a specific value is in the list, in the hopes that it is unique.. would it be a good idea to use Ruby to do this?
<robert_>
or should I use another language?
alexju has joined #ruby
<havenwood>
robert_: Ruby is plenty capable in that regard, use away.
<robert_>
okay. so what about generating an entry that would be unique in said list?
<robert_>
it's going back into a database
<robert_>
and has anybody here used gearman-ruby?
kazuuu has quit [Remote host closed the connection]
kazuuu has joined #ruby
sevenseacat has left #ruby [#ruby]
jbpros has joined #ruby
maz-dev has joined #ruby
heidi has joined #ruby
dhruvasagar has joined #ruby
kazuuu has quit [Ping timeout: 272 seconds]
aspires has quit [Quit: sudo making a sandwich]
asteros has joined #ruby
<havenwood>
robert_: I've never heard of gearman. It handles workers/jobs? The usually tools I'd think of in that arena are sidekiq or resque. I've heard good things about beanstalkd too.
<Xeago>
instead of specifying a finite list of characters not allowed
dzhulk1 has quit [Ping timeout: 248 seconds]
<sevenseacat>
+1 to whitelisting not blacklisting
Davey has quit [Quit: Computer has gone to sleep.]
mobileblue has quit [Read error: Connection reset by peer]
<weeb1e>
I decided to use foreman for starting/stopping two applications which make up a part of one of my services, and the one thing it should actually do (making sure there are never any zombie processes), it fails to accomplish a large percentage of the time
dzhulk has joined #ruby
einarj has quit [Ping timeout: 248 seconds]
<weeb1e>
When one of the two applications quit, it says "sending SIGTERM to all processes" and then exits, but more than half of the time it leaves unicorn running along with its workers, so I have to keep finding its PID and manually killing it before I can start foreman again else unicorn fails to bind to the port which kills my other process
yxhuvud has joined #ruby
<weeb1e>
Anyone know if foreman can be fixed easily, or should I just roll my own solution, which I am not feeling I should have done from the start :/
zz_michael_mbp is now known as michael_mbp
AndChat| has joined #ruby
mary5030 has quit [Remote host closed the connection]
io_syl has joined #ruby
hugohagogo has quit [Ping timeout: 272 seconds]
mary5030 has joined #ruby
mojjjo has quit [Ping timeout: 256 seconds]
monkegjinni has joined #ruby
hugohagogo has joined #ruby
Clooth has joined #ruby
Banistergalaxy has quit [Ping timeout: 256 seconds]
stayarrr has joined #ruby
timonv has quit [Remote host closed the connection]
banghouse has quit [Read error: Connection reset by peer]
timonv has joined #ruby
jbpros has quit [Quit: jbpros]
<shevy>
Xeago would you use .include? or would you omit it in the example above?
mary5030 has quit [Ping timeout: 265 seconds]
monkegjinni has quit [Ping timeout: 248 seconds]
monkegjinni has joined #ruby
udon has joined #ruby
timonv has quit [Ping timeout: 256 seconds]
Banistergalaxy has joined #ruby
AndChat- has joined #ruby
dhamidi has joined #ruby
schaerli has quit [Remote host closed the connection]
drumsrgr8forn8 has quit [Remote host closed the connection]
schaerli has joined #ruby
AndChat| has quit [Ping timeout: 272 seconds]
drumsrgr8forn8 has joined #ruby
drumsrgr8forn8 has quit [Read error: Connection reset by peer]
drumsrgr8forn8 has joined #ruby
<apeiros>
shevy: include? just adds unecessary overhead
<shevy>
ok
<apeiros>
both include? and delete have to iterate the whole string in the case of nothing being present
Banistergalaxy has quit [Ping timeout: 272 seconds]
einarj has joined #ruby
hugohagogo has quit [Ping timeout: 272 seconds]
hugohagogo has joined #ruby
jbpros has joined #ruby
schaerli has quit [Ping timeout: 272 seconds]
xlogic has joined #ruby
bradhe has joined #ruby
OdNairy has quit [Ping timeout: 272 seconds]
einarj has quit [Remote host closed the connection]
<krz>
i have the following string "foo bar [first_name] baz lorem [last_name] ipsum [first_name]". whats an efficient way to count how many times [first_name] and [last_name] are in the string?
jnoob22_ has quit [Ping timeout: 252 seconds]
astrobunny has joined #ruby
<krz>
i can split(' ') then each
<apeiros>
use scan and a counting hash
<krz>
is there something better?
<sevenseacat>
ive used the split/count method before
Banistergalaxy has joined #ruby
<apeiros>
counts = Hash.new 0; str.scan(/\[(?:first_name|last_name)\]/).each do |occurrence| counts[occurrence] += 1 end
<apeiros>
err
<apeiros>
drop the each
<apeiros>
just: counts = Hash.new 0; str.scan(/\[(?:first_name|last_name)\]/) do |occurrence| counts[occurrence] += 1 end
hugohagogo has quit [Ping timeout: 240 seconds]
deepender has joined #ruby
relix has joined #ruby
kh019267 has joined #ruby
AndChat- has quit [Ping timeout: 272 seconds]
ce_afk is now known as cescalante
<apeiros>
weee, primitive incarnation of my EPT C parser is viable
<Xeago>
what is ept?
<kh019267>
I'm trying to convert unix time into the day, month, year, etc using the following 2 lines: event_time = event["clock"].to_i(16) AND event_time = Time.at(event_time).strftime("%m/%d/%Y %H:%M:%S"). Doing this, the Month, Day and Year are way off. I'm getting something like this "02/07/4625" for today. Thoughts?
<apeiros>
don't say first_name/last_name when it's really screen_name
<krz>
whops
<apeiros>
d'uh
<krz>
wait
<krz>
typo
<apeiros>
or say data between [] is dynamic
tkuchiki_ has joined #ruby
S0da has joined #ruby
ssmithstone has quit [Ping timeout: 256 seconds]
<kh019267>
apeiros: yeah, the following works correctly but only get UTC time so would like to use the Time class: DateTime.strptime(event_time, '%s').to_datetime.strftime("%m/%d/%Y %H:%M:%S")
tkuchiki has quit [Read error: Connection reset by peer]
<apeiros>
then you can replace the (?: … ) expression with \w* or \w+ (or whatever quantifier pleases you)
<krz>
apeiros: thanks
pwh has joined #ruby
<apeiros>
yw
hugohagogo has joined #ruby
<udon>
#openhatch
rahulkmr has joined #ruby
nateberkopec has joined #ruby
AndChat| has joined #ruby
havenwood has joined #ruby
Soda has quit [Ping timeout: 272 seconds]
drumsrgr8forn8 has quit [Remote host closed the connection]
Banistergalaxy has quit [Ping timeout: 240 seconds]
coderhs has quit [Quit: Leaving]
cescalante is now known as ce_afk
Clooth has quit [Quit: Leaving...]
thesheff17 has joined #ruby
<kh019267>
aperios…looks like the conversion from the string to integer"(event_time = event["clock"].to_i(16)" is the issue. DateTime works because it accepts a string
zarubin has joined #ruby
siwica has joined #ruby
<kh019267>
Thoughts on a better way to convert that
boxmein has quit [Ping timeout: 245 seconds]
<apeiros>
kh019267: got a sample value of event["clock"]? along with a sample datetime?
carraroj has quit [Ping timeout: 272 seconds]
alx- has quit [Quit: Leaving...]
<apeiros>
kh019267: also - use tab completion for nicks. avoids misspellings like aperios
<kh019267>
This is an example event time: 1382120466 which is a string but when doing to_i(16), I'm getting 83786597478
vlad_starkov has joined #ruby
<apeiros>
um, why on earth do you use to_i(16)?
<apeiros>
16 is the base, this is not a hex…
ravster has joined #ruby
<kh019267>
apeiros - sorry for the misspelling and thanks for the tip
jbpros has quit [Ping timeout: 240 seconds]
vlad_starkov has quit [Remote host closed the connection]
Macaveli has quit [Quit: Computer has gone to sleep.]
Spami has joined #ruby
ssmithstone has joined #ruby
user258467 has joined #ruby
mengu has joined #ruby
udon has joined #ruby
osvico has joined #ruby
ChronocityLC has joined #ruby
<shevy>
pen if you stick to ruby for a longer while, start making gems as soon as possible
julian-delphiki has joined #ruby
<pen>
shevy: but I don't know what to do
swordsmanz has quit [Quit: swordsmanz]
<pen>
shevy: so I am reading other's gem to get some inspirations
wallerdev has quit [Quit: wallerdev]
volty has joined #ruby
zarubin has joined #ruby
<havenwood>
pen: I use bundler and `bundle gem gem_name_here` to create a gem. You can create gems you don't push to RubyGems too (pushing em out to the world is a choice).
<shevy>
pen what helped me decide on what to do was to start a todo file
<shevy>
things that I want to do
<shevy>
and from this, things create kind of itself
ssmithstone has quit [Ping timeout: 256 seconds]
<pen>
shevy: k, I will try that
bean has quit [Ping timeout: 240 seconds]
amacgregor__ has quit [Quit: Leaving]
astrobun_ has joined #ruby
amacgregor has joined #ruby
burlyscudd has joined #ruby
bean has joined #ruby
julian-delphiki has quit [Ping timeout: 256 seconds]
Guest__ has joined #ruby
Guest__ is now known as Alc
Alc is now known as Alleh
S0da has quit [Read error: Connection reset by peer]
drumsrgr8forn8 has joined #ruby
Evixion has joined #ruby
m_3 has joined #ruby
drumsrgr8forn8 has quit [Read error: Connection reset by peer]
|PiP| has joined #ruby
astrobunny has quit [Ping timeout: 272 seconds]
drumsrgr8forn8 has joined #ruby
Guest79191 is now known as mumblerit
boxmein has joined #ruby
burlyscudd has quit [Ping timeout: 265 seconds]
endash has joined #ruby
pirelenito has quit [Quit: pirelenito]
ewnd9 has quit [Ping timeout: 245 seconds]
lkba has quit [Read error: Connection reset by peer]
lkba has joined #ruby
nateberkopec has quit [Quit: Leaving...]
jibi has joined #ruby
<havenwood>
pen: a few more you might wanna follow: banister, rkh, nahi, and of course matz
Emmanuel_Chanel has joined #ruby
<pen>
havenwood: I thought matz is working in C?
wesside has joined #ruby
<havenwood>
mruby
mercwithamouth has quit [Ping timeout: 272 seconds]
<havenwood>
but yeah, his commits are mostly in C
<havenwood>
pen: know what mruby is?
<pen>
havenwood: kinda
habanany has joined #ruby
schaerli has quit [Remote host closed the connection]
<pen>
havenwood: cool, those are the authors of some famous gems :O
Emmanuel_Chanel has quit [Ping timeout: 272 seconds]
kh019267 has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Emmanuel_Chanel has joined #ruby
<shevy>
he is like a detective
<shevy>
I am slowly but surely getting scared
kh019267 has joined #ruby
AlSquire has quit [Quit: This computer has gone to sleep]
<pen>
shevy: yea, I wonder when could I even get a gem pushed out, all those famous people and gems man :S
astrobunny has joined #ruby
ewnd9 has joined #ruby
<pen>
havenwood: you follow them all as well?
<havenwood>
pen: i basically read you my following list
<pen>
havenwood: hehe
<havenwood>
and then a few more i realized i wasn't following
mojjjo has joined #ruby
zerun0 has quit [Ping timeout: 272 seconds]
AlSquire has joined #ruby
mercwithamouth has joined #ruby
indigo has joined #ruby
zerun0 has joined #ruby
|jemc| has joined #ruby
<krz>
i got the following string. str="aaa [first_name] bar [first_name] [last_name]". each character in the string is counted as 1.[first_name] is equivalent to 15. and [last_name] to 10. whats the best way to parse through this?
ewnd9 has quit [Remote host closed the connection]
<pen>
krz: regular expression?
ewnd9 has joined #ruby
<krz>
basically with the given string. it needs to return: 50
netQT_ has quit [Remote host closed the connection]
<Flashmasterson>
i'm trying to open 'loaddemo.rb' in sublime but it can't find it, even though i have 2.0.0 with it's gems installed
mixel has quit [Quit: mixel]
bradhe has joined #ruby
einarj has joined #ruby
<shevy>
and where from does this file loaddemo.rb come?
<havenwood>
Flashmasterson: Sublime is likely using a different Ruby than you intend.
<Flashmasterson>
shevy: 'the well-grounded rubyist' doesn't say, so i'm just searching .rvm and all it's contents
<Flashmasterson>
havenwood: hmm.. so how do i make it default to 2.0.0?
theKayhan has joined #ruby
|PiP| has quit [Ping timeout: 240 seconds]
alx- has joined #ruby
orionstein is now known as orionstein_away
mengu__ has joined #ruby
T__T has quit [Remote host closed the connection]
yano has joined #ruby
<havenwood>
Flashmasterson: I don't use Sublime, but if i recall you can set the Ruby in your env var preferences, or here it suggests editing a file: https://coderwall.com/p/4-hzwq
mengu has quit [Ping timeout: 272 seconds]
<havenwood>
Flashmasterson: Basically you point Sublime to RVM Ruby instead of system Ruby.
danshultz has joined #ruby
<havenwood>
~/.rvm/bin/rvm-auto-ruby
bradhe has quit [Ping timeout: 265 seconds]
<havenwood>
^ is what to point it at
<|jemc|>
you can create your own "build system" and dump it in the user packages folder to change how it runs your file
<Flashmasterson>
havenwood: thanks - having trouble finding env var preferences, keeping in mind that you don't use sublime 2
<|jemc|>
although, the default ruby build system should work for you if typing `which ruby` at a shell prompt returns your desired ruby
<havenwood>
Flashmasterson: Listed to |jemc| not me, i don't even use Sublime.
<havenwood>
Listen**
<|jemc|>
what do you get when you type `which ruby` at a shell prompt?
theKayhan_ has joined #ruby
taion809 is now known as zzz_taion809
drumsrgr8forn8 has joined #ruby
<|jemc|>
(keeping in mind that I use sublime text, but not rvm =P)
boxmein has quit [Ping timeout: 272 seconds]
<havenwood>
i use TM2 and chruby, so not even a single hit! :P
ioNull has joined #ruby
<|jemc|>
heheh
<havenwood>
i've only poked around with ST2, but i like the whole-file-overview thingy, kinda neat
<havenwood>
or is it ST3 now?
monkegjinni has quit [Remote host closed the connection]
<|jemc|>
3 is technically beta, but everyone I know is using it
<shevy>
|jemc|, I get /System/Executables/ruby
monkegjinni has joined #ruby
<Flashmasterson>
havenwood: shoot
T__T has joined #ruby
<krz>
havenwood: gimme a sec
theKayhan has quit [Ping timeout: 272 seconds]
<|jemc|>
shevy: whup? are you having the same issue, or are you trying to say that's what Flashmasterson should see?
<pen>
VIM all the way
<Flashmasterson>
ok so still wondering how i can find and open loaddemo.rb. it's not appearing as an option even when i un-hide hidden files
<shevy>
|jemc| sorry, I misread earlier
theKayhan_ has quit [Remote host closed the connection]
<shevy>
Flashmasterson where is the file!
einarj has quit [Remote host closed the connection]
<shevy>
find waldo
<|jemc|>
pen: I recently converted a vim friend of mine to sublime text when I should him the 'Vintage' package, which provides a good chunk of the vim keys for ST
nouitfvf has joined #ruby
<|jemc|>
he says what converted him is how much easier it is to write extensions for ST
<pen>
|jemc|: but vintage can only do so much, also the response time is very slow in vintage mode
<pen>
|jemc|: ST?
Dreamer3 has quit [Quit: Leaving...]
<|jemc|>
understandable; hey, go with what you love
<krz>
i works at the moment. returns 50 as the length
<Flashmasterson>
shevy: don
<Flashmasterson>
shevy: i don
<pen>
|jemc|: yea, that's possibly a good point, because I am struggling to learn vimscript to write an extension for vim
<Flashmasterson>
t know ! haha
pwh has quit []
monkegjinni has quit [Ping timeout: 248 seconds]
<shevy>
lol
<shevy>
but Flashmasterson
<|jemc|>
pen: sublime text extensions are basic python, although much of the functionality can be changed with json files
lurch_ has quit [Quit: lurch_]
banisterfiend has quit [Quit: Computer has gone to sleep.]
<shevy>
you need the file apparently for a tutorial
<Flashmasterson>
shevy: i'm using the well-grounded rubyist to learn everything but neglects to mention the specific folder for this file
<Flashmasterson>
shevy: i do
<shevy>
well, how are you supposed to find out where that .rb file is then?
gja has joined #ruby
gja has quit [Remote host closed the connection]
<pen>
|jemc|: how about ruby? is it possible to write in ruby?
<Flashmasterson>
shevy: hell if i know, he just mentions the ruby standard library
banisterfiend has joined #ruby
<|jemc|>
pen: you'd need to write some kind of compatibility layer- I don't know if one already exists
monkegjinni has joined #ruby
<havenwood>
Flashmasterson: what file are you looking for? use `mdfind -name` or `locate`?
<|jemc|>
pen: but ST runs on python internally, so that's why python extensions are natural for it
Xeago has joined #ruby
<krz>
havenwood: ideas?
zengfb has quit [Ping timeout: 272 seconds]
<havenwood>
krz: okay, so you want to add 15 for each first and 10 for each last plus 1 for each remaining character in the string?
<shevy>
Flashmasterson I don't think the ruby standard library has that file
<|jemc|>
pen: I've been working on a couple extensions and I'm struggling to remember not to write ruby in my python code - I haven't really had to use python since my ruby 'baptism'
<Flashmasterson>
[jemc] ok thanks
<krz>
havenwood: yeap, +1 also or spaces
<krz>
just to be clear
ssmithstone has joined #ruby
<krz>
havenwood: i updated the gist with comments
<pen>
|jemc|: yea, that happens to me sometimes when I'm doing python projects
dv__ has joined #ruby
<pen>
krz: I added comments to your gist
<krz>
havenwood: currently looks like php. im sure i can write this better in ruby
<|jemc|>
pen: I also have to remember to stay away from meta magic - python doesn't take as kindly to it as ruby
<Flashmasterson>
|jemc|: ok i got this sage: mdfind [-live] [-count] [-onlyin directory] [-name fileName | -s smartFolderName | query]
dv_ has quit [Ping timeout: 245 seconds]
<Flashmasterson>
list the files matching the query
<Flashmasterson>
-live Query should stay active
<Flashmasterson>
query can be an expression or a sequence of words
<Flashmasterson>
-count Query only reports matching items count
<Flashmasterson>
-onlyin <dir> Search only within given directory
lsmola has quit [Ping timeout: 272 seconds]
<Flashmasterson>
-name <name> Search on file name only
<Flashmasterson>
-s <name> Show contents of smart folder <name>
<Flashmasterson>
-0 Use NUL (``\0'') as a path separator, for use with xargs -0.
<pen>
|jemc|: python is clearly designed with a different mindset and applications
<|jemc|>
pen: yup
<pen>
|jemc|: I don't do meta magic that often, why would you?
<|jemc|>
pen: depends on your threshold for what you consider 'magic'
<krz>
pen: yea thats a good suggestion
<pen>
|jemc|: I mean meta programming could potentially make the code harder to read
<pen>
krz: :)
Spami has quit [Quit: This computer has gone to sleep]
<|jemc|>
pen: I generally assume an intelligent maintainer and try to make the code easiest to maintain rather than easiest to read, because the two don't always coincide
<|jemc|>
pen: it's certainly true that you can take it too far
ewnd9 has quit [Remote host closed the connection]
<|jemc|>
pen: and depending on what you're doing, you can make your tracebacks an unhelpful mess - so that's something to avoid
ewnd9 has joined #ruby
<pen>
|jemc|: but ironically that's the reason why I love ruby over python so much
beilabs has quit [Ping timeout: 272 seconds]
<pen>
one of the reasons
<krz>
havenwood: although your solution, only returns 45
<krz>
should be 50
<|jemc|>
pen: yeah, I'd prefer to have the freedom of flexibility even if that flexibility gives me the opportunity to hang myself
<krz>
ok i switched last and first
<krz>
returns 50 now
<pen>
|jemc|: even rspec can't help you there if you abuse that too much, since there aren't many debugging or testing that are directly addressing meta programming
<havenwood>
krz: oh, i transposed, yeah
<pen>
|jemc|: yup lol
burlyscudd has joined #ruby
maroloccio has quit [Quit: WeeChat 0.4.0]
zigomir has joined #ruby
x1337807x has joined #ruby
<krz>
havenwood: not so good with my regex. is there a difference with this /\[(first_name|last_name)\]/ and last * 10 + first * 15 + remaining
<Mon_Ouie>
krz: In the first case the group (i.e. either first_name|last_named) will be captured, and you can read what its value was later
<Mon_Ouie>
Sorry, that's in the latter case
ssmithstone has joined #ruby
<flops>
I got a problem with ruby and command line arguments: When I pass some argument to my script "./script argument" it doesn't wait for user input when I call gets.chomp().
<poseid>
i was just trying to compile ruby from source, but I get stuck with "./configure" already… where can I learn more on that task?
<flops>
When I do not pass an argument it wais
<flops>
poseid: what is ./configure telling you? You are probably missing some required dependencies?
<Flashmasterson>
i'm trying to require a file and get 'command not found'. entering it as this require "loadee" without the extension, as this study book is telling me to do
<havenwood>
Just added Rubinius 2.1.0 to ruby-install if anyone wants to test that it works on a machine other than mine? :O (ruby-install rubinius)
<havenwood>
brew install ruby-install --HEAD
nemish has joined #ruby
skaflem has quit [Quit: Leaving]
<havenwood>
Flashmasterson: If 'loadee' is in the load path, that will indeed work
<havenwood>
Flashmasterson: Double check the Ruby version you're on? (`RUBY_VERSION` from irb or `ruby -v` from command line.)
<havenwood>
so if this is a file, you'll need to use `require_relative` or `require './loadee'` or something that actually points to that file
kcin has joined #ruby
<havenwood>
Flashmasterson: so first find the file
T__T has joined #ruby
<havenwood>
nemish: Not me, but no #rbenv channel so this would be place to ask.
<Flashmasterson>
havenwood: the book hasn't mentioned that yet but i'll do it now
<havenwood>
nemish: My advice would be if `rehash` doesn't solve it switch to chruby!? :P
<Flashmasterson>
havenwood: i know where the file is and my current directory is it, but it won't pop up
<havenwood>
Flashmasterson: require './loadee'
korisnik has joined #ruby
<Flashmasterson>
command not found
<havenwood>
Flashmasterson: Or when you're not in irb/Pry: require_relative 'loadee'
korisnik_ has joined #ruby
korisnik_ has quit [Client Quit]
<havenwood>
Flashmasterson: are you in irb?
poseid_ has joined #ruby
udon has joined #ruby
<Flashmasterson>
i am now
volty has quit [Quit: Konversation terminated!]
poseid has quit [Ping timeout: 240 seconds]
poseid_ is now known as poseid
bradhe has joined #ruby
<havenwood>
did you go into irb from the directory where loadee.rb is found?
T__T has quit [Ping timeout: 272 seconds]
mengu__ has quit [Remote host closed the connection]
mengu has joined #ruby
mengu has joined #ruby
mengu has quit [Changing host]
<Flashmasterson>
yes i think so
poseid has quit [Client Quit]
<havenwood>
Flashmasterson: you can specify a directory to add to irb load path when you start irb: irb -I /path/i/want
<havenwood>
Flashmasterson: so the dir you're in would be: irb -I .
<havenwood>
Flashmasterson: but that should presumably work without explicitly doing it, i dunno what you've got going on
Es0teric has joined #ruby
blandflakes has joined #ruby
<Flashmasterson>
uhg
b00stfr3ak has joined #ruby
<havenwood>
Flashmasterson: For starters, switch from irb to Pry. Will work the same but better. :P http://pryrepl.org/
<kke>
ruby code analyzers complain about = in conditional, it's quite common to do something like if dude = User.find(..) or something similiar, would you say it's a bad practice?
<havenwood>
Flashmasterson: gem install pry; pry
<havenwood>
kke: == is comparison
<havenwood>
kke: Ruby interpreter can guess you must mean == though you wrote =
krnflake has quit [Ping timeout: 264 seconds]
<havenwood>
kke: but don't do that, use equals (==) or threequals (===)
<Flashmasterson>
havenwood: ok first: how do i switch back to ruby from irb
<havenwood>
Flashmasterson: exit
<havenwood>
Flashmasterson: assuming you mean switch back to the command line
<havenwood>
Flashmasterson: switch back to ruby from irb makes no sense :P
<havenwood>
irb is a ruby repl
krnflake has joined #ruby
<havenwood>
Pry is a better ruby repl
<Flashmasterson>
ok exit worked
<Flashmasterson>
gem install pry; pry did nothing so far
mengu has quit [Ping timeout: 241 seconds]
<havenwood>
Flashmasterson: gem -v
<havenwood>
Flashmasterson: You installed Ruby recently with RVM?
<havenwood>
Flashmasterson: Gotta get gem installs working, that is essential.
relix has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
einarj has joined #ruby
<kke>
heftig: yes but it's common to do something like if user = User.find(params[:id]) do_something_with_user else raise "hey no user" end
<havenwood>
Flashmasterson: Just to be sure run?: rvm get stable && gem update --system
<kke>
otherwise you would have to do user = User.find(params[:id]) if user.nil? ....
<kke>
which i don't see done very much
<Flashmasterson>
havenwood: ok nevermind i just had to be patient: Successfully installed pry-0.9.12.2
<Flashmasterson>
Parsing documentation for pry-0.9.12.2
<Flashmasterson>
1 gem installed
<Flashmasterson>
Installing ri documentation for pry-0.9.12.2
<Flashmasterson>
[1] pry(main)>
<Flashmasterson>
havenwood: i wish i could know if ruby is actually working or just waiting for me to Ctrl+C it's ass
<kraljev2>
Why is my gem folder not in $LOAD_PATH?
<havenwood>
kke: that isn't sane, never use the assignment operator in place of comparison operator
kazuuu has joined #ruby
<havenwood>
kke: two equal signs: ==
user258467 has quit [Quit: Leaving...]
Valicek1 has joined #ruby
atno has quit [Read error: Operation timed out]
relix has joined #ruby
coderhs has quit [Quit: Leaving]
<havenwood>
kraljev2: you have GEM_HOME and GEM_PATH env vars correctly set?
<Flashmasterson>
ok why am i in pry and what does it do
<havenwood>
looks like Second Edition is out in beta, in print this Spring
atno has joined #ruby
<Flashmasterson>
...
drumsrgr8forn8 has joined #ruby
Zolo has joined #ruby
<Flashmasterson>
and by the time i get 1/4 of the way through that one another one will come out
<havenwood>
if its only on second edition, maybe not!
<havenwood>
in another couple years, so just don't read too slow!
endash has quit [Quit: endash]
kraljev2 has quit [Ping timeout: 248 seconds]
<havenwood>
kke: is what is meant?: if (user = User.find(params[:id]))? maybe i'm just not getting what you're saying?
mary5030 has quit [Remote host closed the connection]
<havenwood>
kke: or user is already set and you're checking for equality?
xk_id has joined #ruby
mary5030 has joined #ruby
<Flashmasterson>
havenwood: alright well how much of this 1.9.1 book is going to screw me over?
Xeago has quit [Remote host closed the connection]
<havenwood>
err, if it was 1.9.2 i'd say you'd be fine
<Flashmasterson>
wow
<havenwood>
i dunno 1.9.1, there are for sure going to be some odd differences
drumsrgr8forn8 has quit [Ping timeout: 248 seconds]
<havenwood>
1.9.1 was not a stable release
<Flashmasterson>
christ
<havenwood>
1.9.2 is first stable of 1.9 branch
<Flashmasterson>
so i just wasted my money on this thing
carraroj has quit [Quit: Konversation terminated!]
<havenwood>
for sure it'd be better to get the one in beta, sorry!!
<havenwood>
not only 1.9.2/1.9.3 differences from 1.9.1 but also 2.0 (and maybe 2.1) stuff
<havenwood>
not too hard to track 1.9-2.0 changes or 2.0-2.1
<havenwood>
1.8 to 1.9 is horrid, pretend 1.8 doesn't exist
<havenwood>
end of life
<Flashmasterson>
damnit, ok
<Flashmasterson>
btw the load command isn't working
<Flashmasterson>
in pry or ruby
TheMoonMaster has quit [Remote host closed the connection]
mary5030 has quit [Ping timeout: 265 seconds]
Astralum has joined #ruby
kraljev2 has joined #ruby
<havenwood>
Flashmasterson: works on my machine ;P
F1skr has joined #ruby
ehc has quit [Quit: ehc]
<havenwood>
Flashmasterson: seems you have something wrong with load path
<havenwood>
Flashmasterson: did you update RVM and check you have latest RubyGems?
threesome has joined #ruby
<havenwood>
Flashmasterson: you may wanna update RVM and reinstall Ruby because it should work from a clean install
<Flashmasterson>
christ… i have 2.0.0. on all of that
<havenwood>
#rvm is very helpful if you follow their process for reporting issues, but i dunno what you've got setup wrong that require and load aren't getting the load path
x1337807x has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
mobileblue has joined #ruby
<kke>
havenwood: x = "foo" sets x to "foo" and returns "foo", so user = User.find(user_id) sets user to nil and returns nil, so the expression evaluates as false.
<Flashmasterson>
i'll check it out. but before i do, is there a short answer to that "how do i reinstall rvm, rubies, gems?" because i know they're all going to refer me to google and it will take all day to figure it out
<kke>
same as raise "User not found" unless user = User.find(user_id)
monkegjinni has joined #ruby
carraroj has joined #ruby
<Flashmasterson>
but i also acknowledge that installing and reinstalling is a something i need to know well because updates happen so frequently
<kke>
havenwood: in case user is not found of course. if user is found it returns an user which isn't falsey.
<havenwood>
kke: Ahh, the distinction is in the parens.
<havenwood>
>> if user = nil; puts 'yup' end
<eval-in>
havenwood => /tmp/execpad-42833a6ac864/source-42833a6ac864:2: warning: found = in conditional, should be == ... (https://eval.in/55801)
<havenwood>
>> if (user == nil); puts 'yup' end
<eval-in>
havenwood => undefined local variable or method `user' for main:Object (NameError) ... (https://eval.in/55802)
michael_mbp is now known as zz_michael_mbp
monkegjinni has quit [Read error: No route to host]
ssvo has quit [Ping timeout: 248 seconds]
<kke>
>> if user = "user"; puts "hello, #{user}" end
<eval-in>
kke => /tmp/execpad-d744a72f2cc0/source-d744a72f2cc0:2: warning: found = in conditional, should be == ... (https://eval.in/55803)
<havenwood>
ah, gotcha - i'm slow on the uptake, sry - so trying to avoid checking User.find(user_id) before you move on like andand
Astral_ has joined #ruby
<kke>
havenwood: yeah, avoiding the extra line basically. user = User.find(user_id) if user.nil? puts "hey no user" else do_stuff_with(user).
polaco_zZz is now known as polaco
<Flashmasterson>
havenwood: i'll check out #rvm again. but before i do, is there a short answer to "how do i reinstall rvm, rubies, gems?" because i know they're all going to refer me to google and it will take all day to figure it out
<kke>
i mostly use x.eql?(y) in conditionals instead of == anyway so to my eye it looks clear as sky
T__T has joined #ruby
dhruvasagar has quit [Ping timeout: 240 seconds]
<havenwood>
Flashmasterson: to update RubyGems `gem update --system`, to update rvm `rvm get head`, to reinstall ruby `rvm reinstall ruby` (guessing on that last one, i don't use rvm)
T__T has quit [Remote host closed the connection]
Astralum has quit [Ping timeout: 248 seconds]
<Flashmasterson>
havenwood: thanks a lot for not referring me to google. much appreciated
burlyscudd has joined #ruby
spider-mario has quit [Remote host closed the connection]
<havenwood>
kke: does Rails have something like andand built in? I know there's #try.. maybe try #rubyonrails?
einarj has quit [Remote host closed the connection]
<havenwood>
Flashmasterson: np
einarj has joined #ruby
<kraljev2>
Why is ruby's sort not stable?
deens has quit [Remote host closed the connection]
vlad_starkov has joined #ruby
burlyscudd has quit [Ping timeout: 245 seconds]
einarj has quit [Ping timeout: 272 seconds]
<havenwood>
kraljev2: stable?
<kraljev2>
yep, stable sort :)
<kraljev2>
this is a property of a sorting algorithm
<Mon_Ouie>
havenwood: A stable sort means that, if you have two equal items in an array, a and b, and a is before b in the initial array, a will be before b in the sorted array
<nemish>
anyone know what might be reason for undef loc var or method
<Mon_Ouie>
I don't know *why* the implementation used by Ruby isn't stable (it's just an in-place quicksort I think), but I know sort_by is/used to be stable
<Mon_Ouie>
So that can be used as a workaround if it still works
<Mon_Ouie>
He just got disconnected (ping timeout)
Guest24381 has quit [Remote host closed the connection]
burlyscudd has joined #ruby
<havenwood>
TL;DR: stable sort is slower and won't ever replace sort, if implemented stable_sort would prolly be accepted, in the meanwhile can `i = 0; ary.sort_by{ |x| [x, i += 1] }`.
burlyscudd has quit [Client Quit]
mrsolo_ has quit [Quit: This computer has gone to sleep]
astrobunny has quit [Ping timeout: 272 seconds]
osvico has quit [Ping timeout: 265 seconds]
ChronocityLC has quit [Ping timeout: 272 seconds]
zachrab has joined #ruby
zachrab has quit [Remote host closed the connection]
dz has joined #ruby
bradhe has quit [Remote host closed the connection]
dz is now known as Guest76485
bradhe has joined #ruby
Guest76485 is now known as nilved
astrobunny has joined #ruby
<havenwood>
class Array; def stable_sort; i = 0; sort_by { |x| [x, i += 1] } end end
asteros has joined #ruby
<havenwood>
and yup, a ton slower
csffsc has joined #ruby
bradhe_ has joined #ruby
bradhe has quit [Ping timeout: 248 seconds]
ewnd9 has quit [Ping timeout: 245 seconds]
CorpusCallosum has joined #ruby
<csffsc>
Hey everyone.. I'm currently trying to test an array of integers to see if the sum equals a specific number, I currently have it working in a true/false capacity - can anyone help me with returning the numbers?
<havenwood>
i dunno the proper term for the first and second card in blackjack?
<csffsc>
hmm, let me look
<csffsc>
I'm not sure on terminology.. 10+11 =21, however that beats, 10+9+2 (also 21)
malcolmva has quit [Ping timeout: 272 seconds]
<csffsc>
so I was thinking of a loop, first looking for maximum sum, then looking for lowest card count
<csffsc>
when each loop ends, returning its value (sum, array of integers)
<agustinvinao>
Hi, how can I fire a task after deploy:setup in Capistrano v3? (i got Don't know how to build task 'deploy:setup' when I try it)
nfk has joined #ruby
nfk has joined #ruby
nfk has quit [Changing host]
astrobunny has joined #ruby
<schnux>
guys,has anybody a hint for me, installing rails on a fresh centos6.4, aborting with error: activesupport requires ruby >= 1.9.3 ? don't want RVM or install from source - like to stay with yum.
zerun0 has quit [Ping timeout: 272 seconds]
zerun0_ has joined #ruby
endash has joined #ruby
<csffsc>
havenwood* so I think your code, is currently setup for only testing two cards?
vlad_starkov has quit [Read error: Connection reset by peer]
<csffsc>
*havenwood* two cards?
<csffsc>
.. I dont know how to call out your name, sorry.
<havenwood>
csffsc: yup, do it the way you had if it may be more cards (just don't call it pair)
<havenwood>
csffsc: change `pair` to `cards` and no longer confusing ;)
endash_ has joined #ruby
pleal has quit [Remote host closed the connection]
<csffsc>
okay ;p
pleal has joined #ruby
<havenwood>
csffsc: i just start typing irc name and hit <tab> for magic
<csffsc>
havenwood: ok
<havenwood>
autocompletion ftw
<csffsc>
I get autocompletion too, however I"m not seeing your name being formatted
<deepender>
any ruby expert here?
<flops>
deepender: just ask your question
<deepender>
sorry , yes
<havenwood>
schnux: CentOS is too slow on adopting packages to use anything even remotely new. Fedora latest ships with Ruby 2.0.0. You can get 1.9.3 in RedHad community package thingy. No 2.0 available.
<havenwood>
schnux: Best bet is to build it yourself. Or use ruby-install, ruby-build or rvm to do it for you.
<deepender>
I have a class in ruby which contain two method one is self and other is instance.
<havenwood>
schnux: Or switch OSes. :P
Macaveli has quit [Quit: Computer has gone to sleep.]
<havenwood>
deepender: So a class instance method and a class method (self).
<deepender>
Now I want to call this methods from other class , if suppose self method is last and other is render.
Squarepy has quit [Quit: Leaving]
<deepender>
I wanted to know what is best possible concise code possible
<flops>
roflpox: Sorry for misguiding you, I actually didn't use regex for that task, only a Hash with an Array and split()
<roflpox>
flops: ok, i was experimenting with split+regex, couldn't make it work :), let me try that
wzbyte has joined #ruby
deens has joined #ruby
<roflpox>
flops: I'm also trying to get the tournament thing for the RPS, and the attr_history thing as well
udon has quit [Read error: Operation timed out]
<roflpox>
flops: i feel a bit bad I have not been able to solve them
<flops>
Where are you stuck?
x1337807x has joined #ruby
x1337807x has quit [Client Quit]
udon has joined #ruby
<roflpox>
i'm not sure how to make the rock paper scissors one recursive
stayarrr has quit [Quit: Leaving...]
x1337807x has joined #ruby
danshultz has quit [Remote host closed the connection]
<flops>
roflpox: your winner(player1, player2) is working?
danshultz has joined #ruby
<roflpox>
yea
adambeynon has joined #ruby
deens has quit [Ping timeout: 248 seconds]
<havenwood>
nemish: tryruby.org is a good quick run-through of the very basics - i'd also recommend Ruby Koans, maybe RubyMonk, Ruby Rogues, RubyTapas, Ruby5, check out https://www.ruby-lang.org/en/documentation/ for some others
vlad_starkov has joined #ruby
<havenwood>
nemish: great talks aplenty on confreaks
korisnik has quit [Remote host closed the connection]
mojjjo has quit [Remote host closed the connection]
Drakula2k has quit []
<deepender>
can u tell what is write way to decide
dhamidi has quit [Ping timeout: 272 seconds]
<deepender>
which method to make a class method
<deepender>
and which to make instance
<deepender>
I feel a little confused in it especially when dealing with rails
udon has quit [Ping timeout: 272 seconds]
<flops>
roflpox: ok, so my base case is tournament[0][0] not being an Array
carraroj has quit [Quit: Konversation terminated!]
T__T has joined #ruby
jhaals has joined #ruby
<flops>
roflpox: maybe you can elaborate upon that yourself a bit because I don't want to give you the complete solution for obvious reasons
udon has joined #ruby
danshultz has quit [Ping timeout: 256 seconds]
Flashmasterson has quit [Quit: Leaving.]
<roflpox>
flops: ok, let me just run with that hint for a while
<deepender>
hey flops back
<flops>
hey
<deepender>
can u tell what is the right way to decide which method to make an self and which to make an instance , I feel little confused with it especially in dealing with rails
shtirlic has quit [Read error: Connection reset by peer]
<deepender>
where scalability come
deens has joined #ruby
deens has quit [Remote host closed the connection]
<deepender>
Is there any hard fast rule I can use , flops?
jhaals has quit [Client Quit]
deens has joined #ruby
<flops>
deepender: No idea, your question's are very unspecific
<flops>
questions*
ehc has joined #ruby
burlyscudd has joined #ruby
<deepender>
okey , I rephrase it How to decide whether to make a class method a self method or an instance method while writing a software?
shtirlic has joined #ruby
<deepender>
when you are in doubt whether this class method will be used somewhere else
<flops>
deepender: This depends on the method itself: If it should operate on single instances you make a instance method else you make a class/static method.
Bry8Star{T2 has quit [Ping timeout: 240 seconds]
<deepender>
okey
<deepender>
thanks
x1337807x has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
deens has quit [Ping timeout: 272 seconds]
<roflpox>
flops: before I start doing any of these problems again though.. i gotta see whats going on with this regexp
<flops>
robolar...
<roflpox>
flops: if i make s = "s s s s s s" and i do /(s)/.match(s)
bradhe has quit [Read error: Connection reset by peer]
bradhe has joined #ruby
hugohagogo has quit [Remote host closed the connection]
jb41 has quit [Ping timeout: 260 seconds]
roflpox has quit [Quit: Leaving]
ShellFu_afk is now known as ShellFu
kraljev2 has joined #ruby
havenwood has quit [Remote host closed the connection]
<ShellFu>
hey all. In the following pastebin >http://pastebin.com/C7uLu1zE< im attempting a recursive method that is currently always returning >{}< or an empty hash. Im sure its with line >#15<, but im having difficulty understanding exactly why this isnt working
iamjarvo has joined #ruby
sniffingcats has joined #ruby
<ShellFu>
It should return a hash with my results, and I see all resulting hashes, but its not returning the proper final hash. Only thing I can think of is the assignment on line >#15<
colonolGron has joined #ruby
DanKnox_away is now known as DanKnox
robert_ has quit [Ping timeout: 256 seconds]
Mars` has quit [Remote host closed the connection]
<ShellFu>
So it should be loading the given yaml from find. It should then look at the hash and see if key >:child_hash< exists and is not empty. Then if not empty should find resulting >:child_hash< merge the two and rinse and repeat until >:child_hash< nil or ''