<Radar>
dudedudeman: What do you mean .time? Is that a method?
<Radar>
Brozo: The Well-Grounded Rubyist and the Ruby Koans are what I recommend to everyone,.
<dudedudeman>
i am learning about .time in ruby. i know that Time.zone.now is preferable when dealing wtith time zones, but i am looking to see if nayone with more experience in ruby could speak to any other tricks or tips that might need to be known
<Radar>
Time.zone.now is a Rails method.
djbkd has joined #ruby
<dudedudeman>
ah, that is good to know
<dudedudeman>
i'm not dealing with rails at this point
symbol has quit [Ping timeout: 256 seconds]
Channel6 has joined #ruby
Sirupsen has joined #ruby
<Radar>
How do you know about Time.zone.now then?
Sirupsen has quit [Client Quit]
uri has joined #ruby
Lucky___ has joined #ruby
<dudedudeman>
the internet
<dudedudeman>
i realize now that I was reading an article related to rails, not just ruby
JDiPierro has quit [Remote host closed the connection]
zorak8 has joined #ruby
xploshioon has joined #ruby
symbol has joined #ruby
<Radar>
"the internet"
<Radar>
pretty imprecise?
zorak8 has quit [Max SendQ exceeded]
<Radar>
Do you have a link to this article?
mithrandeer has joined #ruby
arescorpio has joined #ruby
mistermocha has quit [Read error: Connection reset by peer]
<Radar>
if you didn't, then you'd probably have a select box for each of day, month and year
musashi1 has joined #ruby
gigetoo has quit [Ping timeout: 250 seconds]
karstensrage has left #ruby ["Leaving"]
juanpablo_ has quit [Ping timeout: 246 seconds]
a5i has joined #ruby
Ziioynx has quit [Quit: Connection closed for inactivity]
chipotle has quit [Quit: cheerio]
<dudedudeman>
for what i'm doing now, i have some data that already has a date attached to it, but i need to manually input it in to my app. in the future, i'll be adding new data that doesn't currently exist, and i'd like to just automatically create date on my form submit
Spami_ has joined #ruby
avahey has joined #ruby
<sevenseacat>
hazelux: how did you make it work
gigetoo has joined #ruby
Spami has quit [Ping timeout: 246 seconds]
<hazelux>
sevenseacat: I just changed my Ruby version to 2.1.2 using rbenv. Bundle install worked fine with that version.
<sevenseacat>
hrmm
krz has joined #ruby
hiyosi has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<sevenseacat>
i have 2.2.1 and 2.2.2 and it didnt work for either
kaleido has joined #ruby
_honning_ has quit [Ping timeout: 248 seconds]
Spami has joined #ruby
Meeh has quit [Read error: Connection reset by peer]
Spami_ has quit [Ping timeout: 245 seconds]
kaleido has quit [Client Quit]
<hazelux>
sevenseacat: I also tried 2.2.0 and it didn't work. According to SO it's something specific to 2.2.x what breaks it. Try installing 2.1.2 and see if it works for you
<sevenseacat>
will do
<sevenseacat>
well, i'll install 2.1.6 :)
duncannz has quit [Ping timeout: 252 seconds]
Meeh has joined #ruby
n008f4g_ has quit [Ping timeout: 272 seconds]
Spami_ has joined #ruby
_honning_ has joined #ruby
Spami has quit [Ping timeout: 252 seconds]
<hazelux>
Funny, I just happened to have 2.1.2 installed, and was just hoping for a miracle, just cycling through the versions and trying to get it to run
coderhs has joined #ruby
<havenwood>
What version of Xcode are you on?
Ellistaa has joined #ruby
<Ellistaa>
i’m working on creating a cipher, currently i’m using this method but it doesn’t look too good, can anyone give me a hint on what i might do to make it more dynamic?
<sevenseacat>
i have no idea, it got installed by ruby-install
nb_bez___ has quit [Quit: Connection closed for inactivity]
Spami_ has quit [Ping timeout: 245 seconds]
<havenwood>
xcode-select -v #=> xcode-select version 2339.
Spami has joined #ruby
<sevenseacat>
same error on 2.1.6
<sevenseacat>
also 2339
<Hijiri>
ruby map replaces the thing at the index with the result, right?
Brozo has joined #ruby
<Hijiri>
then you can just have alphabet[key + 4] as the last expression
milesmatthias has joined #ruby
Nuck has quit [Max SendQ exceeded]
<Hijiri>
or maybe I am wrong I don't know
greenbagels has joined #ruby
<sevenseacat>
ah well. i dont need eventmachine, i just tried to install a gem that used it, the other day.
dx7 has joined #ruby
<Hijiri>
oh, it creates a new array
<havenwood>
sevenseacat: works for me but i dunno why
Brozo has quit [Client Quit]
<Hijiri>
so you can have alphabet[key + 4], and have the result of your mapping be your result
<Hijiri>
instead of the original array
Brozo has joined #ruby
<Hijiri>
it will cost no extra because you are making a new array anyway
<Hijiri>
and has the benefit of not involving any mutation
<havenwood>
sevenseacat: but yeah, i don't use it either
* sevenseacat
nukes ruby 2.1.6 from machine
iamjarvo has joined #ruby
iamjarvo has quit [Max SendQ exceeded]
<Hijiri>
Ellistaa: forgot to ping you
<Hijiri>
also what do you mean by dynamic?
iamjarvo has joined #ruby
symbol_ has quit [Ping timeout: 246 seconds]
jenrzzz has joined #ruby
martin_work has quit [Ping timeout: 245 seconds]
<Ellistaa>
hijiri: i figured dynamic wasn’t very clear, my bad, by taht i just mean the # changes, so in that code its + 4 but if someone wanted to change it to plus 10000 i want it to still work
<Hijiri>
so they can specify the number?
zubov has quit [Quit: Leaving]
<Hijiri>
also, does ruby array indexing wrap around if your value is too high
<Hijiri>
oh, you can just mod it
<Hijiri>
mod the key by the size of your alphabet
<Hijiri>
then it will wrap around like a caesar cipher
<Ellistaa>
i updated it i think my new code will work
<laurentide>
how do i install rvm so that it works on all domains and users on the server? i currently have it installed for a specific user on a subdomain and everything works great...
dx7 has quit [Ping timeout: 244 seconds]
Dwarf has quit [Ping timeout: 265 seconds]
hanmac has joined #ruby
jerematic has quit [Remote host closed the connection]
WildBamboo-Josh has quit [Read error: Connection reset by peer]
WildBamboo-Josh has joined #ruby
jschoolcraft has quit [Quit: peace]
multi_io has quit [Ping timeout: 252 seconds]
Gadgetoid has quit [Ping timeout: 245 seconds]
centrx has quit [Quit: Shutting down, Please wait...]
<shevy>
off topic question: with git, can we actually restore to the initial variant of a given software to the primal status quo again?
sankaber has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
multi_io has joined #ruby
ahuman has quit [Quit: No Ping reply in 180 seconds.]
krisquigley has quit [Ping timeout: 250 seconds]
jaequery has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
tubuliferous_ has joined #ruby
ahuman has joined #ruby
Gadgetoid has joined #ruby
Hobogrammer has joined #ruby
jaequery has joined #ruby
cefkamcau has joined #ruby
jenrzzz has quit [Ping timeout: 244 seconds]
Technodrome has joined #ruby
Spami has quit [Quit: This computer has gone to sleep]
michael_mbp has quit [Excess Flood]
Spami has joined #ruby
graydot has quit [Quit: graydot]
<Radar>
what
<Radar>
are you asking how to apply git reset --hard?
Spami has quit [Remote host closed the connection]
michael_mbp has joined #ruby
Cache_Money has joined #ruby
RegulationD has joined #ruby
krz has quit [Read error: Connection reset by peer]
_honning_ has quit [Ping timeout: 248 seconds]
dfinninger has quit [Remote host closed the connection]
graydot has joined #ruby
baroquebobcat has quit [Quit: baroquebobcat]
krz has joined #ruby
iamjarvo has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
graydot has quit [Client Quit]
julieeharshaw has joined #ruby
yfeldblum has quit [Remote host closed the connection]
RegulationD has quit [Ping timeout: 256 seconds]
Anthony__ has joined #ruby
neanderslob_ has joined #ruby
kblake has joined #ruby
jack_rabbit has joined #ruby
longfeet has quit [Ping timeout: 256 seconds]
jenrzzz has joined #ruby
neanderslob_ has quit [Remote host closed the connection]
_blizzy_ has quit [Ping timeout: 255 seconds]
Anthony__ is now known as _blizzy_
charliesome has quit [Quit: zzz]
peteyg has quit [Ping timeout: 245 seconds]
peteyg has joined #ruby
juanpaucar has joined #ruby
<xxneolithicxx>
that would put your master back to a previous version which is probably what you want (the changes wont be lost though you just have to dig for them using reflog). If you want to push master back to a specific
charliesome has joined #ruby
<xxneolithicxx>
point and leave changes in staging do a soft
Channel6 has quit [Quit: Leaving]
juanpaucar has quit [Ping timeout: 250 seconds]
<shevy>
Radar I am not familiar with git, sorry
<shevy>
there are some ancient programming languages out there such as LPC http://en.wikipedia.org/wiki/LPC_%28programming_language%29; I haven't seen anyone combine it with git + github (then again I also did not search thoroughly for all LPC code bases out there)
idempotent has joined #ruby
<xxneolithicxx>
what is your concern with LPC and git
<Radar>
shevy: You can reset a branch back to a particular commit by running `git reset --hard <that sha>`
<Radar>
And then you can force-push that branch.
sevvie has quit [Ping timeout: 250 seconds]
<Radar>
But that's quite dangerous to do
<shevy>
xxneolithicxx I want to know if, after xxxx changes, one could still reset to the initial variant of a code base. It's for argumentation purposes here mostly, I know of in particular one code base where they only keep regular snapshots of backups, but no initial prior commit (unless the programmer in question made a backup of the .c file, manually)
<xxneolithicxx>
git keeps all prior commits leading up to the current state
pika_pika has quit [Ping timeout: 245 seconds]
charliesome has quit [Quit: zzz]
<xxneolithicxx>
in addition if you did a reset on it, you wont actually lose those commits even after you change it as long as they arent garbage collected
blazes816 has joined #ruby
<xxneolithicxx>
it takes a few days
<xxneolithicxx>
so even if you messed up the reset you just have to find the hash with reflog if it hasnt been gc'ed
<xxneolithicxx>
and if you want to look at a specific version of the .c just checkout the hash for that commit
tcrypt has quit [Ping timeout: 256 seconds]
mistermocha has joined #ruby
blazes816 has quit [Ping timeout: 244 seconds]
mithrandeer has quit [Quit: Leaving...]
Contigi777 has joined #ruby
charliesome has joined #ruby
QualityAddict has joined #ruby
VBlizzard has joined #ruby
Zamerick_ has joined #ruby
Guest82299 has quit [Ping timeout: 252 seconds]
blizzy has quit [Ping timeout: 240 seconds]
Contigi has quit [Ping timeout: 240 seconds]
Zamerick has quit [Ping timeout: 245 seconds]
sevvie has joined #ruby
Eiam_ has joined #ruby
andrew-l` has joined #ruby
swgillespie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<Eiam_>
hmm why is every google search for a ruby buildpack this cloudfoundry stuff... just want like, ruby + sinatra.
Olipro_ has joined #ruby
Olipro_ is now known as Guest70343
andrew-l has quit [Ping timeout: 246 seconds]
greenbagels has quit [Quit: Leaving]
DexterLB has joined #ruby
riceandbeans has joined #ruby
<riceandbeans>
how bad is lock_file = File.open('/var/lock/myapplock', File::RDWR|File::CREAT, 0644) ?
krz has quit [Ping timeout: 245 seconds]
iamjarvo has joined #ruby
jaequery has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
deimos_ has quit []
arescorpio has quit [Ping timeout: 256 seconds]
scripore has quit [Quit: This computer has gone to sleep]
deimos has joined #ruby
oo_ has joined #ruby
pragmaticivan has quit [Ping timeout: 256 seconds]
<mizbotre>
How to rebuild ruby?
SouL_|_ has quit [Ping timeout: 240 seconds]
SouL_|_ has joined #ruby
<eam>
riceandbeans: well, that won't work as a lockfile unless you also use File::EXCL
<eam>
otherwise the open won't be exclusive and it won't lock anything
<eam>
File::CREAT|File::EXCL gives "create file, raise if you can't" semantics
msmith has quit [Remote host closed the connection]
<riceandbeans>
eam: one sec, I rewrote it, tell me what you think, ok?
dx7 has joined #ruby
<riceandbeans>
if File.exists?(lock_file)
<riceandbeans>
puts "app already running"
<riceandbeans>
exit 1
<riceandbeans>
else
<riceandbeans>
File.open(lock_file, 'w') { |file|
<riceandbeans>
file.write("#{Time.new.inspect}")
<riceandbeans>
}
<riceandbeans>
end
<riceandbeans>
eam: do you think that's better?
<eam>
that's no good either, you want to use open with File::CREAT|File::EXCL
<eam>
nothing else will be an atomic test and acquire
<riceandbeans>
I don't understand
<eam>
in your second example there's a race between exists? and open()
<eam>
what happens if the file is created in parallel immediately before the open() ?
<riceandbeans>
well, I can put as a final line in the thing to delete the file
<eam>
won't help
<riceandbeans>
in parallel?
<riceandbeans>
this runs on a cron job
<riceandbeans>
if a second one runs, it should exit
<riceandbeans>
what does File::CREAT|File::EXCL mean?
<eam>
it means create the file only if the file does not already exist
<eam>
it's used to atomically test and set
<eam>
it sounds like in your example you don't need true correctness, but if you had a possibility of two jobs starting at the same time you would care
<eam>
otherwise there is a race condition
<riceandbeans>
they should not be able to start at the same time
<riceandbeans>
but one might start while the other is still running
<riceandbeans>
if such is the case, the first took too long and I need to be alerted
<eam>
what I'm hearing you say is "my locking doesn't have to be perfect"
<eam>
so that's ok
<eam>
but File::CREAT|File::EXCL is what you should do
<riceandbeans>
I want to do this correctly though
<eam>
ok try something like this
<riceandbeans>
so File::EXCL means raise an exception if fail?
<eam>
yes it will raise Errno::EEXIST if the file already exists
<eam>
begin; open lock_file, File::CREAT|File::EXCL; do_your_code(); rescue Errno::EEXIST; raise "attempted to acquire lock, but lockfile exists"; end
<eam>
oh, and add an File.unlink lock_file at the end of your block
<eam>
to clean up the lock
<eam>
this method provides perfect race-free lock semantics
<riceandbeans>
; and all?
<riceandbeans>
can defs exist in a begin?
rikai has quit [Ping timeout: 264 seconds]
milesmatthias has quit [Remote host closed the connection]
yfeldblu_ has joined #ruby
zotherstupidguy has quit [Quit: leaving]
SouL_|__ has joined #ruby
_blizzy_ has quit [Ping timeout: 244 seconds]
<eam>
riceandbeans: you can call your own methods from there
<eam>
you don't have to def methods inside the begin block
SouL_|_ has quit [Ping timeout: 244 seconds]
ndrei has joined #ruby
Morkel has joined #ruby
duncannz has joined #ruby
<riceandbeans>
eam: should I put the rescue at the bottom of all my code?
<riceandbeans>
and when you say open lock_file, do you mean like File.open(lock_file) ?
sdothum has quit [Quit: ZNC - 1.6.0 - http://znc.in]
<shevy>
I am not quite sure yet... I feel that I am missing something how to build up my gems. It is true that I am lazy when it comes to documenting things, but I also struggle with how to use documentation, what files to put (USAGE.md? README.md?), where to put...
fedexo has joined #ruby
<shevy>
Radar but I think I will try out bundler for a new project
<apeiros>
shevy: toplevel README.markdown
<Radar>
shevy: Bundler makes those decisions for you :)
<apeiros>
and explain there with which classes to start
vire has quit [Ping timeout: 264 seconds]
<shevy>
Radar: I see that you documented a lot of files there, must have been a lot of work
<apeiros>
API docs should mostly cover the rest. unless you have a huge gem. then additional prosa docs might be useful.
<Radar>
That big gap in the middle is all the time I spent writing other things :D
<Radar>
I enjoy documenting
<shevy>
apeiros on the same base level? A while ago, I started to add doc/ directories, then I was thinking, I could put all doc files there... but now I have gem-based projects, where I have a USAGE.md file, outside doc/ ... my own setup confuses me
<Radar>
Why have a separate README + USAGE? What is README if it doesn't have USAGE?
Alina-malina has joined #ruby
<shevy>
haha yeah
<shevy>
I ended up with "doc/README.md" and "USAGE.md" too
icarus has quit [Ping timeout: 256 seconds]
<apeiros>
shevy: for large projects yes, I'd add a doc dir. but that'd really have to be large. like 50+ classes.
<apeiros>
i.e. usually only framework level gems.
SouL_|_ has quit [Ping timeout: 248 seconds]
<Radar>
README should tell people 1) what the gem does (summary) 2) how to install it 3) finer grained usage info, with possibly links to other documentation 4) how to contribute back to the project 5) whatever else
SouL_|_ has joined #ruby
<Radar>
But yeah Bundler is pretty nice for getting started.
juanpablo_ has joined #ruby
jenrzzz has joined #ruby
iamninja_ has quit [Read error: Connection reset by peer]
joonty has joined #ruby
iamninja_ has joined #ruby
juanpablo_ has quit [Ping timeout: 240 seconds]
SOLDIERz has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Technodrome has quit [Quit: Technodrome]
avahey has quit [Quit: Connection closed for inactivity]
pacMakaveli has joined #ruby
ramfjord has joined #ruby
vire has joined #ruby
crdpink2 has quit [Quit: q term]
Joufflu_ has quit [Quit: Peace]
jenrzzz has quit [Ping timeout: 265 seconds]
gagrio has joined #ruby
Technodrome has joined #ruby
bluOxigen has joined #ruby
bluOxigen has left #ruby [#ruby]
ramfjord has quit [Ping timeout: 245 seconds]
workmad3 has joined #ruby
BradPitt has quit [Ping timeout: 245 seconds]
kstuart has joined #ruby
crdpink has joined #ruby
workmad3 has quit [Ping timeout: 248 seconds]
dodobrain has quit [Quit: bye... o/]
mizbotre has quit [Ping timeout: 248 seconds]
balazs_ has joined #ruby
krisquigley has joined #ruby
mengu__ has joined #ruby
digifiv5e has joined #ruby
digifiv5e is now known as Guest34688
slackbotgz has quit [Remote host closed the connection]
mengu has quit [Ping timeout: 248 seconds]
balazs_ has quit [Ping timeout: 250 seconds]
krisquigley has quit [Ping timeout: 240 seconds]
SOLDIERz has joined #ruby
milesmatthias has joined #ruby
ta has joined #ruby
antgel has joined #ruby
milesmatthias has quit [Ping timeout: 276 seconds]
swgillespie has joined #ruby
haxrbyte has quit [Remote host closed the connection]
crdpink has quit [Ping timeout: 245 seconds]
haxrbyte has joined #ruby
crdpink2 has joined #ruby
haxrbyte has quit [Remote host closed the connection]
RegulationD has joined #ruby
swgillespie has quit [Client Quit]
SouL_|__ has joined #ruby
davedev24_ has quit [Remote host closed the connection]
BradPitt has joined #ruby
haxrbyte_ has joined #ruby
SouL_|_ has quit [Ping timeout: 264 seconds]
fabrice31 has joined #ruby
mistermocha has joined #ruby
RegulationD has quit [Ping timeout: 255 seconds]
timonv has joined #ruby
marienz has joined #ruby
pagios has quit [Ping timeout: 252 seconds]
pagios has joined #ruby
rdark has joined #ruby
spider-mario has quit [Remote host closed the connection]
relix has joined #ruby
ta has quit [Remote host closed the connection]
edwinvdgraaf has joined #ruby
vim_shimm has quit [Ping timeout: 250 seconds]
mistermocha has quit [Ping timeout: 245 seconds]
pagios has quit [Ping timeout: 256 seconds]
SOLDIERz has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<shevy>
Lerdorf, Rasmus (2007-04-26). "PHP on Hormones"
<shevy>
ok, not first april... 3 weeks later :)
<ytti>
totally wrong channel for this, but is there native HTML way to choose number between X and Y, while displaying number
pika_pika has joined #ruby
<shevy>
this channel is awesome ytti
<shevy>
it's always the right channel
<ytti>
shevy, so, seen any good furry movies lately?
<shevy>
I am not sure how to answer that question though... what can you do with html? to choose something? or do you mean, to use javascript?
Igorshp has quit [Remote host closed the connection]
<ytti>
shevy, like select box to choose number for a form
<ytti>
between X-Y, say between 2 and 1000
workmad3 has joined #ruby
<shevy>
ytti you mean with animals? there are not many good animal movies out there... last one I saw was some BBC documentation about flying birds flying around the globe... did you know that some vulture crashed into a plane at altutude 11.400 metres or something like that? they can reach that height, the vultures
<ytti>
HTML5 has range, but it won't display what value you're working with
<apeiros>
asking a question in #ror, reliably getting high blood pressure…
Oka has quit []
iasoon has joined #ruby
haxrbyte has quit [Ping timeout: 265 seconds]
<shevy>
apeiros aaah
ndrei has quit [Ping timeout: 244 seconds]
sinkensabe has joined #ruby
lfox has joined #ruby
DaniG2k has joined #ruby
workmad3 has quit [Ping timeout: 264 seconds]
lessless has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
otisZart has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
digitalZombie has quit [Ping timeout: 240 seconds]
f0ster has quit [Ping timeout: 248 seconds]
timonv has quit [Ping timeout: 252 seconds]
mistermocha has quit [Ping timeout: 245 seconds]
Morkel has quit [Quit: Morkel]
haxrbyte has joined #ruby
timonv has joined #ruby
astrobunny has quit [Remote host closed the connection]
ruby-lang727 has joined #ruby
jamto11 has joined #ruby
ruby-lang612 has joined #ruby
<ruby-lang612>
someone on?
<ruby-lang612>
whats wrong with this code:
<ruby-lang612>
books = { Wheel_of_Time: 6, Mistborn: 5, Alchemist: 7, } puts "What would you like to do? Options: (add) (update) (delete) (list)" choice = gets.chomp case choise when "add" puts "What book would you like to add to your hash?" title = gets.chomp if book[title.to_sym] = .nil? puts "What rating do you give this book? (Between 1 and 10)" rating = gets.chomp books [title.to_sym] = ra
d10n-work has joined #ruby
dblessing has joined #ruby
luksaur has joined #ruby
<ruby-lang612>
books = { Wheel_of_Time: 6, Mistborn: 5, Alchemist: 7, } puts "What would you like to do? Options: (add) (update) (delete) (list)" choice = gets.chomp case choise when "add" puts "What book would you like to add to your hash?" title = gets.chomp if book[title.to_sym] = .nil? puts "What rating do you give this book? (Between 1 and 10)" rating = gets.chomp books [title.to_sym] = r
<ruby-lang612>
books = { Wheel_of_Time: 6, Mistborn: 5, Alchemist: 7, } puts "What would you like to do? Options: (add) (update) (delete) (list)" choice = gets.chomp case choise when "add" puts "What book would you like to add to your hash?" title = gets.chomp if book[title.to_sym] = .nil? puts "What rating do you give this book? (Between 1 and 10)" rating = gets.chomp books [title.to_sym] = r
<ruby-lang612>
books = { Wheel_of_Time: 6, Mistborn: 5, Alchemist: 7, } puts "What would you like to do? Options: (add) (update) (delete) (list)" choice = gets.chomp case choise when "add" puts "What book would you like to add to your hash?" title = gets.chomp if book[title.to_sym] = .nil? puts "What rating do you give this book? (Between 1 and 10)" rating = gets.chomp books [title.to_sym] = r
<ruby-lang612>
books = { Wheel_of_Time: 6, Mistborn: 5, Alchemist: 7, } puts "What would you like to do? Options: (add) (update) (delete) (list)" choice = gets.chomp case choise when "add" puts "What book would you like to add to your hash?" title = gets.chomp if book[title.to_sym] = .nil? puts "What rating do you give this book? (Between 1 and 10)" rating = gets.chomp books [title.to_sym] = r
<doppler>
wow
<ruby-lang612>
books = { Wheel_of_Time: 6, Mistborn: 5, Alchemist: 7, } puts "What would you like to do? Options: (add) (update) (delete) (list)" choice = gets.chomp case choise when "add" puts "What book would you like to add to your hash?" title = gets.chomp if book[title.to_sym] = .nil? puts "What rating do you give this book? (Between 1 and 10)" rating = gets.chomp books [title.to_sym] = r
<ruby-lang612>
books = { Wheel_of_Time: 6, Mistborn: 5, Alchemist: 7, } puts "What would you like to do? Options: (add) (update) (delete) (list)" choice = gets.chomp case choise when "add" puts "What book would you like to add to your hash?" title = gets.chomp if book[title.to_sym] = .nil? puts "What rating do you give this book? (Between 1 and 10)" rating = gets.chomp books [title.to_sym] = r
<ruby-lang612>
books = { Wheel_of_Time: 6, Mistborn: 5, Alchemist: 7, } puts "What would you like to do? Options: (add) (update) (delete) (list)" choice = gets.chomp case choise when "add" puts "What book would you like to add to your hash?" title = gets.chomp if book[title.to_sym] = .nil? puts "What rating do you give this book? (Between 1 and 10)" rating = gets.chomp books [title.to_sym] = r
<ruby-lang612>
books = { Wheel_of_Time: 6, Mistborn: 5, Alchemist: 7, } puts "What would you like to do? Options: (add) (update) (delete) (list)" choice = gets.chomp case choise when "add" puts "What book would you like to add to your hash?" title = gets.chomp if book[title.to_sym] = .nil? puts "What rating do you give this book? (Between 1 and 10)" rating = gets.chomp books [title.to_sym] = r
<ruby-lang612>
books = { Wheel_of_Time: 6, Mistborn: 5, Alchemist: 7, } puts "What would you like to do? Options: (add) (update) (delete) (list)" choice = gets.chomp case choise when "add" puts "What book would you like to add to your hash?" title = gets.chomp if book[title.to_sym] = .nil? puts "What rating do you give this book? (Between 1 and 10)" rating = gets.chomp books [title.to_sym] = r
<ruby-lang612>
books = { Wheel_of_Time: 6, Mistborn: 5, Alchemist: 7, } puts "What would you like to do? Options: (add) (update) (delete) (list)" choice = gets.chomp case choise when "add" puts "What book would you like to add to your hash?" title = gets.chomp if book[title.to_sym] = .nil? puts "What rating do you give this book? (Between 1 and 10)" rating = gets.chomp books [title.to_sym] = r
<Lloyd>
stop
<ruby-lang612>
whats wrong
<ruby-lang612>
with my code?
<Lloyd>
put it in a gist
juanpaucar has joined #ruby
<ruby-lang612>
choice = gets.chomp case choise when "add" puts "What book would you like to add to your hash?" title = gets.chomp if book[title.to_sym] = .nil? puts "What rating do you give this book? (Between 1 and 10)" rating = gets.chomp books [title.to_sym] = rating.to_i puts "#{title} has been added to your hash with a rating of #{rating}" else puts "That book is already in your hash"
<ruby-lang612>
when I run it: ruby books.rb books.rb:19: syntax error, unexpected '=', expecting keyword_then or ';' or '\n' if book [title.to_sym] = .nil? ^ endre-c1ml2d4cdty3:ruby elev$
<ruby-lang612>
why?
<apeiros>
ruby-lang612: because spamming the channel is rather annoying
jamto11 has quit [Remote host closed the connection]
<shevy>
ponga well ok it is spanish... but the USA adopts mexican-spanis
<flughafen>
jhass is a mighty warrior with 3 ban dragons
<shevy>
*spanish
mdw has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
afrianska has joined #ruby
Feyn has quit [Quit: Leaving]
hiyosi has joined #ruby
davedev24_ has joined #ruby
allcentury has quit [Ping timeout: 252 seconds]
niKeITA has joined #ruby
milesmatthias has joined #ruby
ki0 has joined #ruby
Pupeno has quit [Quit: Leaving...]
simonewestphal has quit [Ping timeout: 245 seconds]
RegulationD has joined #ruby
emocakes has quit [Ping timeout: 264 seconds]
simonewestphal has joined #ruby
milesmatthias has quit [Ping timeout: 272 seconds]
ta has quit [Remote host closed the connection]
fryguy9 has joined #ruby
ta has joined #ruby
idealexit has joined #ruby
sankaber has joined #ruby
ghr has joined #ruby
evanjs has joined #ruby
RegulationD has quit [Ping timeout: 272 seconds]
bennysan has quit [Ping timeout: 265 seconds]
thatslifeson has joined #ruby
bennysan has joined #ruby
bennysan has quit [Remote host closed the connection]
bennysan has joined #ruby
mjuszczak has joined #ruby
doodlehaus has joined #ruby
vtunka has quit [Quit: Leaving]
ta has quit [Ping timeout: 276 seconds]
Soda has joined #ruby
hanmac1 has joined #ruby
mrmargolis has joined #ruby
sh00p has joined #ruby
yalue has joined #ruby
<sh00p>
I am experimenting with receiving UDP broadcasts with rubys UDPSocket. However, it seems I need to bind to 0.0.0.0 in order to receive any
<sh00p>
and then I seem to also receive the traffic on the loopback device
<sh00p>
can I receive udp broadcasts by binding to my real interface ip?
<izzol>
it's better to use private or protected? I understand private but protected seems to be strange..
DaniG2k has joined #ruby
<jhass>
oh he found my mail address interesting
spyderman4g63 has joined #ruby
sevenseacat has joined #ruby
<izzol>
jhass: who? :)
<jhass>
izzol: protected is rarely used in the ruby community since a lot of people try to keep their hierarchies flat
<jhass>
not important ;)
cocotton has joined #ruby
shock_one has joined #ruby
paulcsmith has joined #ruby
<shevy>
his secret admirer
hellome has quit [Remote host closed the connection]
<wasamasa>
lol
cocotton has quit [Remote host closed the connection]
<izzol>
ahh, just scroll up the screen ;p
* wasamasa
foresees OC spamming in #ruby
<ponga>
shevy hey sir
bartkoo has joined #ruby
<wasamasa>
something along the lines of "DeathCode and jhass sitting in a tree, K-I-S-S-I-N-G"
allcentury has joined #ruby
cphrmky has joined #ruby
<jhass>
oddly enough deathcode knows very well how to do a query
<ponga>
you know ,web application, one that's usually hosted on the server, but can i utilize this as "app that runs on browser cross-platform" and distribute the files available to download
bruno- has joined #ruby
<ponga>
cos i can't bother about getting osx , windows, blah blah
juanpablo_ has joined #ruby
<wasamasa>
jhass: you think he intentionally probed how far he can go?
<ponga>
is this idea sane
<wasamasa>
jhass: or is it more that he was forced to learn how to do it
bruno- is now known as Guest70488
jbc8 has joined #ruby
<jhass>
wasamasa: I mean it's not deathcode
<wasamasa>
jhass: ._.
iamjarvo has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<jbc8>
if i run ssh ... -t "facter" it says "/usr/bin/env: ruby: No such file or directory"
jheg has joined #ruby
havenwood has joined #ruby
<jbc8>
but it works from an ssh terminal
<shevy>
yo ponga
spyderman4g63 has quit [Remote host closed the connection]
<ponga>
shevy: would it work
lordkryss has quit [Quit: Connection closed for inactivity]
<jhass>
sh00p: you do set SO_BROADCAST?
dstarh has joined #ruby
msmith_ has joined #ruby
<jhass>
oh, nvm that was the sender side
_honning_ has quit [Remote host closed the connection]
<shevy>
ponga I dunno. All I want is that I don't want to write javascript, I want ruby
anarang has joined #ruby
spyderman4g63 has joined #ruby
ento2206 has joined #ruby
msmith_ has quit [Remote host closed the connection]
<ento2206>
hey
msmith_ has joined #ruby
<ento2206>
sure :)
<ento2206>
its jhass here?
juanpablo_ has quit [Ping timeout: 256 seconds]
mjuszcza_ has joined #ruby
_honning_ has joined #ruby
lovejhass has joined #ruby
<sh00p>
jhass, solved it by setting SO_BINDTODEVICE
<jhass>
sh00p: ah, nice
Channel6 has quit [Quit: Leaving]
IronKoopa has quit [Ping timeout: 272 seconds]
anarang has quit [Client Quit]
mjuszczak has quit [Ping timeout: 252 seconds]
ruby-lang612 has quit [Ping timeout: 246 seconds]
Guest55044 has quit [Remote host closed the connection]
iamjarvo has joined #ruby
iamjarvo has quit [Max SendQ exceeded]
iamjarvo has joined #ruby
iamjarvo has quit [Max SendQ exceeded]
ento2206 has quit [Ping timeout: 246 seconds]
iamjarvo has joined #ruby
lovejhass has quit [Ping timeout: 246 seconds]
symbol_ has joined #ruby
Pipocah has quit [Quit: Leaving]
symbol_ has quit [Client Quit]
cocotton has joined #ruby
pauly_oc has joined #ruby
stef204 has joined #ruby
Guest34688 has quit [Changing host]
Guest34688 has joined #ruby
Guest34688 is now known as daynaskully
iamjarvo has quit [Ping timeout: 256 seconds]
bim has joined #ruby
workmad3 has joined #ruby
bim is now known as Guest58359
Cache_Money has joined #ruby
vtunka has joined #ruby
quimrstorres has joined #ruby
dkwjdies has joined #ruby
spyderman4g63 has quit [Remote host closed the connection]
lfox has joined #ruby
dkwjdies has quit [Client Quit]
lordkryss has joined #ruby
bartkoo has quit [Read error: No route to host]
shoutsid has quit [Remote host closed the connection]
Mon_Ouie has joined #ruby
Mon_Ouie has joined #ruby
sameerynho has quit [Quit: Leaving]
dumdedum has joined #ruby
bartkoo has joined #ruby
fabrice31 has quit [Remote host closed the connection]
workmad3 has quit [Ping timeout: 264 seconds]
fabrice31 has joined #ruby
RandyT has quit [Ping timeout: 272 seconds]
lfox has quit [Client Quit]
enebo has joined #ruby
lfox has joined #ruby
<kq_away>
Is there a reverse of .take? I want the range, except for 30 last elements
<kq_away>
would foo[0..-30] be sufficient?
lfox has quit [Client Quit]
mocha has joined #ruby
Kricir has joined #ruby
noname1 has quit [Ping timeout: 272 seconds]
mocha is now known as Guest92020
mgberlin has joined #ruby
hazelux has joined #ruby
<gregf_>
prolly -30..-1
simonewestphal has quit [Read error: Connection reset by peer]
blackmesa has quit [Read error: Connection reset by peer]
<jhass>
0..-30 looks good to me
mgberlin has quit [Remote host closed the connection]
<kq_away>
actually
<kq_away>
0..-30 is off by one :P
<kq_away>
0...-30 worked :P
<gregf_>
ah - ok, leave the last 30 elements
RandyT- has joined #ruby
juanpablo_ has joined #ruby
<kq_away>
Yeah, I want to zip logs older than x, but leave y freshest logs in case none are being generated (weekends etc)
<kq_away>
Thanks!
RandyT| has joined #ruby
Mon_Ouie has quit [Ping timeout: 256 seconds]
<jhass>
might want to sort in reverse then and .drop(30)
griffindy has joined #ruby
<jhass>
(I assume you're sorting somewhere)
RandyT has joined #ruby
<kq_away>
hm
<kq_away>
I am not, and it's doubleungood, because I rely on the filenames being sorted
<jhass>
yeah, you should sort
<jhass>
that it worked so far is pure luck
shock_one has quit [Remote host closed the connection]
aganov has quit [Read error: Connection reset by peer]
hiyosi has joined #ruby
<havenwood>
Koichi-san talking right now!
Pupeno has joined #ruby
* apeiros
jealous
<mwlang>
apeiros: yeah, it has been a confusing evolution of that class.
<apeiros>
mwlang: that's actually about the only change :D
<havenwood>
I'm not there. Just picked up the stream.
<apeiros>
havenwood: ah
tesuji has quit [Read error: Connection reset by peer]
<havenwood>
I've never been to a RailsConf
rodfersou has joined #ruby
avgerinos has quit [Remote host closed the connection]
<mwlang>
I only tripped up just now because I was putting a utility function together to handle any of YYYY, YYYYMM, or YYYYMMDD coming in via an XML file.
konsolebox has quit [Max SendQ exceeded]
uri has joined #ruby
<jhass>
havenwood: "Live streaming unavailable in Germany due to right issues" oO
konsolebox has joined #ruby
<havenwood>
jhass: >.>
jenrzzz has quit [Ping timeout: 256 seconds]
<apeiros>
I've been to some. but stopped due to budget unclarities in the company. and now I'd probably still not go due to USA being on my no-fly list.
<apeiros>
mwlang: .compact? so you don't mind having the day as year?
<apeiros>
ah well, actually with that regex, shouldn't happen…
fred1807 has left #ruby [#ruby]
<mwlang>
apeiros: nope. No choice, really. I need a valid date to post to the database.
<mwlang>
if only year is given, then Jan 1st of that year is acceptable.
balazs__ has joined #ruby
chipotle has quit [Quit: cheerio]
sevenseacat has quit [Quit: Me dun like you no more.]
arturaz has quit [Ping timeout: 244 seconds]
<mwlang>
only issue is when value is blank, but it actually errs out on attempting to call captures on nil, so moot that Date.new => -4712-01-01
gfawcettpq has quit [Read error: Connection reset by peer]
gfawcettpq has joined #ruby
pandaant has quit [Remote host closed the connection]
spyderman4g63 has joined #ruby
evanjs has joined #ruby
balazs__ has quit [Ping timeout: 248 seconds]
snockerton has joined #ruby
<izzol>
havenwood: "
<izzol>
Live Streaming is not available in your country due to rights issues."
<izzol>
:P
<mwlang>
apeiros: I just realized you meant day slipping into first argument position…I was thinking you meant just a “year” argument resolving to “an arbitrary day” like Jan 1st of that year.
<izzol>
looks like only havenwood can watch :P
shoutsid has joined #ruby
Hijiri has quit [Quit: WeeChat 1.0.1]
cphrmky has joined #ruby
segfalt has quit [Quit: segfalt]
sinkensabe has joined #ruby
<doppler>
shevy do you remember the script i gisted? the one you thought was weird and not very rubyish. you mentioned something about "<<" and some other stuff, though im not really comfortable on how to use "<<".. i have an another example now which basically does the same thing as the last script, except it looks a little bit different. but it would be awesome if you could give me an example on how you would use "<<". https://gist.github.co
fryguy9 has joined #ruby
michaeldeol has joined #ruby
<doppler>
i just would like to see how to do things differently =)
sinkensabe has quit [Remote host closed the connection]
<jhass>
doppler: += and << is, for strings, interchangeable
<jhass>
<< is just more efficient
<jhass>
but it modifies the value, which can be an issue if you don't own it (if it was passed to you)
<shevy>
doppler rather than += you can use <<
<jhass>
doppler: also your gist link got cut off due to the message limit
Matachines has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<doppler>
oh maybe im just confusing it with stack because ive seen it used in examples with stack
<jhass>
quite possible, on array it's similar to push
RegulationD has joined #ruby
CloCkWeRX has quit [Ping timeout: 256 seconds]
balazs_ has quit [Ping timeout: 256 seconds]
Technodrome has joined #ruby
fryguy9 has joined #ruby
mrmargol_ has joined #ruby
iamjarvo has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
dx7 has quit [Quit: Leaving...]
vtunka has quit [Quit: Leaving]
<doppler>
jhass okay alright. lemme figure this out and ill come back with a script. and maybe you could then give me a few pointers?
<jhass>
sure
<doppler>
thanks
<jhass>
though don't focus on people too much, just ask the channel
<doppler>
alright, roger that
RegulationD has quit [Ping timeout: 240 seconds]
mrmargolis has quit [Ping timeout: 248 seconds]
jbc8 has quit [Read error: Connection reset by peer]
ramfjord has joined #ruby
gauke has quit [Ping timeout: 276 seconds]
spyderman4g63 has quit [Read error: Connection reset by peer]
duderonomy has quit [Ping timeout: 256 seconds]
<ponga>
!ping
<ponga>
hm
spyderman4g63 has joined #ruby
<jhass>
?ping
<ruboto>
I don't know anything about ping
<jhass>
oh
<jhass>
!fact mk ping pong
<ruboto>
jhass, I will remember that ping is pong
blizzy has joined #ruby
quimrstorres has quit [Remote host closed the connection]
<ponga>
!ping
<ponga>
!fact ping
<ruboto>
pong
quimrstorres has joined #ruby
<ponga>
gud
<ponga>
is it a coincidence that ruboto has the same name as android ruby framework
dudedudeman has joined #ruby
<dudedudeman>
good morning to you beautiful rubyists
<ponga>
mornin
<izzol>
moin
_blizzy_ has quit [Ping timeout: 245 seconds]
ghr has quit [Ping timeout: 256 seconds]
dfinninger has joined #ruby
havenwood has quit [Remote host closed the connection]
baroquebobcat has joined #ruby
quimrstorres has quit [Ping timeout: 240 seconds]
ndrei has quit [Ping timeout: 240 seconds]
<dudedudeman>
what's everyone working on today?
Matachines has joined #ruby
<jhass>
my sanity
balazs_ has joined #ruby
vroomanj has joined #ruby
<kq_away>
.sanitize
Matachines has quit [Client Quit]
<dudedudeman>
i would help if i could, but it would be the blind leading the blind then
<ponga>
jhass.sanitize!
<vroomanj>
I did a bundle update and now none of my bootstrap javascript is working (such as drop down menus and carousels). Anyone have any tips?
<jhass>
NoMethodError: private method `sanitize` called for jhass:Person
<doppler>
cool bot by the way. how does it remember stuff? i tried to make something similar. however, my knowledge of ruby is pretty much zero, so i didnt get very far. but i accidently came across YAML which was pretty neat. i didnt get it to work though.
iamninja_ has quit [Read error: Connection reset by peer]
<shevy>
doppler it will be better if you write ruby code by yourself, then your brain will have it easier to adapt it, rather than re-use what someone else wrote
iamninja_ has joined #ruby
freerobby has joined #ruby
davedev24_ has joined #ruby
gagrio has quit [Ping timeout: 255 seconds]
symbol has quit [Quit: WeeChat 1.1]
davedev2_ has quit [Ping timeout: 272 seconds]
sinkensabe has joined #ruby
kharma1 has joined #ruby
pacMakaveli has quit []
iamjarvo has joined #ruby
iamjarvo has quit [Max SendQ exceeded]
evanjs has quit [Remote host closed the connection]
mjuszcza_ has quit []
<kharma1>
Hey all, does anyone have any previous success with extracting emails from winmail.dat files using ruby?
<doppler>
shevy yes. thats true
iamjarvo has joined #ruby
fryguy9 has joined #ruby
iamjarvo has quit [Client Quit]
mjuszczak has joined #ruby
Cloudhand has joined #ruby
idealexit has quit [Remote host closed the connection]
mjuszczak has quit [Ping timeout: 256 seconds]
quimrstorres has joined #ruby
nettoweb has joined #ruby
segfalt has quit [Quit: segfalt]
sinkensabe has quit [Remote host closed the connection]
josephleon has joined #ruby
evanjs has joined #ruby
Cache_Money has left #ruby [#ruby]
laurentide has joined #ruby
doertede1 has quit [Ping timeout: 246 seconds]
scripore has quit [Quit: This computer has gone to sleep]
SouL_|__ has joined #ruby
asmodlol has quit [Quit: Leaving]
<dudedudeman>
git push -u origin master
<dudedudeman>
.... sorry. wrong window. :/
hollywood has joined #ruby
<ponga>
wrong window? wrong channel was far from mistake!
mleung has joined #ruby
<dudedudeman>
wrong everything. lol. i'm not even in a git channel
naftilos76 has joined #ruby
SouL_|_ has quit [Ping timeout: 252 seconds]
michaeldeol has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
segfalt has joined #ruby
segfalt has quit [Client Quit]
<audy>
Counting objects: 6, done.
<audy>
Delta compression using up to 4 threads.
<audy>
Compressing objects: 100% (6/6), done.
segfalt has joined #ruby
CloCkWeRX has joined #ruby
havenwood has joined #ruby
alex88 has quit []
SouL_|_ has joined #ruby
fryguy9 has quit [Quit: Leaving.]
fryguy9 has joined #ruby
freerobby has quit [Read error: Connection reset by peer]
barkerd427 is now known as zz_barkerd427
DerisiveLogic has joined #ruby
GaryOak_ has joined #ruby
SouL_|__ has quit [Ping timeout: 265 seconds]
pauly_oc has joined #ruby
bluOxigen has left #ruby [#ruby]
dumdedum has quit [Quit: foo]
ndrei has joined #ruby
_honning_ has joined #ruby
evanjs has quit [Remote host closed the connection]
pontiki has quit [Ping timeout: 250 seconds]
hollywood has quit [Quit: Leaving]
<izzol>
Anyone using vim ruby-mode ? I cannot find the good plugin for it. I'm looking something similar to the python-mode (https://github.com/klen/python-mode)
momomomomo has joined #ruby
DaniG2k has quit [Quit: leaving]
SouL_|_ has quit [Read error: Connection reset by peer]
SouL_|_ has joined #ruby
shock_one has quit [Remote host closed the connection]
spyderma_ has joined #ruby
troyready has quit [Remote host closed the connection]
jaequery has joined #ruby
davedev24_ has quit []
sigurding has joined #ruby
timonv has quit [Ping timeout: 250 seconds]
relix has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
SouL_|__ has joined #ruby
scripore has joined #ruby
spyderman4g63 has quit [Ping timeout: 250 seconds]
troyready has joined #ruby
SouL_|_ has quit [Ping timeout: 244 seconds]
relix has joined #ruby
simonewestphal has joined #ruby
SouL_|__ has quit [Read error: Connection reset by peer]
vire has quit [Ping timeout: 244 seconds]
fryguy9 has quit [Quit: Leaving.]
spider-mario has joined #ruby
sigurding has quit [Ping timeout: 245 seconds]
spyderman4g63 has joined #ruby
kohvihoor has quit [Read error: Connection reset by peer]
sagittarian has quit [Ping timeout: 252 seconds]
Crisix has joined #ruby
Crisix has quit [Max SendQ exceeded]
spyderma_ has quit [Ping timeout: 265 seconds]
spyderma_ has joined #ruby
pika_pika has quit [Ping timeout: 245 seconds]
kohvihoor has joined #ruby
<xxneolithicxx>
shevy: late as heck to the party, but i guess you would have to explain what you mean by "initial variant of codebase" wrt to git
startupality has quit [Quit: startupality]
JDiPierro has quit [Remote host closed the connection]
mary5030 has quit [Ping timeout: 255 seconds]
juanpaucar has joined #ruby
spyderm__ has joined #ruby
sevvie has joined #ruby
spyderm__ has quit [Read error: Connection reset by peer]
spyderma_ has quit [Remote host closed the connection]
<xxneolithicxx>
shevy: "initial variant" really doesnt mean much to me but if you have multiple "versions" of your codebase committed to git over time and the initial version you are looking for was also committed before then yes you can restore to that point
paulcsmith has quit [Quit: Be back later ...]
atmosx has joined #ruby
spyderm__ has joined #ruby
spyderman4g63 has quit [Ping timeout: 264 seconds]
<xxneolithicxx>
shevy: in a case like that tagging the hash of the "initial variant" commit would make checking it out to restore/change easier
bricker has joined #ruby
FDj_ is now known as FDj
livathinos has quit []
Cust0sL1men has quit [Ping timeout: 256 seconds]
mostlybadfly has quit [Quit: Connection closed for inactivity]
mary5030 has joined #ruby
livathinos has joined #ruby
Pupeno has quit [Quit: Leaving...]
juanpaucar has quit [Ping timeout: 264 seconds]
konsolebox has quit [Ping timeout: 264 seconds]
weaksauce has joined #ruby
spyderma_ has quit [Ping timeout: 256 seconds]
Spami has quit [Quit: This computer has gone to sleep]
sohrab has joined #ruby
icebourg has joined #ruby
swgillespie has joined #ruby
blackmesa has joined #ruby
sagittarian has joined #ruby
livathinos has quit [Ping timeout: 252 seconds]
granthatcher has quit []
basiclaser has quit [Quit: Connection closed for inactivity]
Limix has joined #ruby
mikecmpb_ has quit [Ping timeout: 250 seconds]
allcentury has quit [Ping timeout: 244 seconds]
work_op has joined #ruby
fxck has joined #ruby
shock_one has joined #ruby
sevvie has quit [Ping timeout: 240 seconds]
tearan has joined #ruby
iamninja_ has quit [Ping timeout: 250 seconds]
relix has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
atmosx is now known as atmosx_osx
swgillespie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
terlar has quit [Quit: WeeChat 1.1.1]
simonewestphal_ has joined #ruby
josephleon has quit [Quit: Leaving...]
swgillespie has joined #ruby
shock_one has quit [Remote host closed the connection]
michaeldeol has joined #ruby
freerobby has joined #ruby
MatthewsFace has joined #ruby
MatthewsFace has quit [Remote host closed the connection]
Rickmasta has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
simonewestphal has quit [Ping timeout: 256 seconds]
simonewestphal_ is now known as simonewestphal
fryguy9 has joined #ruby
deuterium has joined #ruby
MatthewsFace has joined #ruby
<mwlang>
is order of a hash preserved in Ruby 2.x?
cjim_ has joined #ruby
<yxhuvud>
mwlang: should be.
<mwlang>
and specifically calling the #values method.
<havenwood>
mwlang: They enumerate in the order that keys were inserted.
<mwlang>
havenwood: thanks.
ghr has joined #ruby
shoutsid has quit [Remote host closed the connection]
gregf has quit [Quit: WeeChat 1.0.1]
<apeiros>
mwlang: yes, it is
<apeiros>
not just "should" :)
<apeiros>
and actually as of 1.9
SouL_|_ has joined #ruby
<mwlang>
apeiros: I thought I remembered that change was specifically introduced
<apeiros>
yes. it was. and it makes "Hash" even more of a misnomer than before :D
<mwlang>
great, this means I can avoid a huge swath of duplicate code.
<apeiros>
the one thing I wish about Hash was that it'd be possible to set the seed for #hash
<mwlang>
excellent. I needed a hash of values for inserting a record, but just an array of values when updating (one inserts via sql, the other updates via stored procedure)
<mwlang>
apeiros: what’s the use case?
SouL_|_ has quit [Ping timeout: 252 seconds]
mary5030 has quit [Read error: Connection reset by peer]
dorei has joined #ruby
mostlybadfly has joined #ruby
freerobby has left #ruby [#ruby]
ponga has quit [Quit: Leaving...]
RegulationD has quit [Ping timeout: 256 seconds]
zack6849 has joined #ruby
hazelux has quit [Remote host closed the connection]
krz has quit [Quit: WeeChat 1.0.1]
fella7s has quit [Ping timeout: 256 seconds]
shock_one has joined #ruby
mikecmpbll has joined #ruby
<zack6849>
Hey guys, i'm having some difficulty with ruby and i'm fairly new to it, i have this class i've written https://gist.github.com/zack6849/dfbd1f550a19512d0837 and for some reason, it keeps telling me that ranks is nil
sagittarian has quit [Ping timeout: 252 seconds]
<zack6849>
Despite that, if i understand this correctly, ranks are loaded first, so ranks being nil shouldn't be possible
hazelux has joined #ruby
tpimtts_away has quit [Ping timeout: 245 seconds]
<zack6849>
On top of that, sometimes, seemingly at random, it will actually work and not be nil, and i have no idea why
paulcsmith has joined #ruby
jobewan has quit [Ping timeout: 250 seconds]
<havenwood>
zack6849: Initialize `@ranks = {}` inside your #initialize method. Instead of `x == nil` use `x.nil?` or usually it's better to take advantage of nil's falseyness and not explicitly check nil.
pagios_ has left #ruby ["Leaving"]
lolmaus has quit [Quit: Konversation terminated!]
fxck is now known as govt
jobewan has joined #ruby
<zack6849>
i declare ranks as a hash in the load_ranks method anyways, why would that be necessary?
<havenwood>
zack6849: Consider initializing all your class instance methods in the #initialize method.
x1337807x has joined #ruby
jespada has joined #ruby
balazs has joined #ruby
c0m0 has quit [Ping timeout: 246 seconds]
<zack6849>
could this possibly be some sort of race condition?
<zack6849>
havenwood, initializing *methods* inside of methods?
<zack6849>
or did you mean variables?
josephleon has joined #ruby
<havenwood>
zack6849: i meant instance variables
govt has left #ruby ["Leaving"]
segfalt has quit [Quit: segfalt]
<ddv>
zack6849, load_ranks is way too long, also learn to use inject, so you don't have to declare arrays/hashes outside of .each
ghr has quit [Remote host closed the connection]
pdoherty has joined #ruby
<zack6849>
ddv, if you have an alternate suggestion on how to parse the file by all means
<havenwood>
zack6849: Even the instance variables that are `nil` are set.
scripore has quit [Quit: This computer has gone to sleep]
<zack6849>
wait, wait, i think i'm an idiot. :|
thumpba_ has joined #ruby
<shevy>
zack6849 no
<shevy>
you just did not see the right thing
scripore has joined #ruby
balazs has quit [Ping timeout: 244 seconds]
segfalt has joined #ruby
plribeiro3000 has joined #ruby
<ddv>
zack6849, you should write a parser class for the file
scripore has quit [Client Quit]
<zack6849>
i think my problem lies in that i'm using rails caching, and declaring the local instance variables inside of the rails cache, so it loads every time the cache expires
<havenwood>
zack6849: And do initialize your instance variables in the aptly named #initialize method.
<zack6849>
but otherwise, the variables are nil
<zack6849>
(i think)
ki0 has quit [Ping timeout: 276 seconds]
<zack6849>
problem is i'm not sure how to work around this, unless i just cache the entire object, perhaps?
Zai00 has quit [Quit: Zai00]
wallerdev has joined #ruby
<ddv>
zack6849, drop pry in there, investigage
fryguy9 has joined #ruby
<ddv>
investigate*
<zack6849>
yeah, i don't know what pry is :D
Brozo has joined #ruby
<dudedudeman>
pry is similar to irb!
<havenwood>
?pry zack6849
<ruboto>
zack6849, Pry, the better IRB. Includes easy object inspection via `ls`, `history`, docs view with `?`, source view with `$` and syntax highlighting, among other features (see `help` for more). It can also be used for easy debugging by putting ’binding.pry’ directy in your source code. Visit https://pryrepl.org/ or get it now with gem install pry pry-doc
<zack6849>
i'm pretty much brand new to ruby, this is my first project
noobQ has quit [Quit: WeeChat 0.4.2]
thumpba has quit [Ping timeout: 245 seconds]
<havenwood>
zack6849: gem install pry pry-doc
bartkoo has quit [Quit: bartkoo]
<ddv>
zack6849, remove the caching first maybe? and then figure out if it works as expected, then re-add the caching
evanjs has joined #ruby
sagittarian has joined #ruby
<zack6849>
yep, it worked without the caching
jenrzzz has joined #ruby
<ddv>
zack6849, do players.first, instead of players[1], as per the ruby s tyle guide
<ddv>
oh sorry
<ddv>
:)
<ddv>
im a noob
<ddv>
you want the second element
Igorshp has quit [Remote host closed the connection]
<havenwood>
then #second according the Rails style guide :P
zorak8 has joined #ruby
dstarh has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<zack6849>
is that what the deal is with #forty_second?
Igorshp has joined #ruby
<ddv>
zack6849, also is caching really crucial?
<zack6849>
ddv, it's a rails application, and i have users accessing it quite often
<zack6849>
loading online users on a server, along with ranks and other things isn't optimal
<zack6849>
infact i'd very much prefer to not have to do that
shock_one has quit [Remote host closed the connection]
<ddv>
zack6849, you should background this maybe?
ghr has joined #ruby
dANO has quit []
scpike has joined #ruby
chthon has quit [Ping timeout: 244 seconds]
tcrypt has joined #ruby
<zack6849>
backgrounding isn't the thing, this is a motd for a server, which means i'd have like 10 players accessing it at a time at at least every map change
lkba has quit [Read error: Connection reset by peer]
ghostmoth has joined #ruby
scripore has joined #ruby
SouL_|__ has joined #ruby
<zack6849>
even if i backgrounded it it'd still be querying the server that many times
hornairs_ has joined #ruby
<zack6849>
i've implemented this as caching with java and php in previous iterations
<jokke>
is it correct, that doing array.map {|el| sth = el.foo; sth.bar} has no performance benfit to doing array.map(&:foo).map(&:bar)? As in: In both cases the array is iterated once. correct?
shock_one has quit [Remote host closed the connection]
<hoelzro>
jokke: in terms of iterations, right; there might be overhead constructing a block and calling it, though
<apeiros>
jokke: the latter iterates twice. and not the same array (just arrays of the same length)
<ddv>
havenwood, explain then
<hoelzro>
you should try both and measure
<jokke>
apeiros: i don't think it does
ndrei has quit [Ping timeout: 245 seconds]
<apeiros>
jokke: you think wrong
<jokke>
does it really?
<jokke>
ah too bad
<apeiros>
yes
<hoelzro>
er, nevermind; I missed the second .map
hornairs has quit [Ping timeout: 240 seconds]
<ddv>
zack6849, keep on ignoring me
<apeiros>
unless your `array` is not really an Array and has a .map which returns something which doesn't iterate on .map
<jokke>
hm
<zack6849>
ddv, i'm not
<zack6849>
i'm just incredibly busy trying to do what you've suggested
<ddv>
ok
<ddv>
sorry
<zack6849>
no problem
<apeiros>
jokke: also not quite sure why you use a temp var in the first
<havenwood>
ddv: We use precedence all over. It's not a cognitively hard thing for folk to grasp. Proper use of `and` and `or` is elegant. I'd prefer folk learn Ruby than shun precedence as too hard.
<apeiros>
jokke: why not just el.foo.bar ?
<apeiros>
havenwood: in an ideal world I'd say the same
<ddv>
^
<apeiros>
havenwood: but my experience is that most devs are just not up to that level of competence.
Lloyd is now known as lloyd
<apeiros>
same reason why I advise not to use @@cvars or flip-flops
<zack6849>
is this proper? if !File.exist?(users_file) || !File.readable?(users_file)
SouL_|__ has quit [Ping timeout: 245 seconds]
<jokke>
apeiros: yeah that'd be the way to go but the & notation is so neat..
<havenwood>
With those the former is ugly for several reasons and the latter is too clever.
jaequery has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<zack6849>
old code was this if not File.exist?(users_file) or not File.readable?(users_file)
<apeiros>
jokke: somebody (hanmac maybe? or was it banister?) wrote a gem which allows chains with & syntax
<havenwood>
apeiros: I'm fine with advising starting with only && and || but a complete ban seems overly harsh to me.
<apeiros>
I think it works like ary.map(&X.foo.bar)
jaequery has joined #ruby
Spami has joined #ruby
nfk|laptop has joined #ruby
<ddv>
zack6849, why not use say if the file exists and is readable then parse
<ddv>
?
<ddv>
do you*
shevy has joined #ruby
<havenwood>
ddv: As for unless/else I don't find it confusing. I avoid it in public code begrudgingly.
<jokke>
apeiros: wow
<workmad3>
apeiros: I can't remember it getting to gem form... but I remember hanmac writing a bit of ruby to allow chains on symbols in that style
lkba has joined #ruby
<momomomomo>
I prefer ! than looking at `unless`
jenrzzz has joined #ruby
<apeiros>
shouldn't be too hard to do if you want to do it yourself
<zack6849>
no, i check if the file doesnt exist or isn't readable, if it isn't, i read a backup from a url
<momomomomo>
that above is easy to parse: the file doesn’t exist, or if it’s not readable
Ellis has joined #ruby
<momomomomo>
and in the end, what style is about is being able to quickly and easily convey intention, innit?
<zack6849>
plus i cant tell what the hell "some_weird_thing" is when it's just sitting there alone, it looks like it should be a variable, not a method
<havenwood>
Ellis: #puts returns: nil
<Ellis>
havenwood: but when i hit return @encrypted_message it returns nils
<yxhuvud>
havenwood: lol. (though I admit I am in the tenderlovian camp that doesn't prefer parens around method def argument lists)
<havenwood>
Ellis: because you're mapping to the return value of #puts
<momomomomo>
map does not change the original value
<momomomomo>
oh, your’e using map!
<momomomomo>
derp
<momomomomo>
and yes, havenwood is correct
<havenwood>
yxhuvud: fear and trepidation lay on the path to dragons when using parens! ahem, i mean i have a slight aesthetic preference for omitting them.
naftilos76 has quit [Remote host closed the connection]
<havenwood>
Ellis: drop the `return`s, and you can drop line 17 entirely
tcrypt has quit [Ping timeout: 264 seconds]
Zackio has quit [Remote host closed the connection]
<havenwood>
Ellis: if you're on a modern Ruby use `chars` instead of `split("")`
<Senjai>
apeiros: You scare me sometimes
<Ellis>
havewood: thank you … still doesn’t make sence to me but it worked ...
xerox has joined #ruby
<Ellis>
chars does split?
<apeiros>
Senjai: only sometimes? I guess I've to work more on that…
<momomomomo>
>> “onetwothree”.chars
<ruboto>
momomomomo # => undefined local variable or method `“onetwothree”' for main:Object (NameError) ...check link for more (https://eval.in/317285)
<havenwood>
riceandbeans: puts will do things like print each element of an Array on its own line and an empty line for `nil` etc, while p is used for debugging and will #inspect things so you can tell what they are.
lolmaus has joined #ruby
<riceandbeans>
using just p didn't fix it
<riceandbeans>
I just want visual proof that I'm in a block
<havenwood>
riceandbeans: What's in the block?
<riceandbeans>
a bunch of stuff
vim_shimm has quit [Ping timeout: 240 seconds]
<riceandbeans>
but I'm clearly not even entering the block
<havenwood>
riceandbeans: Put a `binding.pry` in there?
<riceandbeans>
the first line is a puts
<riceandbeans>
what's a binding.pry?
<havenwood>
?pry riceandbeans
<ruboto>
riceandbeans, Pry, the better IRB. Includes easy object inspection via `ls`, `history`, docs view with `?`, source view with `$` and syntax highlighting, among other features (see `help` for more). It can also be used for easy debugging by putting ’binding.pry’ directy in your source code. Visit https://pryrepl.org/ or get it now with gem install pry pry-doc
jenrzzz has joined #ruby
rshetty has joined #ruby
deuterium has quit [Quit: zzZZZzzz..]
sizeoftank has joined #ruby
<havenwood>
riceandbeans: You put `require 'pry'` at the top and `binding.pry` wherever you want to jump out to the REPL so you can explore in Pry.
<riceandbeans>
so I'd have to install new software?
hazelux has joined #ruby
<havenwood>
riceandbeans: gem install pry
chacmool has joined #ruby
<riceandbeans>
can't use gem here
<riceandbeans>
not allowed
<havenwood>
riceandbeans: it's for exploring in development
<riceandbeans>
if I want any gem it has to be individually approved, converted to rpm, and installed by rpm after the rpm is also approved
<havenwood>
riceandbeans: you don't have to add the gem to the project to use it in development
sizeoftank has quit [Quit: leaving]
<havenwood>
riceandbeans: or you're not allowed to use gem in dev either?
<riceandbeans>
unfortunately, I have to test this script on production systems due to ACLs
jottr has joined #ruby
<rshetty>
Hey guys
<riceandbeans>
havenwood: not allowed to use non rpm packages here at all
josephleon has joined #ruby
OnBrokenWings has quit [Quit: Leaving]
<havenwood>
riceandbeans: is there a rubygem-pry package?
<havenwood>
rshetty: hi
<riceandbeans>
there is, I don't know if they'll let me install it in production
shoutsid has joined #ruby
<havenwood>
riceandbeans: pry is handy
<riceandbeans>
I'll ask in a sec
<riceandbeans>
so pry is like a 1:1 with IRB?
<rshetty>
I am having trouble accessing 'config_file' inside the 'configuration_keys' method, I am missing something , Could somebody help point it ?
<ruboto>
pastebin.com loads slowly for most, has ads which are distracting and has terrible formatting.
<sohrab>
do you guys use sets a lot? i think 90% of the cases that i've used arrays can use sets instead
<weaksauce>
sohrab hardly ever
f3lp has quit [Ping timeout: 264 seconds]
<wallerdev>
i usually use them for programming puzzles
<sohrab>
weaksauce: why? i just learned about them last week and am trying to figure out how to use them. seems like a good way to keep a collection if they're all unique.
charliesome has joined #ruby
<wallerdev>
yeah if its all unique and you dont care about order
iasoon has quit [Ping timeout: 256 seconds]
<wallerdev>
and you need to be able to check if something is in the list quickly
<havenwood>
sohrab: Used SortedSet yet?
<sohrab>
wallerdev: yeah i'm doing a coding challenge
blahwoop has joined #ruby
<sohrab>
havenwood: na, gonna look it up
<Brozo>
so that's what gists are used for
<sohrab>
havenwood: interesting
<blahwoop>
hi all, i'm trying to use httparty. are there any open apis that don't require client id or key?
<blahwoop>
i just want to mess around with it
Cache_Money has joined #ruby
<sohrab>
what other data structures am i missing out on in ruby? i know arrays, hashes, sets, now sortedset. anything else?
RegulationD has joined #ruby
<sohrab>
i know there are gems for trees and graphs
fryguy9 has joined #ruby
vim_shimm has joined #ruby
zorak8 has quit [Ping timeout: 265 seconds]
<wallerdev>
linked lists i guess
zorak8 has joined #ruby
<wallerdev>
stacks and queues
<havenwood>
sohrab: How about Struct, Enumerator and Enumerator::Lazy
<havenwood>
sohrab: Rinda::TupleSpace
colorisco has joined #ruby
djbkd has joined #ruby
<sohrab>
havenwood: k, i need to learn those. ty
<havenwood>
sohrab: OpenStruct
<havenwood>
sohrab: You didn't mention Range, but I'm assuming you've run into it.
hmnhf_ has quit [Ping timeout: 264 seconds]
<sohrab>
what % of cases do ppl not use array or hash? 5%? 10%? >25%?
<sohrab>
havenwood: yes, i'm familiar with range, thank you. it seems simple... basically an array of sequential numbers?
<havenwood>
sohrab: More a minimum value that responds to next until it gets to the end of a range.
RegulationD has quit [Ping timeout: 256 seconds]
<sohrab>
havenwood: ah i see. interesting. whoa. so not necessarily with numbers?
<wallerdev>
i use almost exclusively arrays and hashes
<wallerdev>
like 90%+
<wallerdev>
haha
<riceandbeans>
what's the difference between a set and an array?
<sohrab>
havenwood: whoa
jenrzzz has quit [Ping timeout: 244 seconds]
juanpaucar has joined #ruby
<GaryOak_>
riceandbeans: a set can only contain unique values
<wallerdev>
an array is ordered and can contain duplicates and is a simpler data struccture in general
<sohrab>
riceandbeans: the values must be unique, and they're not ordered
vim_shimm has quit [Ping timeout: 264 seconds]
<sohrab>
when i use a set i feel like i'm imposing because i need to require it XD
<GaryOak_>
It's nice for handling duplicates
<sohrab>
wallerdev: it's the simpler? i thought set was the most simple
<wallerdev>
the implementation of a set is more complicated than an array
<wallerdev>
like the internal implementation
<sohrab>
ah i see
<sohrab>
how about hash? is that also more complicated than arrays?
<wallerdev>
yeah a set is basically a hash with no values for the keys
<havenwood>
sohrab: You'll only very rarely see an OpenStruct or Rinda::Tuplespace. A Struct, Set and SortedSet are more common but not ubiquitous like Array and Hash.
SouL_|_ has quit [Ping timeout: 264 seconds]
<GaryOak_>
OpenStruct is almost like a JS object
<sohrab>
cool. i'm learning a ton. thanks alls
scripore has quit [Quit: This computer has gone to sleep]
DerisiveLogic has quit [Read error: Connection reset by peer]
DerisiveLogic has joined #ruby
startupality has quit [Quit: startupality]
nszceta has joined #ruby
mrmargolis has quit [Ping timeout: 248 seconds]
SouL_|_ has joined #ruby
evanjs has quit [Remote host closed the connection]
tsipanov has joined #ruby
momomomomo has quit [Quit: momomomomo]
scripore has joined #ruby
<dudedudeman>
i was just reading about struct, enumerators and Enumerator::lazy at lunch today. this is well timed. lol
startupality has joined #ruby
<Brozo>
lol
metalic has joined #ruby
Rickmasta has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<sohrab>
dudedudeman: where? for a class?
SouL_|_ has quit [Ping timeout: 246 seconds]
SouL_|_ has joined #ruby
<dudedudeman>
nope! i'm self teaching, learning from anything and everything. I have a mentor here at work that is guiding me through things, i peep this chat often to see what people are learning about, I am reading the pick axe book(and other sources) in any spare time, I am attending weekly hacknights in my area, and I'm working on a couple projects to help myself learn
<dudedudeman>
i would LOVE to be in a class for this, but, my time at college has come and gone
Technodrome has joined #ruby
scripore has quit [Client Quit]
Rickmasta has joined #ruby
avgerinos has joined #ruby
shoutsid has quit [Remote host closed the connection]
<Brozo>
I'm on the opposite end of the spectrum
nszceta_ has joined #ruby
_honning_ has joined #ruby
<dudedudeman>
i bring the pick axe book with me to work, and read it over lunch
evanjs has joined #ruby
<dudedudeman>
how so, Brozo?
<Brozo>
I'm self-teaching and taking a year off from college while doing the same stuff
<pipework>
dudedudeman: You know there isn't an age limit to college, right?
hollywood has quit [Quit: Leaving]
balazs__ has quit [Ping timeout: 245 seconds]
<weaksauce>
heap is one that is very useful for algorithms in a lot of cases based on my extensive use of them back in a college algorithms class.
mrmargolis has joined #ruby
<pipework>
I mean, they might push back a bit on post-humous students.
<dudedudeman>
pipework: totally! but i did college for 5.5 years, have a lot of debt, and never finished my degree.
SouL_|__ has quit [Ping timeout: 244 seconds]
<dudedudeman>
i actually would like to go back, but not for what i studied(music)
<pipework>
dudedudeman: Fuck degrees! Get paid, pay off debt, go to school to learn.
<sohrab>
dudedudeman: what kind of music?
mjuszczak has joined #ruby
<pipework>
I'd only go for a degree if I ended up with a phd.
oo_ has quit [Remote host closed the connection]
<pipework>
And only then so I could have people call me 'doctor'.
Rickmasta has joined #ruby
jzigmund has quit [Ping timeout: 272 seconds]
<sohrab>
my opinion is that college is a waste for most professions nowadays. free time + internet = decent at most things.
Rickmasta has quit [Max SendQ exceeded]
lsmola_ has quit [Ping timeout: 264 seconds]
doppler has quit [Ping timeout: 246 seconds]
<dudedudeman>
pipework: that's what i'm saying! lol. i'm learning to get my first dev job, and then pay off debt, and may look at school later on if i feel like i may need a masters or something
platosha has quit [Quit: This computer has gone to sleep]
<pipework>
dudedudeman: Psh, I'd say you won't ever need a degree to work in the kinds of places worth working for.
platosha has joined #ruby
Rickmasta has joined #ruby
jottr has joined #ruby
<pipework>
Just be awesome at what you do, if you can get there, you can win at life.
<weaksauce>
sohrab a CS degree from a good school will teach you more than you would likely learn on your own. good breadth.
Rickmasta has quit [Max SendQ exceeded]
<dudedudeman>
sohrab: any and all kinds. i'm weird, i love death metal, EDM, celine dion, lionel ritchie, pop, jazz, blues, whatever
<pipework>
I believe a CS course is great.
<dudedudeman>
to the argument of schools, i will say that a good teach goes a LONG way.
Rickmasta has joined #ruby
<dudedudeman>
someone to challenege you and put you on some deadlines because in reality, you'll have challenges and deadlines in the real world
<pipework>
I use the lack of a degree to filter out companies I wouldn't work for anyways.
granthatcher has quit []
tsipanov has quit []
<pipework>
I don't care to work with degree-holding people, I want to work with awesome people who are smart and good at what they do. A degree simply doesn't provide any degree of confidence in that.
<pipework>
But do what makes you happiest.
rikai has joined #ruby
lsmola__ has quit [Ping timeout: 246 seconds]
jzigmund_ has quit [Ping timeout: 250 seconds]
jobewan has joined #ruby
<sohrab>
weaksauce: yeah i guess the ideal would be a passionate person who takes a good CS curriculum, but i think dispassionate people in a CS program might not turn out so great and a passionate autodidact might turn out alright too
metalic has quit [Quit: Leaving]
claw has quit [Ping timeout: 240 seconds]
Dreamer3 has joined #ruby
MasterPiece has joined #ruby
jzigmund has joined #ruby
claw has joined #ruby
tenseiten is now known as seitensei
cpt_yossarian has joined #ruby
<weaksauce>
sohrab I think the trickier subjects would not be as good to self teach. I personally wouldn't have gone through a self taught DSP curriculum or a probability and stats curriculum if I self taught.
<Brozo>
I've been going around to meetups and there are a lot of people willing to help and provide guidance.
<dudedudeman>
see, that's exactly how i feel. stats? me and a book? mroe like me and a knife through my eyeball
<weaksauce>
but yeah if you don't give a shit either way... you are not going to be very good regardless of the school
<Brozo>
Not that it's a replacement for a cs program but i wouldn't know
<dudedudeman>
Brozo: meetups are great! i consider myself lucky that there's a really good one in my area
<sohrab>
weaksauce: how does knowing that stuff help you?
<Brozo>
and building the network is really cool because i met a node.js guy who put me in touch with an ios dev
<sohrab>
curious, bc i want to learn all the fundamentals
Lissie has quit []
iamninja_ has joined #ruby
SouL_|_ has joined #ruby
DEA7TH has quit [Changing host]
DEA7TH has joined #ruby
rdark has joined #ruby
<weaksauce>
sohrab it gives you a good base to know where to study if you need and to know where to look for solutions to problems that you didn't know that you had.
SouL_|_ has quit [Read error: Connection reset by peer]
elaptics is now known as elaptics_away
dseitz has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<weaksauce>
kind of removes you from the "I didn't know I didn't know" section of the ignorance scale.
blazes816 is now known as tcrypt
<sohrab>
weaksauce: yeah that's a problem i face :|
gfawcettpq has quit [Ping timeout: 255 seconds]
lidenskap has quit [Remote host closed the connection]
colorisco has quit [Ping timeout: 276 seconds]
pdoherty has joined #ruby
willharrison has joined #ruby
<weaksauce>
sorry it's not the scale of ignorance, it's the stages of competence
<Ellis>
is there something wrong with this syntax? @counter == 5 ? return "BINGO" : index += 1
lidenskap has joined #ruby
<sohrab>
yeah i'd like a survey of all the important tools and concepts. is there like a standard CS 101 textbook? i've been looking for one for a while
<audy>
Ellis a little weird that there is a return in there
<Ellis>
audy: can’t we do that?
<audy>
Ellis you can do anything with Ruby!
<Ellis>
but i’m getting a syntax error
mrmargolis has quit [Read error: Connection reset by peer]
<ruboto>
pastebin.com loads slowly for most, has ads which are distracting and has terrible formatting.
<riceandbeans>
weaksauce: I'm trying to use this as a lockfile and yesterday eam told me that that was wrong
lidenskap has joined #ruby
mjuszcza_ has joined #ruby
<Ellis>
weaksauce: i’m creating a method to check if a bingo player got a bingo
<Ellis>
so if the counter == 5 return BINGO, else add one to the index
<weaksauce>
why not `return "BINGO" if @counter == 5` to make your intentions clear
TinkerTyper has quit [Quit: ZNC restarting...]
<Ellis>
weaksuace: i thought about that but then i wondered can i comebine an else to that statement?
SouL_|_ has quit [Ping timeout: 244 seconds]
<weaksauce>
you would put that at the top of your checks.
<weaksauce>
there is no other statement
mjuszczak has quit [Ping timeout: 244 seconds]
<weaksauce>
gist your code and someone can suggest a better way to write that statement
<weaksauce>
riceandbeans I see. I am not privy to that conversation so I don't know. perhaps you could gist the code as well?
workmad3 has quit [Ping timeout: 250 seconds]
braincrash has joined #ruby
colorisco has joined #ruby
vim_shimm has joined #ruby
freerobby has joined #ruby
JDiPierr_ has quit [Read error: Connection reset by peer]
ndrei has joined #ruby
<sohrab>
weaksauce: was there a CS 101 book that stuck out in your mind? i've found ones for other subjects, but idk if there's a famous textbook that provides an overview of everything. sicp is recommended, but i'm looking for a standard boring textbook
<weaksauce>
you are using ruby gems compiled for a different version of ruby
JDiPierro has joined #ruby
hazelux has quit []
<dudedudeman>
sohrab: harvard's edX program has a really cool, free, online course where they go over a CS 101 type of curriculum and all that. videos, examples, 'tests', and i think if you want, you can pay for a certificate of completion once you finish it. it's also at your own pace, so you can blow through it if you want, or take your time
lkba_ has joined #ruby
<eckod>
weaksauce: so, i used the ansible rvm playbook to deploy a local rvm version. ive never had it not work before...
<weaksauce>
sohrab CS is pretty vast a subject. I am not aware of a book that covers it all really
<sohrab>
dudedudeman: i startd that course, but i didn't like it. didn't like the style. i just want basically a reference book that explains all the concepts simply
<weaksauce>
eckod not sure.
A205B064 has joined #ruby
<Ellis>
thank you ^^
claw has quit [Ping timeout: 256 seconds]
claw has joined #ruby
baroquebobcat has quit [Quit: baroquebobcat]
wallerdev has quit [Quit: wallerdev]
<dudedudeman>
sohrab: ah, word. I kind of did the same thing. went at it for a month, then stopped. lol.
lkba has quit [Ping timeout: 264 seconds]
lordkryss has quit [Quit: Connection closed for inactivity]
<dudedudeman>
o'reilly has a buy two get one free thing going on now as well. lol
<sohrab>
dudedudeman: huh. i've seen a lot of books like this but i don't want something specifically for ruby. can't believe there isn't a canonical 101 textbook :(
<dudedudeman>
oh i'm sure there is
sevvie has joined #ruby
shoutsid has joined #ruby
mjuszcza_ has quit [Ping timeout: 250 seconds]
lavros has quit [Quit: leaving]
danzilio has quit [Quit: My computer has fallen asleep!]
iasoon has joined #ruby
<dudedudeman>
i certainly don't know one, though. :(
lidenskap has quit [Remote host closed the connection]
<djbkd>
there's supposedly an answer companion (teacher's edition) but I haven't acquired a copy. Would be really good if you're doing the autodidactic thing
<sohrab>
cool
gauke has joined #ruby
xploshioon has joined #ruby
<sohrab>
i gotta head out. talk to y'all later
<dudedudeman>
good luck with the things!
<Brozo>
bye
<sohrab>
lol i always need luck with things :)
<sohrab>
*the things
chrishough has joined #ruby
TinkerTyper has joined #ruby
ScorpusKahn has quit [Quit: Konversation terminated!]
dstarh has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
cjim_ has joined #ruby
yfeldblu_ has joined #ruby
yqt has joined #ruby
cjim_ has quit [Client Quit]
SouL_|_ has quit [Ping timeout: 250 seconds]
turtil has joined #ruby
ta has joined #ruby
_honning_ has quit [Ping timeout: 276 seconds]
gauke_ has joined #ruby
ley has joined #ruby
ta has quit [Remote host closed the connection]
ta has joined #ruby
simonewestphal has quit [Quit: simonewestphal]
<abyss>
I'd like to write simple rest api app with webrick or other embedded server. Anyone knows any tutorial or book how to do it?
|\|370 has joined #ruby
rshetty has quit [Remote host closed the connection]
msmith has joined #ruby
<ley>
any body in here wish he could knew ruby earlier before all these DSL happened and now i c
Cloudhand has joined #ruby
<dudedudeman>
I have some forms that take user input, and I'd like to force the form to only accept certain combinations of input data(digits, letters, . ) is a regex the best way to do this?
<dudedudeman>
and another way would be .digitdigitdigit
<dudedudeman>
so .3258
msmith_ has quit [Ping timeout: 256 seconds]
<dudedudeman>
and yet another with either yes or no
mostlybadfly has quit [Quit: Connection closed for inactivity]
yfeldblu_ has quit [Ping timeout: 256 seconds]
<abyss>
audy: thank you. I wanted to avoid any frameworks to light app as possible. But if there no other simple aproach to do it fast and easy then I check this.
<weaksauce>
as long as they are simple like that it would be easy
SouL_|_ has joined #ruby
<weaksauce>
dudedudeman^
yfeldblum has joined #ruby
nfk|laptop has quit [Quit: yawn]
mjuszczak has quit []
rikai has quit [Ping timeout: 250 seconds]
<dudedudeman>
that's as complex as they get. 80.84, .3134, .3280, 3, yes, (insert date here)
<dudedudeman>
that's how i would fill out the form now as it stands
danzilio has joined #ruby
ley_ has joined #ruby
sinkensabe has joined #ruby
tus has quit [Ping timeout: 240 seconds]
startupality has quit [Quit: startupality]
grzywacz has joined #ruby
<weaksauce>
play around on that. something like \b\d{2}.\d{2}\b should do it for the first case
RegulationD has quit [Ping timeout: 272 seconds]
<Synthead>
I'm looking to write a custom RoR helper that uses blocks like so: instance_array(instances, :name) do |instance| ... end. I want it to build an array while making its currently-iterated "instance" available inside the block (much like my_array.each do |element| ... end). How can I do this, and what would the syntax look like?
<weaksauce>
actually you need to escape the . like \.
patcable has joined #ruby
sigurding has joined #ruby
ley has quit [Ping timeout: 250 seconds]
mjuszczak has joined #ruby
<dudedudeman>
i'm going to go play with that. i had heard of rubular before, but regex are something i know little to nothing about
<dudedudeman>
but it does sound like this would work for me
scripore has joined #ruby
<weaksauce>
try a bunch of different inputs and see if you can break your regex by accepting bad input. for instance if you don't escape the . it will work for 80R10
<weaksauce>
or 80 10 or whatever
scripore has quit [Client Quit]
<dudedudeman>
my browser hates rubular for some reason
_honning_ has joined #ruby
<dudedudeman>
80.23 looks like 00 03
<Synthead>
dudedudeman: . literally means "anything" (including \.)
yfeldblum has quit [Ping timeout: 252 seconds]
cjim_ has joined #ruby
<Synthead>
dudedudeman: that's why .* selects everything, it literally means (zero or more anythings)
Juanchito has quit [Quit: Connection closed for inactivity]
yfeldblum has joined #ruby
sinkensabe has quit [Remote host closed the connection]
sinkensabe has joined #ruby
rshetty has quit [Remote host closed the connection]
<Synthead>
dudedudeman: . is special regex syntax, \. is a literal "." and is not regex syntax
rshetty has joined #ruby
<weaksauce>
.* is also greedy. it will try to match as much as possible.
<patcable>
hmm... I think i found a bug in Digest::SHA512 in ruby 2.2.2: "Base64.encode64(Digest::SHA512.digest("blah" + "coolsalt") + "coolsalt").chomp!" outputs "\n" in the digest after a certain amount of characters.
<dudedudeman>
i don't even know what to believe anymore
<Synthead>
dudedudeman: look at the . in the regex quick reference
<dudedudeman>
any single character
<apeiros>
patcable: and in that place, \n should not be present? because base64 is defined to have \n
<weaksauce>
dudedudeman there is a saying that I will paraphrase: "You have a problem and you try to solve it using regular expressions... now you have two problems"
<dudedudeman>
weaksauce: dammit
sinkensabe has quit [Remote host closed the connection]
<patcable>
apeiros: yeah, i checked with different libraries -- they kill that \n
jwingfi has joined #ruby
<patcable>
apeiros: i.e. i tried with python and got a usable hash.
<apeiros>
patcable: and how do you determine which one is correct?
scripore has joined #ruby
<patcable>
apeiros: well one causes my ldap server to segfault when i try to bind against it
beneggett has joined #ruby
<apeiros>
patcable: I'd say a segfaulting server is buggy either way
<patcable>
apeiros: the other one (that lacks the \n) is fine
badhatter has quit [Ping timeout: 248 seconds]
kblake has quit [Remote host closed the connection]
<weaksauce>
dudedudeman don't get me wrong... regex is a valuable tool but it's complex and easy to mess up your expression and match too much or too little or completely wrong stuff.
<apeiros>
patcable: I'd go check the ldap specs
<weaksauce>
dudedudeman and it's difficult to read.
_honning_ has quit [Ping timeout: 264 seconds]
<patcable>
apeiros: in any case, other libraries (also tried one in C) omit the newline and ruby still has it, which seems problematic
<apeiros>
patcable: though I'm not even sure that's proper. you didn't tell us in where you found that.
<dudedudeman>
weaksauce: this totally makes sense. i don't want to get too wrapped up in to it, but when i see that (yes|no) would help me force my input to either be yes or no, i personally think that's pretty slick
<weaksauce>
dudedudeman beyond any basic regex I would put it into whitespace insensitive mode and put each logical group on separate lines
jwingfi has quit [Remote host closed the connection]
<weaksauce>
you can do that by adding a x to the trailing slash of the regex
startupality has joined #ruby
<jhass>
patcable: use strict_encode64
<apeiros>
patcable: if/when you file a bug - strict_encode64 is the …
badhatter has joined #ruby
kblake has joined #ruby
* apeiros
smacks jhass :<
frem has joined #ruby
Rickmasta has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<jhass>
uh, did I miss something?
workmad3 has joined #ruby
<apeiros>
no. you beat me to it.
revoohc has quit [Quit: revoohc]
<jhass>
oh, yw then
evanjs has quit [Remote host closed the connection]
<Ellis>
can anyone recommend a great source that explains blocs, procs, and lambdas?
freerobby has quit [Quit: Leaving.]
<apeiros>
patcable: and would you mind telling us where you actually found that piece of code?
a5i has quit [Quit: Connection closed for inactivity]
Bira has quit [Remote host closed the connection]
decoponio has quit [Quit: Leaving...]
<apeiros>
because I don't see Digest::SHA512 using encode64…
<patcable>
no, i'm trying to build something that will spit out a base64 encoded digest::sha512
<apeiros>
ah, you mean *you* call the encode64
<patcable>
indeed, strict_encode64 is the solution to my issues
<patcable>
yes
<jhass>
patcable: I'd still file a bug against the ldap server
<apeiros>
yeah, well, as said, base64 is specified to include a newline.
<jhass>
it shouldn't segfault on invalid input
<patcable>
"line feeds are added every 60 encoded characters" was a new thing to me
<apeiros>
s/a newline/newlines/
<patcable>
which makes sense, just didn't expect it in this instance. yeah, the openldap folks should know adding \n to a userpassword entry causes a segfault though
freerobby has joined #ruby
<jhass>
patcable: such segfaults can be an entry point to exploit it in some way in fact, it hints input validation is going very wrong there
<apeiros>
oy, openldap? that's sad :(
mrmargolis has quit [Read error: Connection reset by peer]
mary5030 has joined #ruby
mrmargolis has joined #ruby
<apeiros>
segfault is always a bug. already said that :D
mary5030_ has quit [Read error: Connection reset by peer]
<jhass>
I'm just strengthening your point! :P
<patcable>
haha yeah, that much I knew
<apeiros>
jhass: ok!
ldnunes_ has joined #ruby
<apeiros>
I guess I'm cranky today
<workmad3>
apeiros: and that's different from normal how...? :P
<jhass>
workmad3: he realizes it
<patcable>
in any case, thanks both of you. (and, next time, i'll look up the function first. doh)
<apeiros>
workmad3: ( `Д´)=◯)`ν°)
<apeiros>
;-p
relix has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<apeiros>
yes, yes, I was totally waiting for a chance to use this emoji
<havenwood>
Ellis: Like a block you can pass around. A nice MLT, mutton, lettuce, and tomato sandwich, where the mutton is nice and lean and the tomatoes are ripe.
yfeldblum has quit [Ping timeout: 245 seconds]
wallerdev has joined #ruby
yfeldblum has joined #ruby
<Ellis>
err ill come back when im not confused. thanks for the info though
<havenwood>
Ellis: A proc or lambda is like a block you can assign a variable to.
danzilio has quit [Quit: My computer has fallen asleep!]
<Ellis>
so why not just have either a proc or a lambda, why both
<toretore>
Ellis: don't worry about the difference, they're the same
<Ellis>
hah
<toretore>
for most intents and purposes, these are the same: ->(a){}; proc{|a| }; lambda{|a| }
<havenwood>
Ellis: Because of Tennent's Correspondence Principle or some such gibberish. They are different in a couple ways but don't worry about it.
<toretore>
they all return a function, which can be called by doing fn.call(a)
<baweaver>
main snafu is that lambdas are touchy about number of arguments and behaves differently when you use return.
<toretore>
nothing more, nothing less
<Ellis>
baweaver: thank you
<canton7>
procs/blocks behave more like you'd expect a block of code to behave - e.g. 'return' returns from the enclosing method. 'lambda' behaves more like you'd expect a method to behave
<baweaver>
that ^
<baweaver>
it's subtle but enough that you want to remember it at least.
<baweaver>
now as to why I normally use them, read through functional javascript by fogus
<ninjs>
havenwood: sorry, how would I do so? The ways I've searched show lots of ways to change by the information *on* the line, but not by line number
wallerdev has joined #ruby
<havenwood>
ninjs: Do you want to insert a line between existing lines or overwrite a line?
<ninjs>
I want to overwrite the line with new data
Cloudhand has quit [Ping timeout: 255 seconds]
<havenwood>
ninjs: There are various ways depending on how efficient you want to be with not reading the contents of the file into memory. Care about huge files or want short and sweet code?
<ninjs>
havenwood: All of the files are the same size and right now I'm reading the files with File.readlines(file).map(&:chomp) and writing them to an array, then checking a spot in the array to make sure it's a file that should be changed
<jhass>
yes, but without the decode it double encodes an already encoded one
ghr has joined #ruby
longfeet has joined #ruby
<apeiros>
ah
<apeiros>
it's probably the easiest. the less easy variant would be using gsub on invalid chars
<jhass>
I basically just wonder if there's a smarter variant that recognizes escape sequences and skips them
<ninjs>
wait jhass I think I got you
blackmesa has joined #ruby
<jhass>
it's in a Rails context btw, if that makes any difference (doubt it)
benegget_ has joined #ruby
vasilakisfil has joined #ruby
<jhass>
mh, should check if addressable has something
<Dakota-choad>
Help a noob please! I need a ruby reggae that will match everything between the last - and first . so out of a hostname that looks like this site-name-application1.mysite.com I would return only application without the numeral. Thanks.
<Dakota-choad>
regex
beneggett has quit [Ping timeout: 248 seconds]
<havenwood>
jhass: transliterate
<vasilakisfil>
ok... I want to do something xtreme I hope it is possible.. can I somehow check if a method accepts regular arguments or keyword arguments ?
<vasilakisfil>
actually it's a lamda not a method
<vasilakisfil>
and I also want to check if one of them has a default parameter :P
<jhass>
havenwood: I don't follow?
griffindy has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<jhass>
momomomomo: thanks, I'm going to keep the regular URI.parse and just use Addressable for normalizing encoding :)
<momomomomo>
oh they did merge it
<momomomomo>
nevermind
doodlehaus has quit [Remote host closed the connection]
Technodrome has joined #ruby
<havenwood>
vasilakisfil: Here's an example of using #parameters to see how many args and keywords a method/proc/lambda can take: https://gist.github.com/havenwood/9163507
scripore has quit [Quit: This computer has gone to sleep]
Ellis has joined #ruby
<havenwood>
vasilakisfil: So `{:arguments=>1..1, :keywords=>0..1}` would mean one mandatory arg and one optional kwarg.
sinkensabe has quit [Remote host closed the connection]
DenSchub has left #ruby ["Leaving."]
<momomomomo>
oh nope, they fixed it in signet, but not with Addressable
sagittarian has joined #ruby
nobitanobi has joined #ruby
Igorshp has joined #ruby
scripore has joined #ruby
Soda has quit [Remote host closed the connection]
mjuszczak has joined #ruby
<jhass>
Dakota-choad: prepare a rubular.com with more example input and your attempt so far ;)
milesmatthias has quit [Remote host closed the connection]
<dudedudeman>
whoa, that was a hot minute ago. lol
<ninjs>
havenwood: My initial thought was to read the file and put it into the claim array (already done) then just write the changes to the array and then push that back to the file.
<havenwood>
ninjs: Did that work? Have you tried rejoining the Array on "\n"s paired with File.write yet?
<ninjs>
No I haven't tried that. I forgot that I needed to reappend "\n"
<havenwood>
ninjs: Try that!
<vasilakisfil>
ah thanks havenwood!
<havenwood>
All pending tickets marked "feedback needed
<havenwood>
DeBot: l
<DeBot>
␣␣␣-␣␣␣n␣␣␣-␣␣␣␣␣␣ [l] 1/12
Bira has quit [Remote host closed the connection]
<havenwood>
Dash!
<ninjs>
so would it be like array.each do |line|; line << "\n"; end?
Lissie has joined #ruby
workmad3 has quit [Ping timeout: 255 seconds]
<havenwood>
vasilakisfil: You're welcome!
Ellis has joined #ruby
<havenwood>
vasilakisfil: Does the #arity_range thing output make sense to you or too confusing?
mrmargol_ has joined #ruby
quimrstorres has joined #ruby
<havenwood>
ninjs: array.join "\n"
segfalt has quit [Quit: segfalt]
<havenwood>
DeBot: s
<DeBot>
␣␣␣-␣␣␣n␣␣␣-␣␣␣␣␣␣ [ls] 2/12
<GaryOak_>
DeBot: t
<DeBot>
␣␣␣-t␣␣n␣t␣-␣␣t␣␣t [ls] 2/12
<apeiros>
DeBot: era
<DeBot>
␣␣␣-tr␣n␣t␣-␣␣t␣␣t [lsea] 4/12
<havenwood>
DeBot: u
<DeBot>
␣␣␣-tr␣n␣t␣-␣ut␣ut [lsea] 4/12
<havenwood>
ut_ut
<apeiros>
gems?
<havenwood>
ya
<GaryOak_>
DeBot: p
<DeBot>
␣␣␣-tr␣n␣t␣-␣utput [lsea] 4/12
<havenwood>
DeBot: o
<DeBot>
␣␣␣-tr␣n␣t␣-output [lsea] 4/12
mrmargolis has quit [Ping timeout: 245 seconds]
<GaryOak_>
DeBot: i
<DeBot>
␣i␣-trinit␣-output [lsea] 4/12
wallerdev has quit [Quit: wallerdev]
<vasilakisfil>
havenwood makes sense!
sinkensabe has joined #ruby
<havenwood>
vasilakisfil: nice! :)
fred1807 has joined #ruby
<jhass>
DeBot: y
<DeBot>
␣i␣-trinity-output [lsea] 4/12
<GaryOak_>
DeBot: d
<DeBot>
␣i␣-trinity-output [lsead] 5/12
* apeiros
wonders what that trinity thingy is
<GaryOak_>
DeBot: m
<DeBot>
␣i␣-trinity-output [lseadm] 6/12
<ninjs>
how do you set a variable to the output of a block?
<jhass>
ninjs: "output"? you mean return value?
<ninjs>
yes sorry
<jhass>
foo = yield
<havenwood>
ninjs: tried just assigning the variable?
wallerdev has joined #ruby
ghormoon has quit [Ping timeout: 255 seconds]
<xxneolithicxx>
organizational question: you create a gem and the lib has resources (JSON files) loaded by class instances on creation. your dirs are organized by module /lib/<gem name>/module/class.rb . Where would you put resources?
shock_one has quit [Remote host closed the connection]
<havenwood>
Synthead: You're welcome!
<jhass>
xxneolithicxx: ^ well, for your gem it should return something
sankaber has joined #ruby
wldcordeiro has joined #ruby
<jhass>
when installed
lidenskap has quit [Remote host closed the connection]
Lissie_ has joined #ruby
_blizzy_ has quit [Ping timeout: 272 seconds]
<havenwood>
DeBot: p
<DeBot>
␣i␣-trinity-output [lseadm] 6/12
Zai00 has quit [Quit: Zai00]
Lissie has quit [Read error: Connection reset by peer]
sinkensabe has quit [Remote host closed the connection]
|\|370 has quit []
baweaver has joined #ruby
<GaryOak_>
DeBot: f
<DeBot>
fi␣-trinity-output [lseadm] 6/12
cjim_ has quit [Quit: (null)]
<jhass>
DeBot: s
<DeBot>
fi␣-trinity-output [lseadm] 6/12
<GaryOak_>
DeBot: g
<DeBot>
fi␣-trinity-output [lseadmg] 7/12
<jhass>
oh, had that already
Ellis has quit [Quit: Ellis]
<xxneolithicxx>
jhass: maybe i worded that badly, was more an organizational question of if your gem lib has resources other than ruby files would you place them in the same dir as the ruby file that uses it or somewhere else.
<xxneolithicxx>
jhass: i guess it also depends on gem packaging standards which i dont know about
<jhass>
xxneolithicxx: Gem.datadir should return the path to data/ next to oyur lib/
nettoweb has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<jhass>
if I interpreted it correctly
milesmatthias has joined #ruby
lidenskap has joined #ruby
<GaryOak_>
DeBot: x
<DeBot>
fix-trinity-output [lseadmg] 7/12 You won!
cocotton has quit [Remote host closed the connection]
<havenwood>
"Trinity outputs fastq files that have been 'corrected'."
Brozo has joined #ruby
ramfjord has joined #ruby
philip1 has quit [Ping timeout: 245 seconds]
evanjs has joined #ruby
cpt_yossarian has quit [Read error: Connection reset by peer]
fryguy9 has quit [Read error: Connection reset by peer]
fryguy91 has joined #ruby
cpt_yossarian has joined #ruby
michaeldeol has joined #ruby
chinmay_dd has quit [Quit: See ya!]
elaptics is now known as elaptics_away
vasilakisfil has quit [Ping timeout: 265 seconds]
Ellis has joined #ruby
Pharaoh2 has quit [Remote host closed the connection]
RegulationD has joined #ruby
Ellis has quit [Client Quit]
Brozo has quit [Remote host closed the connection]
Brozo has joined #ruby
Technodrome has quit [Quit: Technodrome]
plribeiro30001 has joined #ruby
plribeiro3000 has quit [Ping timeout: 250 seconds]
benegget_ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
badhatter has quit [Read error: Connection reset by peer]
RegulationD has quit [Ping timeout: 256 seconds]
mrmargol_ has quit [Remote host closed the connection]
<Dakota-choad>
here is my rublar: .*?(?:[a-z][a-z]+).*?(?:[a-z][a-z]+).*?((?:[a-z][a-z]+)) but when i run it like so Facter.value(:hostname).*?(?:[a-z][a-z]+).*?(?:[a-z][a-z]+).*?((?:[a-z][a-z]+)) I get some syntax errors. Any ideas
badhatter has joined #ruby
freerobby has quit [Quit: Leaving.]
josephleon has joined #ruby
odin22 has quit [Read error: Connection reset by peer]
Bira has joined #ruby
tmoor has joined #ruby
<jhass>
Dakota-choad: it's called regex or regular expression in full, http://rubular.com is a site ;)
spyderman4g63 has joined #ruby
Klerko has joined #ruby
<ninjs>
What's the opposite of File.readlines? it's sure not File.writelines... haha
<Klerko>
Hey
allcentury has quit [Ping timeout: 252 seconds]
<Klerko>
How hard will Ruby be to learn for a C++ developer?
jottr_ has joined #ruby
jottr has quit [Read error: Connection reset by peer]
<shellfu>
Dakota-choad, hop into #puppet for that. In addition if that is a customer facter fact you cannot simply append a regex to a facter value
barkerd427 is now known as zz_barkerd427
<toretore>
Klerko: probably not very; though i don't know c++ myself
<Klerko>
Anyone else that knows?
Lissie_ has quit [Read error: Connection reset by peer]
allcentury has joined #ruby
Lissie has joined #ruby
davedev2_ has joined #ruby
<Dakota-choad>
Thanks.
davedev24_ has quit [Ping timeout: 264 seconds]
havenwood has quit []
pdoherty has quit [Ping timeout: 252 seconds]
<diegoviola>
Klerko: I don't think there's a right answer to that question, difficulty with learning anything probably varies with every individual
EasyCo has joined #ruby
vim_shimm has quit [Ping timeout: 256 seconds]
<diegoviola>
Klerko: I believe you already know how objects work, it should be straightforward
<diegoviola>
although the object model in C++ is probably different to the one in Ruby
soulcake has quit [Quit: Quack.]
<diegoviola>
I don't know C++ either
<Senjai>
diegoviola: Very different.
<jhass>
Klerko: I've seen both ends of the spectrum for people that called themselves C++ programmer, for some it was very hard for some it was very easy
soulcake has joined #ruby
<Senjai>
diegoviola: Ruby doesnt have primitives, for example.
evanjs has quit [Remote host closed the connection]
enebo has quit [Quit: enebo]
vsh_ has quit [Ping timeout: 245 seconds]
<xxneolithicxx>
i learned C++ when i was about 13, and Ruby was easy to learn except for its heavy use and passing of lambda's looked different than anything else id ever worked in and that was actually the most confusing
<Klerko>
jhass, I have no problem learning new things as I have, over my life, been surrounded by abstraction.
mostlybadfly has joined #ruby
<diegoviola>
Senjai: right
Ellis has joined #ruby
<jhass>
Klerko: I'd say don't worry and just go for it, usually learning a new language teaches you something that you can apply in general, even if you're not going to use it a lot
Ellis has left #ruby [#ruby]
davedev2_ has quit [Ping timeout: 240 seconds]
philip1 has joined #ruby
<jhass>
at very least it'll make learning the next language easier with every one you learned
spyderman4g63 has quit [Ping timeout: 250 seconds]
<Synthead>
__method__ returns a symbol. I want to have a recursive function call itself without referring to itself literally. essentially __method__(foo) (but calling itself instead of trying to call a symbol). how can I do this?
Igorshp has quit [Remote host closed the connection]
<jhass>
Synthead: (public_)send
Hijiri has joined #ruby
<jhass>
Synthead: though I'd be curious about the usecase
mengu has quit [Remote host closed the connection]
<Synthead>
jhass: it's a recursive function. it calls itself
jimms has joined #ruby
<Synthead>
jhass: iterates over some items until there aren't any more to process, then stops the recursion
<apeiros>
I *think* he got that part :D
mjuszczak has joined #ruby
<Synthead>
I figured as much :p
jimms has quit [Client Quit]
<apeiros>
the question is why you don't want to refer to it literally
<Synthead>
but I mean, are recursive functions bad practice or something?
scripore has quit [Quit: This computer has gone to sleep]
<Synthead>
apeiros: so if I change the function name, it doesn't break. I don't think it should break in this case
<jhass>
Synthead: no, I just can't come up why you wouldn't just write the method name
<apeiros>
in ruby it's generally not a good idea. stack is quite limited.
<jhass>
eh, not worth it
<jhass>
don't be smart, be explicit
<apeiros>
somewhere around 4k callstack depth it's end of line
<apeiros>
and with send you just half it
<jhass>
write a test that fails if you rename it without changing the recursive call
<apeiros>
and IMO what jhass said
<Synthead>
jhass: well that's easy ... change the method name and when it tries to call itself by the old name, it's undefined
<jhass>
see, no need to be smart
shellfu is now known as shellfu_afk
<jhass>
you'll just confuse the hell out of people who come after you
lidenskap has quit [Remote host closed the connection]
dopie has quit [Ping timeout: 250 seconds]
<jhass>
I thought you'd be in some metaprogramming context and wondered what that would look like without having the method name available
<jhass>
I didn't even imagine your reason could be "more resistant to change"
<Synthead>
jhass: doesn't seem like a very dynamic way to write code. to each their own, though.
wldcordeiro has quit [Ping timeout: 248 seconds]
allcentury has quit [Ping timeout: 246 seconds]
jenrzzz has joined #ruby
<jhass>
just because Ruby allows for ton of dynamic code, doesn't mean it's a good idea to use it all the time
fryguy91 has quit [Quit: Leaving.]
kyrylo_ has quit [Ping timeout: 272 seconds]
Spami has quit [Quit: Leaving]
dopie has joined #ruby
havenwood has joined #ruby
ki0 has quit [Remote host closed the connection]
<Synthead>
is there a better way to change the first hash element's value without knowing what the key is than this? http://pastie.org/10108244
<apeiros>
Synthead: positional hash access is a code smell
<apeiros>
and no, I don't think there's a better way than yours.
michaeld_ has joined #ruby
<Synthead>
apeiros: ok, thanks! I'll consider using arrays instead
ddarkpassenger has joined #ruby
plribeiro30001 has quit [Quit: Leaving.]
Lissie has quit [Read error: Connection reset by peer]
Igorshp has joined #ruby
Lissie_ has joined #ruby
Astrologos_ has joined #ruby
nobitanobi has quit [Remote host closed the connection]
galeido_ has quit [Ping timeout: 272 seconds]
badhatter has quit [Ping timeout: 264 seconds]
thejoecarroll has quit [Ping timeout: 272 seconds]
MuffinPimp has quit [Ping timeout: 272 seconds]
bier has quit [Ping timeout: 272 seconds]
michaeldeol has quit [Ping timeout: 244 seconds]
mjuszczak has quit []
dorei has quit [Ping timeout: 250 seconds]
quimrstorres has quit [Remote host closed the connection]
Lissie_ has quit [Read error: Connection reset by peer]
baroquebobcat_ has joined #ruby
ki0 has joined #ruby
dfinninger has quit [Remote host closed the connection]
baroquebobcat has quit [Ping timeout: 244 seconds]
baroquebobcat_ is now known as baroquebobcat
Lissie has joined #ruby
jerius has quit [Quit: /quit]
akkad has joined #ruby
musashi1 has joined #ruby
ghr has quit [Ping timeout: 256 seconds]
JimmyNeutron has joined #ruby
JimmyNeutron has quit [Max SendQ exceeded]
ylluminarious has joined #ruby
sankaber has joined #ruby
JimmyNeutron has joined #ruby
dorei has joined #ruby
gaboesquivel has quit []
tus has joined #ruby
shoutsid has quit [Remote host closed the connection]
<mwlang>
when I have a potential for a nil argument and I want to return nil or some attribute of the passed argument, is it better to do: def a(bah); bah and bah[1]; end or def a(bah); bah && bah[1]; end ? (that is use “&&” or use “and”)
<Synthead>
what's a clean way that I can return everything in an array but the first element? like the antonym of array.slice(0)?
nobitanobi has joined #ruby
existensil has quit [Ping timeout: 264 seconds]
<mwlang>
Synthead: some_array[1, some_array.size]
doodlehaus has joined #ruby
<mwlang>
or, if you want to remove the element from the array: some_array.shift
tus has quit [Client Quit]
<mwlang>
That’ll return the first item in the array and remove it at the same time.
<Hijiri>
diegoviola
predator217 has joined #ruby
<Hijiri>
holy shit the game is working with wine-staging
shock_one has joined #ruby
<Hijiri>
thank you for pointing me to it
baweaver has quit [Remote host closed the connection]
<Synthead>
mwlang: there isn't something similar to {}.except
hiyosi has joined #ruby
<Hijiri>
diegoviola++ in case this room has karma
<Synthead>
mwlang: for Arrays?
fryguy9 has joined #ruby
Cache_Money has joined #ruby
existensil has joined #ruby
tus has joined #ruby
chrisja has quit [Quit: leaving]
b4tm4n has joined #ruby
<b4tm4n>
does bundle install need sudo privileges?
jenrzzz has quit [Ping timeout: 250 seconds]
<Senjai>
b4tm4n: Depends where its installing the gems
vudew has quit [Remote host closed the connection]
predator117 has quit [Ping timeout: 250 seconds]
scripore has quit [Quit: This computer has gone to sleep]
<mwlang>
Synthead: yes
duncannz has joined #ruby
TheNumb has quit [Ping timeout: 264 seconds]
duncannz has quit [Max SendQ exceeded]
Guest123456666 has joined #ruby
vudew has joined #ruby
scripore has joined #ruby
<mwlang>
nevermind my question regarding and vs &&, finally found the answer I was seeking. “Properly understood, and and or are control flow operators, not boolean operators.” http://devblog.avdi.org/2010/08/02/using-and-and-or-in-ruby/ I knew I had read this somewhere a few years ago.
doodlehaus has quit [Remote host closed the connection]
duncannz has joined #ruby
duncannz has quit [Max SendQ exceeded]
sami__ has quit [Ping timeout: 264 seconds]
shock_one has quit [Ping timeout: 250 seconds]
Someguy123 has quit [Ping timeout: 252 seconds]
fryguy9 has quit [Client Quit]
sami has joined #ruby
zorak8 has joined #ruby
<Senjai>
mwlang: Just dont use and and or :P
<mwlang>
Senjai: why not? I needed flow-controlling logic in my use case...
<sohrab>
i want to iterate through a set of values, and if i can't find a value that meets a condition, to do something else. is this possible?
jaequery has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Lissie has quit [Read error: Connection reset by peer]
ki0 has quit [Remote host closed the connection]
Lissie has joined #ruby
jerius has joined #ruby
<bricker>
Senjai: *high-five*
<mwlang>
bricker: Here’s the actual code: @id ||= (item = @identifiers.detect{|d| d.type == '03'} and item.id)
arescorpio has joined #ruby
<mwlang>
basically fetching an id value that may or may not be present.
<Synthead>
mwlang: what is it?
dorei has quit [Ping timeout: 256 seconds]
milesmatthias has quit [Remote host closed the connection]
<Guest123456666>
can anyone help me with implementing a nested comment system similar to comment threading like reddit? i have regular comments working already
ramfjord has joined #ruby
dorei has joined #ruby
Rickmasta has joined #ruby
<mwlang>
Synthead: sorry, I didn’t understand your question.
<Synthead>
mwlang: there isn't something similar to {}.except for Arrays?
scripore has quit [Quit: This computer has gone to sleep]
<Synthead>
mwlang: like [1, 2, 3].except(0) (to return [2, 3])
<Senjai>
mwlang: Thats kind of doing too much
startupality has quit [Quit: startupality]
<mwlang>
Synthead: not sure. That sounds like an active_support extension to me.
<Senjai>
for like, one line
dstarh has joined #ruby
<Senjai>
also, thats unfortunate code to have to work with
<Senjai>
I cant imagine the infrastructure that would require you to write such a thing
<Senjai>
mwlang: Make it readable, break it up into multiple lines
<Synthead>
Senjai: that's a pretty loaded assumption ;)
<Senjai>
Synthead: Yes it is, and I've been wrong dozens of times, but I've also been right dozens of times :P
workmad3 has joined #ruby
<sohrab>
inside a nested conditional, can i do `return x; break`? if i want the conditional to return something and to stop the loop
<Senjai>
Synthead: type == '03' << Hard coded string? That's CRAZY
Astrologos_ has quit [Ping timeout: 256 seconds]
<sohrab>
nested conditional = a conditional inside a loop
<Synthead>
Senjai: I'm not writing this due to some enterprise culprit or whatever, it's for a recursive function
<Senjai>
Synthead: All good, I'm just poking fun
Astrologos_ has joined #ruby
<Senjai>
Synthead: err. you know I was talking to mwlang right
Rollabun_ has quit [Read error: Connection reset by peer]
<Synthead>
Senjai: no worries man. people take the accidental nick things too seriously around here imo
DerisiveLogic has quit [Ping timeout: 256 seconds]
dorei has quit [Ping timeout: 245 seconds]
<mwlang>
Senjai: maybe I need a better pattern for “see if an item’s in an array and if so, return some property of that item. I’m basically pulling data out of large XML structures that I’ve turned into PORO’s
<Senjai>
mwlang: Can you gist the entire code
snockerton has quit [Quit: Leaving.]
msmith has joined #ruby
workmad3 has quit [Ping timeout: 264 seconds]
cajone has quit [Quit: Leaving.]
_honning_ has joined #ruby
dorei has joined #ruby
mjuszczak has quit []
beneggett has quit [Ping timeout: 276 seconds]
vudew has quit [Ping timeout: 240 seconds]
<mwlang>
Senjai: it’s a *lot* of code to gist….want me to try with a bit and then add more at your prompting?
djbkd has joined #ruby
<mwlang>
as to the comment on type == '03' — one step at a time — working code first, then refactor the smells away. :-)
cajone has joined #ruby
a5i has joined #ruby
Astrologos_ has quit [Ping timeout: 244 seconds]
ley_ has quit [Ping timeout: 250 seconds]
Astrologos_ has joined #ruby
cjim_ has joined #ruby
mikecmpbll has quit [Remote host closed the connection]
Pharaoh2 has joined #ruby
cpt_yossarian has quit [Remote host closed the connection]
Pharaoh2 has quit [Remote host closed the connection]
<Senjai>
mwlang: Totally fair, just gist the file that particular code is in
cpt_yossarian has joined #ruby
<frem>
I have a class with a geocode method which is added by a gem and called in magical ways. I want to wrap that method in some error handling. Would `def geocode; safe_geocode { super }; end` pass the normal geocode method into my error handling function as a block?
dorei has quit [Ping timeout: 256 seconds]
dcarmich has joined #ruby
cpt_yossarian has quit [Remote host closed the connection]
<Senjai>
frem: I would just alias the method
Lissie has quit [Quit: My computer has gone to sleep. ZZZzzz…]
<Senjai>
mwlang: Also, I would actually just not memoize that
blackmesa has quit [Quit: WeeChat 1.1.1]
<Senjai>
unless @identifiers.detect is expensive
icarus has quit [Ping timeout: 248 seconds]
juanpablo__ has joined #ruby
<Senjai>
just have it return @identifiers.detect {|d| d.type == PRODUCT_TYPE}.id
WildBamboo-Josh has quit [Quit: Leaving]
<Senjai>
Unless you actually have performance issues, you want to avoid over optimizing
jobewan has quit [Quit: Leaving]
zz_barkerd427 is now known as barkerd427
<mwlang>
Senjai: fair points. the hardcoded strings will get symbolized later into a hash constant like this NOTIF_CODES = { "01" => :early, "02" => :advance, "03" => :confirm, "04" => :update, "05" => :delete }
Rollabunna has joined #ruby
<Senjai>
mwlang: I feel like the values should be the keys, and the keys should be rhe values there
<mwlang>
Senjai: I’ll be processing about 16 to 20 mb files at a time.
ddarkpassenger has quit [Quit: Leaving]
juanpablo_ has quit [Ping timeout: 264 seconds]
<Senjai>
mwlang: And? How often do you call id?
<Senjai>
and how slow isit
laurentide has quit [Quit: Leaving]
<Senjai>
mwlang: I would prefer d.type == NOTIF_CODES[:confirm]
<mwlang>
Senjai: ah, on that, I’m not concerned about.
<Senjai>
in that case
sshao has joined #ruby
<Senjai>
mwlang: Aye, dont memoize unless you have to :P
<Senjai>
Just do the calculation on demand
<Senjai>
unless you have a reason not to
<Senjai>
If you want to memoize
<Senjai>
I'd stick with the code I wrote in the gist
<mwlang>
Senjai: The values come from the XML file….so I need NOTIF_CODES[“01”] to eval to :early so that the code that flow-controls “if notice.early? then …”
<diegoviola>
Hijiri: np
RegulationD has joined #ruby
<Senjai>
mwlang: Gotcha, but you still dont want a magic string there, you probably want to call it something
<diegoviola>
Hijiri: you probably want to join #winehackers and let the devs know about that
<Senjai>
mwlang: You could NOTIF_CODES.invert[:confirm]
<diegoviola>
Hijiri: or #winehq
<Senjai>
Beware calling invert on hashes with duplicate values though, because keys must be unique :P
<diegoviola>
Hijiri: what game is that btw?
juanpablo__ has quit [Ping timeout: 264 seconds]
<Senjai>
mwlang: At least that provides some logical meaning to all of the type checks you're doing
<mwlang>
Senjai: definitely. I agree. I think I’m just confusing you with my rambling. The value “01” only appears in the NOTIF_CODES…I actually get it turned into notice.early? with a def early? NOTIF_CODES[self.value] == :early; end
Astrologos_ has quit []
dorei has joined #ruby
baweaver has joined #ruby
Brozo has quit [Remote host closed the connection]
Igorshp has quit [Remote host closed the connection]
<Senjai>
mwlang: thing.detect {|d| NOTIF_CODES[d] == :confirm } then :P
<Senjai>
its much better to read and reason about intead of dealing with numbers :P
<Senjai>
mwlang: thing.detect {|d| NOTIF_CODES[d.type] == :confirm } then :P
<mwlang>
Senjai: why not thing.detect{|d| d.early?} then
<Senjai>
mwlang: If d has that method, then sure!
<Senjai>
d.confirm? (I think you mean)
longfeet has quit [Ping timeout: 256 seconds]
<mwlang>
Senjai: that’s what I was trying to describe as “my plan” above :-)
doodlehaus has joined #ruby
<Senjai>
mwlang: that would change it to @identifiers.detect(&:confirm?).id
Rickmasta has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
RegulationD has quit [Ping timeout: 256 seconds]
<mwlang>
Senjai: ah…I never thought to do that with detect…I do it all the time with select/reject/map. :-p
<Senjai>
mwlang: :)
superscott[8] has joined #ruby
<mwlang>
Senjai: thanks for the constructive feedback.
<Senjai>
mwlang: Glad we had this chat then
<Senjai>
np
<Senjai>
let me know how it pans out
beans has joined #ruby
jottr_ has quit [Read error: Connection reset by peer]
Brozo has joined #ruby
beans has left #ruby [#ruby]
baweaver has quit [Remote host closed the connection]
<mwlang>
Senjai: Oh, I’m changing it exactly as you described…it is good to go readable.
<mwlang>
sometimes I just don’t realize I went too far without a 2nd pair of eyes.
jottr_ has joined #ruby
GaryOak_ has quit [Remote host closed the connection]
Pharaoh2 has joined #ruby
kubunto has joined #ruby
duderonomy has quit [Ping timeout: 256 seconds]
dstarh has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Astrologos_ has joined #ruby
icebourg has joined #ruby
willharrison has joined #ruby
icebourg has quit [Max SendQ exceeded]
icebourg has joined #ruby
dorei has quit [Ping timeout: 264 seconds]
sankaber has quit [Quit: My Mac has gone to sleep. ZZZzzz…]