agent_white has quit [Read error: Connection reset by peer]
Guest69 has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
railswebdev has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
agent_white has joined #ruby
djellemah has quit [Ping timeout: 260 seconds]
jamesaxl has joined #ruby
<jamesaxl>
hi
<jamesaxl>
is datamapper die?
<bougyman>
iono
<bougyman>
i've always used Sequel
roger_rabbit has joined #ruby
elementaru has joined #ruby
Cohedrin has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Cohedrin has joined #ruby
<jamesaxl>
bougyman, it is good and easy :) thank you
<agent_white>
boogy on
<agent_white>
wayne
hotpancakes has quit []
markholmes has quit [Quit: Leaving]
astrobunny has joined #ruby
pilne has quit [Quit: Quitting!]
djellemah has joined #ruby
charliesome has joined #ruby
Derperperd has quit [Ping timeout: 240 seconds]
montanonic has quit [Ping timeout: 240 seconds]
_main_ has joined #ruby
_main_ has quit [Read error: Connection reset by peer]
__main__ has quit [Read error: No route to host]
_main_ has joined #ruby
jameser has joined #ruby
Pla5tique has joined #ruby
_main_ has quit [Read error: Connection reset by peer]
auxbuss has joined #ruby
__main__ has joined #ruby
<IonutVan_>
quick question: if I want to say that I know ruby and to add it to my cv do I really need to know meta programming as well? :)
auxbuss has quit [Client Quit]
bkxd has joined #ruby
montanonic has joined #ruby
jameser has quit [Ping timeout: 240 seconds]
bkxd has quit [Ping timeout: 255 seconds]
<apeiros>
no
<apeiros>
knowing != being good at
<apeiros>
and for quite a lot of things you don't even need metaprogramming in ruby
<apeiros>
i.e. if you'd write "ruby skill: advanced" (or similar), then I'd expect you to know metaprogramming
govg has joined #ruby
<baweaver>
very exceptionally rarely do I use metaprogramming and I have over 5 years in Ruby.
beilabs has quit [Remote host closed the connection]
msmith has joined #ruby
<IonutVan_>
ok, so basically to be competent in ruby you don't need it
<baweaver>
we probably qualify as advanced right apeiros? :D
beilabs has joined #ruby
<baweaver>
Read Eloquent Ruby
<baweaver>
that's one of the ways to get a more solid base to work off of.
<baweaver>
How much do you currently know?
<IonutVan_>
apeiros, even if you write ruby: advanced on cv, this means that you know probably about it but not really working with it
<baweaver>
For an interview with Google they ask you to rank yourself from 1 to 10 in skills
<baweaver>
I knew a person who put down a 10 on Python
<IonutVan_>
baweaver, a bit of syntax and I thinking to learn a bit more. But not necessary for rails
<baweaver>
Guess who interviewed him?
<baweaver>
IonutVan_: bad idea. Super super bad idea
<baweaver>
learn Ruby well
<baweaver>
you don't get to skip it for Rails
Pla5tique has quit [Ping timeout: 260 seconds]
<IonutVan_>
?
<baweaver>
I interview people for Ruby positions a lot
<baweaver>
and if someone said they know Rails but not really Ruby as a language that's an instant no for me
<IonutVan_>
no, I want to say that I want to learn ruby a bit, nut I don't learn ruby to use it for rails, just to know ruby :)
<baweaver>
Ah
<baweaver>
Just making sure because I've had a lot of people who thought you don't need Ruby strength to do Rails and it ends badly every time
<IonutVan_>
and after that if I really want to go for rails, I can do it
<baweaver>
Well then, if we want to have some fun with it...
<baweaver>
how about a few questions?
beilabs has quit [Ping timeout: 240 seconds]
<baweaver>
We can keep it to the basics and I can mention where to look to find the answers if you get stuck.
<IonutVan_>
can you recommend 2-3 books to progress with?
<baweaver>
Eloquent Ruby and Practical Object Oriented Design in Ruby
<IonutVan_>
I plan to start with "Learn to Program, by Chris Pine"
<baweaver>
past that it depends on what you want to do with it.
hutch34 has joined #ruby
<IonutVan_>
and then with Learn Ruby the Hard Way
<baweaver>
I'd avoid Zed's work. It does a decent job of introducing things but there are better books out there
<IonutVan_>
end what about Programming in Ruby? Is that still current? I see it from 2009
<IonutVan_>
and*
<baweaver>
probably old.
<jamesaxl>
IonutVan_, If you know an advanced Language before, you can put on you CV that you are advanced on Ruby
<baweaver>
jamesaxl: Don't
<baweaver>
because people like me would tear you apart in an interview
Joufflu has joined #ruby
<baweaver>
Never claim to be advanced in something unless you can back it up
beilabs has joined #ruby
<baweaver>
and don't put something on your CV you're not confident in getting drilled on
<baweaver>
I had one person list Haskell proficiency, which is rare, so I drilled them on it.
<baweaver>
didn't know a lick of it when it came down to it
<IonutVan_>
baweaver, so, you recommend starting with Eloquent Ruby and going with Practical Object Oriented Design in Ruby after that? and to forget about learn ruby the hard way and learn to program?
<baweaver>
that does not bode well at all
<jamesaxl>
baweaver, But know 70% of ruby
<baweaver>
jamesaxl: that doesn't make sense to me, rephrase?
<baweaver>
IonutVan_ is Ruby your first language?
<jamesaxl>
baweaver, If someone knows 70 % of ruby ? could he write advanced
astrobunny has quit [Ping timeout: 255 seconds]
<baweaver>
If someone could solidly quantify what 70% is, sure, but I doubt that.
hutch34 has quit [Ping timeout: 260 seconds]
<baweaver>
where do you draw the line on that, it's just too arbitrary a figure.
<baweaver>
It's one of those things that if you have to ask what advanced is you're probably not there yet.
<IonutVan_>
baweaver, no, I used python, perl, c, ... but I don't have 10 years of professional development
<baweaver>
Then you'd probably be fine with Eloquent Ruby
<baweaver>
it's entire goal is to write Ruby like Ruby
<IonutVan_>
[10:23:20] <IonutVan_>and what about Programming in Ruby? Is that still current? I see it from 2009
<baweaver>
POODR may not be necessary if you're already confident in OO.
<baweaver>
[01:23:43] baweaver:probably old.
<jamesaxl>
baweaver, but no one knows ruby 100% even the developer, my skills is about the experience that I have and the problem that I faced
<baweaver>
You're missing my point.
<baweaver>
I was saying that it is a very bad idea to call yourself advanced in Ruby if you're not confident in that statement
<baweaver>
If you are, you can do so, but be warned that people probably will grill you on it
<baweaver>
Back to that previous story....
<jamesaxl>
baweaver, yes I understand that
<baweaver>
At Google they interview you and have you rank yourself on a scale of 1 to 10 on certain skills
<baweaver>
I knew a guy who wrote down 10 on Python
<baweaver>
Do you know who interviewed him on his Python because of that number?
<Pla5tique>
Guido?
<baweaver>
bingo
<baweaver>
said it was the most terrifying experience of his life, but he passed somehow
<Pla5tique>
wow, lol
<baweaver>
Said he's never putting down 10 again
<baweaver>
Guido I think called himself an 8-9 on it.
<baweaver>
I'd say I'm optimistically a 7 in Ruby.
Dimik has quit [Ping timeout: 245 seconds]
<jamesaxl>
baweaver, I do not know about my self :) 0..10 :)
<baweaver>
It's hard to judge
montanonic has quit [Ping timeout: 255 seconds]
<agent_white>
Why would you 10... ever?
<baweaver>
and honestly I think a number is generalizing it too much
<agent_white>
10 assumes you know everything there is to know, and of those things you know them all
<baweaver>
Bingo
lxsameer has quit [Ping timeout: 255 seconds]
<baweaver>
which is why I have a lot of fun interviewing people who put above a 7
<baweaver>
because that's saying you're an expert which means anything is fair game
* baweaver
may be slightly evil
<agent_white>
Yeah that sounds more of a personality question; how willing is this person to admit they do not know - and if so, how eager are they to churn it into the known?
<jamesaxl>
baweaver, that why I do not rank my self, but I believe if someone is Pot for science he will be just 6
<IonutVan_>
thanks a lot for advices :)
<baweaver>
feel free to ask whatever
<baweaver>
we tend to be around
pandaant has joined #ruby
<IonutVan_>
ok
<baweaver>
agent_white: ever heard of Dunning Krueger?
<jamesaxl>
baweaver, even Yukihiro Matsumot
<baweaver>
Short version: Those who know little think they know much, those who know much think they know little
<baweaver>
Matz and the others murder me in C skills. I can barely touch C
<baweaver>
I should probably fix that later, but find it's barely ever relevant to me
<jamesaxl>
baweaver, by the way what is you 1st language that you learn?
* baweaver
thinks about it
<baweaver>
Really I don't entirely remember
<baweaver>
Probably Javascript or PHP. I remember I quit programming for years as a teen because I hated PHP so much
<agent_white>
baweaver: True... only contigency is that asking something like that on a scale is not to question the item scaled, but the person! :P
<baweaver>
indeed
<agent_white>
I mean... who in their right mind asks someone with a 15+ year career "how good are you from 1-10?"
<agent_white>
Kinda a silly question for sure. ;P
<baweaver>
Normally I get sent in for an interview whenever someone says they really know Ruby
<jamesaxl>
baweaver, do you prefer Ruby than many language ?
<baweaver>
Sometimes they really do
<baweaver>
It's normally the first language I reach for
<baweaver>
Then again a lot of my work is in System Administration so rarely do I need another language.
<baweaver>
Not to say I don't know others, but Ruby is very likely my strongest
<IonutVan_>
baweaver, these days, in syadmin/devops they usually go with Go, is that true?
<baweaver>
followed by Javascript and Scala.
<baweaver>
Depends on the shop
<jamesaxl>
baweaver, that is nice
<baweaver>
personally I'm not a fan of Go, but I can use it
<IonutVan_>
scala is on my list as well, but it seems that is really complex
<baweaver>
It takes a bit
<baweaver>
Scala is a huge language
Derperperd has joined #ruby
<jamesaxl>
IonutVan_, depending on the situation
<baweaver>
if you think Ruby comes with a kitchen sink, Scala comes with an entire Iron Chef competition
<IonutVan_>
right :)
<jamesaxl>
IonutVan_, some people suggest Perl and others python, and others ruby and so on
<baweaver>
Kotlin is a more pared down version of it
<IonutVan_>
go probably you can pick up and be good at it in a week or so
msmith has quit [Ping timeout: 245 seconds]
<IonutVan_>
jamesaxl, I know
<baweaver>
JetBrains (iirc) made Kotlin as a Java alt that looks basically like Scala but has some cleaner interop
<baweaver>
The one word reason why Kotlin over Scala: JSON
<baweaver>
It seems that Ruby is a bit rarer and Python tends to take most of the show, but I still strongly prefer Ruby myself.
mistermocha has joined #ruby
<jamesaxl>
baweaver, I think you are fanatic
<baweaver>
Still working on writing a book over Cloud Ops in Ruby, but that'll take a while
* baweaver
shrugs
<baweaver>
perhaps I am, but I get paid for it
<IonutVan_>
baweaver, depends what you want to do with it. I work in scientific computing/research and you need a lot of libraries which you can find in python but not in ruby
<baweaver>
True.
<jamesaxl>
baweaver, then you are not a real fanatic
LoneHermit has joined #ruby
<baweaver>
SciPy, NumPy, and others don't have clean Ruby options yet
Derperperd has quit [Ping timeout: 245 seconds]
<baweaver>
and MIT and friends tend to teach a lot of Python for courses which is where most academic libs come from
<baweaver>
then again there's also R in that domain which is basically a poor man's Matlab
<IonutVan_>
and I have colleagues which works on different projects parsing/analytics/.. and they use scala and some python
<IonutVan_>
work*
<apeiros>
baweaver: na, we're still nooblettes ;-)
<baweaver>
Mind you I'm not saying there's anything wrong in Python
<baweaver>
I just prefer Ruby when given an option
<IonutVan_>
I understand
ramfjord has quit [Ping timeout: 255 seconds]
<baweaver>
Spark is fun if you're far into Scala
<baweaver>
apeiros: yeah, probably right
<apeiros>
I'm quite competent at ruby, but for the last level I still lack too much in the ABI area :-/
mistermocha has quit [Ping timeout: 252 seconds]
<IonutVan_>
I also considered Scala but is a really huge and if you want to know it and to have it on your cv perhaps you need a few good years to work with it daily
<apeiros>
I mean I can write a basic native extension, but as soon as it's anything complex (memory management, threading), I'd need to up my game
<baweaver>
ABI?
<apeiros>
binary interface
LoneHermit has quit [Ping timeout: 276 seconds]
<apeiros>
the thing you use when you write a C extension ;-)
<baweaver>
Ah
<baweaver>
Yeah
<baweaver>
I avoid C
<baweaver>
it scares me
<apeiros>
I have a love-hate relationship with it
<jamesaxl>
baweaver, you should not avoid C
<baweaver>
I'm joking.
<baweaver>
I know a bit of C, but the frequency with which I actually need to use it is low at best.
<jamesaxl>
I avoid java, but in some situation I forced my self to use it
djbkd_ has quit [Remote host closed the connection]
<djellemah>
c is ok, except for the string handling, the objects, the higher-order functions, the closures, the exception handling and the garbage collection ;-p
djbkd_ has joined #ruby
<agent_white>
djellemah: Isn't that why we are here? :)
<baweaver>
I C what you did there
<agent_white>
If I was 'stuck' with C and Ruby, I'd be content.
flashpoint9 has joined #ruby
<djellemah>
yeah, writing ruby-flavoured c is much more pleasant that vanilla c.
<djellemah>
s/that/than/
<baweaver>
Rust is a fun one
<baweaver>
It's basically Ruby/Scala flavored C
<baweaver>
especially with their Iter functions
<agent_white>
Perl is a lady in red doe.
<apeiros>
djellemah: don't forget about UB
<agent_white>
Recently been learning it. It's fun like Ruby.
<apeiros>
I think that's the part I hate most about C
<djellemah>
I still have c++ template scars. I'm very wary of excessively pernickety languages.
<apeiros>
I can live with all the other things. they're just me shooting my foot. but UB is annoying.
<djellemah>
UB?
<apeiros>
undefined behaviour
Pla5tique has quit [Ping timeout: 245 seconds]
<apeiros>
I really want to learn rust as it seems to do away with all those shitty shenanigans
<djellemah>
Heh. That's what autoconf/automake are for :-O Oh, which reminds me. I left macros off my list.
djbkd_ has quit [Ping timeout: 260 seconds]
flashpoint9 has quit [Ping timeout: 252 seconds]
xen0fon has joined #ruby
xen0fon has quit [Client Quit]
bkxd has joined #ruby
Snickers has joined #ruby
maloik has quit [Remote host closed the connection]
maloik has joined #ruby
bkxd has quit [Ping timeout: 258 seconds]
<djellemah>
baweaver: So Kotlin over Scala because json because Scala's type system?
<baweaver>
JSON in Scala can be interesting
<baweaver>
if interop is your key goal: Kotlin. If you want to make it from scratch and have full control, either or.
cyfr0n has quit [Ping timeout: 240 seconds]
<djellemah>
I've done a little Scala, but not with json. What makes it interesting?
ur5us has quit [Remote host closed the connection]
FMan has joined #ruby
xen0fon has joined #ruby
astrobunny has joined #ruby
shinnya has quit [Ping timeout: 240 seconds]
ur5us has joined #ruby
cyfr0n has joined #ruby
astrobunny has quit [Ping timeout: 255 seconds]
ur5us has quit [Ping timeout: 264 seconds]
_mak has left #ruby [".."]
bkxd has joined #ruby
ifctj has quit [Ping timeout: 255 seconds]
avgdog has quit [Ping timeout: 260 seconds]
pandaant has quit [Remote host closed the connection]
karapetyan has joined #ruby
karapetyan has quit [Read error: Connection reset by peer]
Cohedrin has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
karapetyan has joined #ruby
tildes has joined #ruby
govg has quit [Ping timeout: 258 seconds]
noveen has quit [Ping timeout: 240 seconds]
aryaching has joined #ruby
Fernando-Basso has joined #ruby
karapetyan has quit [Remote host closed the connection]
wingwalker has joined #ruby
flashpoint9 has joined #ruby
bigtawm has quit []
Guest79130 has quit [Ping timeout: 255 seconds]
noveen has joined #ruby
govg has joined #ruby
flashpoint9 has quit [Ping timeout: 276 seconds]
toretore has joined #ruby
Chagel has joined #ruby
blackmesa has joined #ruby
karapetyan has joined #ruby
beilabs_ has joined #ruby
karapetyan has quit [Remote host closed the connection]
<toretore>
leitz: SystemCallError will never be raised in generate_hair because you're rescuing it in get_random_line_from_file
Lord_of_Life has quit [Excess Flood]
<matthewd>
leitz: I'd say you're rescuing in the wrong place, really... if it failed to read the file, there's not much get_random_line_from_file can do about it
Snickers has quit [Quit: Snickers]
Lord_of_Life has joined #ruby
jschoolcraft has quit [Quit: peace]
jschoolcraft has joined #ruby
jschoolcraft has quit [Client Quit]
unshadow has joined #ruby
jameser has joined #ruby
<leitz>
So a better solution would be to raise something so the calling method can handle it?
toretore has quit [Quit: Leaving]
toretore has joined #ruby
Lord_of_Life has quit [Changing host]
Lord_of_Life has joined #ruby
Lord_of_Life has joined #ruby
msmith has quit [Ping timeout: 240 seconds]
nadir has quit [Quit: Connection closed for inactivity]
ta has quit [Remote host closed the connection]
govg has quit [Ping timeout: 255 seconds]
despai has quit [Quit: This computer has gone to sleep]
ta has joined #ruby
despai has joined #ruby
<matthewd>
Yeah, whether you give the method a custom exception or just let it raise the underlying one depends on how much abstraction you want the method to provide.. but either way, it's not going to be able to meet its contract, so ultimately an exception of some sort seems appropriate
tildes has quit [Ping timeout: 240 seconds]
<leitz>
Cool. I've understood the *idea* of raise and exceptions, just didn't really get the practice.
<matthewd>
Likewise, it's a judgement call whether it's useful for generate_hair to default to a static string (at least a plausible one, unlike "XXXX")
<leitz>
In this case the raise lets the calling method decide what to do.
hutch34 has joined #ruby
jameser has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<leitz>
Back and forth on XXXX. Using it lets me test more, where using a string that might fit could hid failures.
<matthewd>
That is a workable result, but is its caller going to be happy with something so consistent, or does the problem belong further up the chain: "sorry, you can't generate a new [person?] right now"
alamar has joined #ruby
marr has joined #ruby
alamar is now known as Guest9817
<matthewd>
Exceptions are not a thing to be caught and hidden as soon as you hit them, but a tool for communicating a problem to the *right* level to best handle them
r_rios has quit [Ping timeout: 240 seconds]
astrobunny has joined #ruby
hutch34 has quit [Ping timeout: 240 seconds]
jottr has joined #ruby
govg has joined #ruby
auxbuss has joined #ruby
Guest9817 is now known as julian
astrobunny has quit [Ping timeout: 255 seconds]
lxsameer has quit [Ping timeout: 240 seconds]
<elementaru>
is there a way to add a path to $LOAD_PATH permanently? couple suggestions I googled said to edit bashrc, but it's just a workaround. is there a better solution, like editing some ruby file or wherever $load_path array is kept?
yokel has quit [Ping timeout: 255 seconds]
yokel has joined #ruby
<toretore>
elementaru: why do you want to do this?
<elementaru>
I have some .rb files I want to use in different projects, and I want them to be kept on a differnt letter disk (windows)
zmo has left #ruby [#ruby]
nettoweb has joined #ruby
CloCkWeRX has quit [Quit: Leaving.]
<Papierkorb>
elementaru: Structure these files as a Gem. For development you can use a `gem "my_stuff", path: "D:/My/Stuff"` directive in the Gemfile of your project(s), and for production use, as normal versioned gem
auxbuss has quit [Quit: I'm gone.]
xen0fon has quit [Ping timeout: 255 seconds]
yokel has quit [Ping timeout: 260 seconds]
auxbuss has joined #ruby
yokel has joined #ruby
knutmithut has joined #ruby
yokel has quit [Ping timeout: 240 seconds]
leitz has quit [Quit: Nappy time]
jottr_ has joined #ruby
yokel has joined #ruby
jottr has quit [Ping timeout: 256 seconds]
cdg has joined #ruby
<elementaru>
Papierkorb will I have to change something every time I add a new file to dir?
minimalism has joined #ruby
<Papierkorb>
elementaru: except for #require's you need anyway, no.
<elementaru>
but I will still need to require a specific file, right?
<Papierkorb>
yes
<elementaru>
ok ty, will try it
Rutix has quit [Ping timeout: 245 seconds]
Guest43 has joined #ruby
mikecmpbll has quit [Quit: inabit. zz.]
skweek has quit [Ping timeout: 240 seconds]
ta has quit [Remote host closed the connection]
gloscombe_ has joined #ruby
msmith has joined #ruby
last_staff has joined #ruby
BitWhisperer has quit [Ping timeout: 240 seconds]
jottr has joined #ruby
Derperperd has joined #ruby
auxbuss has quit [Quit: I'm gone.]
jottr has quit [Client Quit]
jottr_ has quit [Ping timeout: 260 seconds]
xen0fon has joined #ruby
blackmesa has quit [Ping timeout: 255 seconds]
Derperperd has quit [Ping timeout: 245 seconds]
govg has quit [Ping timeout: 256 seconds]
dviola has joined #ruby
Definity has joined #ruby
jameser has joined #ruby
UnknownSoldier has joined #ruby
cdg has quit [Remote host closed the connection]
nettoweb has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jameser has quit [Client Quit]
astrobunny has joined #ruby
astrobunny has quit [Ping timeout: 255 seconds]
_3by8 has joined #ruby
ta has joined #ruby
ta has quit [Ping timeout: 256 seconds]
bkxd has joined #ruby
pragmaticus has joined #ruby
yqt has joined #ruby
jameser has joined #ruby
msmith has quit [Ping timeout: 258 seconds]
mistermocha has joined #ruby
millerti has joined #ruby
bkxd has quit [Ping timeout: 240 seconds]
LoneHermit has joined #ruby
mistermocha has quit [Ping timeout: 264 seconds]
blackmesa has joined #ruby
LoneHermit has quit [Ping timeout: 240 seconds]
jameser has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
_3by8 has quit [Quit: Page closed]
cdg has joined #ruby
despai has quit [Ping timeout: 240 seconds]
despai has joined #ruby
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
charliesome has joined #ruby
A124 has quit [Ping timeout: 264 seconds]
millerti has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
conta has joined #ruby
millerti has joined #ruby
jameser has joined #ruby
astrobunny has joined #ruby
xlegoman has joined #ruby
charliesome has quit [Ping timeout: 245 seconds]
sepp2k has joined #ruby
A124 has joined #ruby
jameser has quit [Client Quit]
jameser has joined #ruby
hwding has joined #ruby
<hwding>
hi
hwding has quit [Client Quit]
jameser has quit [Client Quit]
eizua has quit [Quit: Leaving]
jcao219 has joined #ruby
despai has quit [Quit: This computer has gone to sleep]
byte512 has joined #ruby
newrubycoder has joined #ruby
hutch34 has joined #ruby
_sfiguser has quit [Ping timeout: 240 seconds]
jdm has quit [Remote host closed the connection]
blackmesa has quit [Ping timeout: 264 seconds]
dviola has quit [Quit: WeeChat 1.7]
gloscombe_ has quit [Quit: gloscombe_]
conta has quit [Quit: conta]
msmith has joined #ruby
bkxd has joined #ruby
radic has joined #ruby
dviola has joined #ruby
_sfiguser has joined #ruby
bkxd has quit [Ping timeout: 255 seconds]
astrobunny has quit [Read error: Connection reset by peer]
<newrubycoder>
i still can't understand the each function
<apeiros>
newrubycoder: what parts about it do you have trouble with?
<newrubycoder>
apeiros: i wanna convert each part of an array(B) .to_i then delete that number within another array (A), like i wanna do it for every number inside B
Joufflu has quit [Quit: Leaving]
marchelzo has joined #ruby
<newrubycoder>
still dont know how to loop through several numbers and do one operation for each number
<newrubycoder>
every time i choose a kyu it seems easy, and it is easy until i have to use the each function
<marchelzo>
lol
govg has joined #ruby
Cogitabundus has joined #ruby
Cogitabundus has quit [Max SendQ exceeded]
<marchelzo>
newrubycoder: what are you struggling with right now
<newrubycoder>
marchelzo: don't know how to make the each function choose one part of an array, do an operation, then choose the next part etc.
<marchelzo>
newrubycoder: could you give an example?
aryaching has joined #ruby
<newrubycoder>
marchelzo: i get two arrays a [1, 1, 2, 3] and b [1, 2, 4], i need to delete all numbers within a that's also present in b so result should be [3] if b is just one number it's easy, i can just a - [b.join.to_i] or something like that, but it's impossible when it's more than 1 number
<marchelzo>
is it required to be efficient?
<newrubycoder>
no
nicoulaj has quit [Remote host closed the connection]
despai has quit [Quit: This computer has gone to sleep]
TomyLobo has joined #ruby
LinnLonnn has joined #ruby
blackmesa has joined #ruby
<LinnLonnn>
Hi! I'm a Ruby Newbie. I'm doing the Ruby Koans and I'm doing the scoring project. I'm looking for code review and C&C on my solution (problem contained within): http://pastebin.com/xtyFdhne
<ruby[bot]>
LinnLonnn: pastebin.com loads slowly for most, has ads which are distracting and has terrible formatting.
<apeiros>
LinnLonnn: dice.sort! on line 31 mutates an argument, that's generally frowned upon
<LinnLonnn>
apeiros, Oh! I learned that on tryruby.com
ifctj has quit [Ping timeout: 240 seconds]
__Yiota has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
blackmesa has quit [Ping timeout: 240 seconds]
pavelz has quit [Ping timeout: 245 seconds]
<elomatreb>
LinnLonnn: That nested ternary and reduce in line 45 is a little dense for my taste
<apeiros>
on a quick glance the code looks generally good. I'd probably try to avoid mid-method returns and overlong statements.
tjazh has quit [Quit: tjazh]
Snickers has joined #ruby
cibs has quit [Ping timeout: 264 seconds]
__Yiota has joined #ruby
<LinnLonnn>
apeiros, .org sorry. Also, I don't like the repeated code for reducing an array. I feel I should have a lambda or helper method that acts on an array instead of on the reduce arguments
hutch34 has quit [Ping timeout: 240 seconds]
<apeiros>
I assume you primarily ask with regards to code style, and not algorithm, yes?
Fernando-Basso has quit [Quit: WeeChat 1.7]
cibs has joined #ruby
<LinnLonnn>
elomatreb, Is there anything more Rubyist than a standard if statement for that? How would you break that up?
<LinnLonnn>
apeiros, Yes. I want to learn the Rubyist ways. I'm still thinking in terms of static languages.
<LinnLonnn>
elomatreb, I've seen that construct before. To me, that looks ugly. Is that normal/pretty to a Rubyist?
bkxd has joined #ruby
<elomatreb>
It's your code, so you're certainly free to do that. I dislike using ternary with anything but the simplest of branches (either literals or single method calls) since it's easy to lose track of the colon imo
<elomatreb>
I'm not sure if any Ruby styleguide prohibits them though
<LinnLonnn>
If the line looks a little too unwieldy for a quick glance, I'll put the expressions on different lines.
<LinnLonnn>
Like that's my rule of thumb for ternarys
<elomatreb>
Personal preference, sorry for nitpicking
<LinnLonnn>
I appreciate the views/opinions
<matthewd>
This may come out in the process of prettification.. or I may be misreading.. but I don't think the code currently does the thing
<LinnLonnn>
apeiros, In terms of dice.sort!, would I refactor that to `sortedDice = dice.sort' or are you saying to do `dice = dice.sort'?
JeanCarloMachado has joined #ruby
<LinnLonnn>
matthewd, It passes all the tests.
<matthewd>
LinnLonnn: Either is fine. Or `dice = dice.dup; dice.sort!`. The "problem" is that the method is mutating an object it doesn't "own"
<apeiros>
LinnLonnn: in a shorter method I'll just do `dice = dice.sort`, in a longer method it can make sense to use a more descriptive name. sorted_dice is a good choice IMO.
<matthewd>
(not that you're using the mutation method at all)
Snickers has quit [Quit: Snickers]
bkxd has quit [Ping timeout: 252 seconds]
<LinnLonnn>
Oh excellent point! Thank you!
dcluna has quit [Ping timeout: 260 seconds]
<matthewd>
LinnLonnn: Then you could use some more tests ;)
<LinnLonnn>
Does `sort' return a view of the original array or a copy?
<matthewd>
LinnLonnn: A copy of the array -- though the elements are the same objects
t-recx has quit [Ping timeout: 255 seconds]
<LinnLonnn>
apeiros, The problem says a dice is rolled 5 times. There can be only one set of 3. Therefore I must say that your lines 16 and 17 are dead code.
<LinnLonnn>
"up to five dice"
FiveBroDeepBook has joined #ruby
<apeiros>
LinnLonnn: no, they care about sets of 3 with 2-6 eyes
<LinnLonnn>
Wait no sorry
<apeiros>
a set of 3 ones is not in that loop because it's counted differently and handled by line 9-12
<LinnLonnn>
My mistake
<apeiros>
but yeah, you could short-circuit the loop
FiveBroDeepBook has quit [K-Lined]
astrobunny has quit [Ping timeout: 255 seconds]
<LinnLonnn>
Very pretty code though!
<apeiros>
but what you say actually means I can probably write this shorter.
<matthewd>
dice.group_by(&:itself).map {|e,l| c = l.size; if c >= 3; c -= 3; 100 * (e == 1 ? 10 : e); else; 0; end + c * case e when 1; 100; when 5; 50; else 0; end }.inject :+
<matthewd>
LinnLonnn: More constructively ;), the test case you need is [4,4,4,3,3]
<apeiros>
and that'd be the (almost) golf variant? :D
<matthewd>
But with some newlines and more sensible names, I do think the group-then-count approach would be pretty readable
LoneHerm_ has quit [Remote host closed the connection]
<LinnLonnn>
OH
ta has joined #ruby
sagax has quit [Quit: Konversation terminated!]
JeanCarloMachado has quit [Ping timeout: 252 seconds]
<LinnLonnn>
matthewd, Excellent test case. I actually don't know how to fix this code and keep it pretty. Now I've been infected with apeiro.s beautiful solution.
marsjaninzmarsa has quit [Quit: ZNC 1.7.x-git-487-cbf5c38 - http://znc.in]
Channel6 has joined #ruby
scootaloo has joined #ruby
dcunit3d has joined #ruby
<matthewd>
LinnLonnn: Hah, yeah, that's what I was alluding to, tbh... the logic of that accidental assumption was shaping your code, and so a fix might naturally rearrange things
msmith has joined #ruby
<apeiros>
btw., somehow I thought count_by made it into 2.4, but it's not there? :<
Derperperd has joined #ruby
blackmesa has joined #ruby
JeanCarloMachado has joined #ruby
<matthewd>
Yeah, I thought the same thing
t-recx has joined #ruby
Derperperd has quit [Ping timeout: 240 seconds]
nowhereman has joined #ruby
charliesome has joined #ruby
iMadper has quit [Changing host]
iMadper has joined #ruby
enterprisey has joined #ruby
charliesome has quit [Ping timeout: 245 seconds]
szulak has quit [Quit: My MacBook Air has gone to sleep. ZZZzzz…]
hanmac has left #ruby [#ruby]
marsjaninzmarsa has joined #ruby
hutch34 has joined #ruby
cyphase has quit [Ping timeout: 258 seconds]
dmitrysinina[m] has quit [Ping timeout: 240 seconds]
M107262[m] has quit [Ping timeout: 240 seconds]
Xi[m] has quit [Ping timeout: 240 seconds]
Giphy[m] has quit [Ping timeout: 258 seconds]
daveyboi[m] has quit [Ping timeout: 258 seconds]
jakebriggs[m] has quit [Ping timeout: 258 seconds]
kp666[m] has quit [Ping timeout: 245 seconds]
h42r62[m] has quit [Ping timeout: 255 seconds]
ryantriangles[m] has quit [Ping timeout: 255 seconds]
<apeiros>
newrubycoder: sorry about earlier. I got distracted and forgot to return to irc.
yk_ has joined #ruby
<apeiros>
I hope you got the answer you needed
agent_white is now known as hungry
<newrubycoder>
apeiros: yeah and pls dont check the logs lol
BackEndCoder has quit [Excess Flood]
* scootaloo
checks the logs
<scootaloo>
shoot, no logs.
<havenwood>
newrubycoder: Yes, Matz is in charge. ko1 implemented the VM and makes many decisions. Naruse is the release manager for Ruby 2.5.0. Nobu remains the "patch monster." There are many others, see: https://github.com/ruby/ruby/blob/trunk/doc/maintainers.rdoc
abdulmugni has quit [Read error: Connection reset by peer]
qguv has joined #ruby
<pagios>
hey guys
<pagios>
anyone tried libsodium?
flashpoint9 has joined #ruby
<havenwood>
pagios: Having libsodium-related issues or questions?
<pagios>
yea, well i am wondering if secretbox changes encryption methods from version to version, i mainly have 1.08 libsoldium on server1 and libsodium 1.9 on 2
<apeiros>
pagios: any reason you make a *screenshot* of a textual error message?
beilabs_ has quit [Ping timeout: 240 seconds]
<pagios>
colors
<apeiros>
meh
<pagios>
i am transfering a byte over a $http request
<Papierkorb>
pagios: Please don't post screenshots
mikeiniowa has quit [Ping timeout: 240 seconds]
<pagios>
so i need to encoe it first and then decode it ?
<apeiros>
well, you cropped the image, so we don't even see the full error
skweek has quit [Ping timeout: 260 seconds]
<Papierkorb>
pagios: You can't know if someone willing to help can't read it cause s/he needs a higher/lower contrasts or other things. In general, reading text on a picture is much harder than if a locally running program renders text properly
<apeiros>
but the part we see implies that the string is not correctly encoded
ryantriangles[m] has joined #ruby
flashpoint9 has joined #ruby
<pagios>
apeiros, to transfer bytes over a network i need to encode right?
<apeiros>
wrong
<pagios>
thing is i am trying to transfer an encrypted mesg
<pagios>
so i am encrypting the clear text
<pagios>
and that is the snapshot of it recieved in ruby
<apeiros>
to transfer high-bytes in a http url, you have to encode them
lenwood has joined #ruby
<apeiros>
that snapshot is not very helpful
cyberRodent has quit [Ping timeout: 252 seconds]
charliesome has joined #ruby
cyberRodent has joined #ruby
flashpoint9 has quit [Remote host closed the connection]
revvy_ has joined #ruby
SteenJobs has quit [Quit: SteenJobs]
jhack has joined #ruby
charliesome has quit [Ping timeout: 245 seconds]
flashpoint9 has joined #ruby
dviola has joined #ruby
pilne has joined #ruby
blackmesa has quit [Ping timeout: 240 seconds]
flashpoint9 has quit [Ping timeout: 240 seconds]
cgibsonmm has joined #ruby
renchan has quit [Remote host closed the connection]
hutch34 has joined #ruby
dc1 has joined #ruby
dcunit3d has quit [Ping timeout: 240 seconds]
nettoweb has joined #ruby
wingwalker has joined #ruby
kht has quit [Ping timeout: 276 seconds]
ur5us has joined #ruby
bkxd has joined #ruby
newbie22 has joined #ruby
lanc has joined #ruby
montanonic has joined #ruby
bkxd has quit [Ping timeout: 240 seconds]
dionysus69 has joined #ruby
ta has joined #ruby
cgibsonmm has quit []
lanc has quit [Quit: zzZZZZzzZZZZzzZZzzZZZZzzzzzzzzz]
ta has quit [Ping timeout: 255 seconds]
gTimeJohnny has joined #ruby
astrobunny has joined #ruby
Cohedrin has joined #ruby
elementaru has quit [Remote host closed the connection]
hutch34 has quit [Ping timeout: 255 seconds]
kht has joined #ruby
marr has joined #ruby
phage has joined #ruby
astrobunny has quit [Ping timeout: 255 seconds]
Dimik has joined #ruby
nettoweb has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
sepp2k1 has joined #ruby
hutch34 has joined #ruby
sepp2k has quit [Ping timeout: 258 seconds]
D100 has quit [Quit: Leaving]
kht has quit [Ping timeout: 240 seconds]
jcao219 has quit [Ping timeout: 276 seconds]
gTimeJohnny has quit [Quit: Leaving]
nettoweb has joined #ruby
lenwood has quit [Ping timeout: 260 seconds]
Andrevan has joined #ruby
banisterfiend has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
plantfood has joined #ruby
blnkt has quit [Quit: brb]
kht has joined #ruby
JeanCarloMachado has quit [Ping timeout: 240 seconds]
SteenJobs has joined #ruby
<Inv1s1ble_>
Is it possible to use a case statement with a hash in such as way as to have when blocks execute if a given key exists?
swills__ is now known as swills
<Papierkorb>
>> hsh = { 1 => "foo" }; case 1; when ->(x){ hsh.keys.include?(x) } then "It works"; end # Inv1s1ble_
<Papierkorb>
Inv1s1ble_: the case expression works by calling #=== on each possible case, and since some recent Ruby, Proc#call is aliased to #===, which enables you to put arbitrary condition logic into case expressions in ruby
<apeiros>
Inv1s1ble_: you can always store procs or method names in the hash
<apeiros>
so sure
wingwalker has quit [Quit: Leaving]
JeanCarloMachado has joined #ruby
Cohedrin has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
ifctj has joined #ruby
bascht1 has joined #ruby
Giphy[m] has joined #ruby
daveyboi[m] has joined #ruby
M107262[m] has joined #ruby
M-manveru has joined #ruby
meshsmith has joined #ruby
travisr has joined #ruby
aviraldg has joined #ruby
jakebriggs[m] has joined #ruby
kp666[m] has joined #ruby
Xi[m] has joined #ruby
dmitrysinina[m] has joined #ruby
h42r62[m] has joined #ruby
cyfr0n has quit [Quit: WeeChat 1.6]
cschneid_ has quit [Read error: Connection reset by peer]
cschneid_ has joined #ruby
byte512 has quit [Ping timeout: 240 seconds]
SteenJobs has quit [Quit: SteenJobs]
SteenJobs has joined #ruby
jamesaxl has quit [Ping timeout: 256 seconds]
Guest93151 has joined #ruby
szulak has joined #ruby
skweek has joined #ruby
duderonomy has quit [Ping timeout: 245 seconds]
bmurt has joined #ruby
Cohedrin has joined #ruby
Cohedrin has quit [Client Quit]
Cohedrin has joined #ruby
plantfood has quit [Ping timeout: 260 seconds]
ta has joined #ruby
edwinvdgraaf has joined #ruby
lxsameer has joined #ruby
newbie22 has quit [Quit: Leaving]
bkxd has joined #ruby
cschneid_ has quit [Remote host closed the connection]
cschneid_ has joined #ruby
blackmesa has joined #ruby
blackmesa has quit [Read error: Connection reset by peer]
blackmesa has joined #ruby
tildes has joined #ruby
Guest93151 has quit [Ping timeout: 240 seconds]
banisterfiend has joined #ruby
bkxd has quit [Ping timeout: 240 seconds]
banisterfiend has quit [Client Quit]
plantfood has joined #ruby
Andrevan has quit [Changing host]
Andrevan has joined #ruby
Andrevan has quit [Quit: WeeChat 1.7]
cschneid_ has quit [Ping timeout: 255 seconds]
Andrevan has joined #ruby
Channel6 has joined #ruby
fusta has joined #ruby
edwinvdgraaf has quit [Remote host closed the connection]
moei has quit [Quit: Leaving...]
jcao219 has joined #ruby
msmith has joined #ruby
fusta has quit [Ping timeout: 264 seconds]
skweek has quit [Ping timeout: 255 seconds]
skweek has joined #ruby
beilabs has quit [Remote host closed the connection]
dc4 has joined #ruby
sagax has joined #ruby
dc1 has quit [Ping timeout: 240 seconds]
fusta has joined #ruby
<fusta>
Hi, I am trying to call a method of parent class but super.method() doesn't seem to work
<fusta>
I've found this Parent.instance_method(:method).bind(self).call(args)
tomphp has joined #ruby
<fusta>
but I am not sure if this is the preferred way of doing this?
msmith has quit [Remote host closed the connection]
msmith has joined #ruby
msmith has quit [Remote host closed the connection]
JeanCarloMachado has quit [Ping timeout: 258 seconds]
JeanCarloMachado has joined #ruby
<dminuoso>
fusta, can you be more specific what you mean by "parent class" ?
<fusta>
I have class that inherits from Gtk::Button. at the initialize method I need to call focus_on_click(false) which is a method of Gtk::Button
plantfood has quit [Remote host closed the connection]
<dminuoso>
fusta, does your class override that method?
<fusta>
no
<dminuoso>
fusta, then just call it.
<fusta>
I get undefined method `focus_on_click' for nil:NilClass (NoMethodError)
<dminuoso>
fusta, how are you calling it?
<fusta>
Just a sec, I'll paste gist
<dminuoso>
it means you do something that equates to nil.focus_on_click
Guest69 has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
railswebdev has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
SiliconDon has quit [Client Quit]
SiliconDon has joined #ruby
hutch34 has quit [Ping timeout: 252 seconds]
nettoweb has joined #ruby
dc4 has joined #ruby
SiliconDon has quit [Client Quit]
nowhereman has quit [Read error: Connection reset by peer]
nowhereman has joined #ruby
JeanCarloMachado has quit [Ping timeout: 240 seconds]
SiliconDon has joined #ruby
JeanCarloMachado has joined #ruby
SiliconDon has quit [Client Quit]
CloCkWeRX has joined #ruby
houhoulis has quit [Remote host closed the connection]
SiliconDon has joined #ruby
enterprisey has quit [Remote host closed the connection]
hutch34 has joined #ruby
JeanCarloMachado has quit [Ping timeout: 240 seconds]
lanc has joined #ruby
JeanCarloMachado has joined #ruby
euphoriaa has quit [Ping timeout: 240 seconds]
revvy_ has quit [Quit: Connection closed for inactivity]
euphoriaa has joined #ruby
__Yiota has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
_sfiguser has joined #ruby
_sfiguser has quit [Max SendQ exceeded]
ifctj has quit [Ping timeout: 252 seconds]
hutch34 has quit [Ping timeout: 255 seconds]
_sfiguser has joined #ruby
tomphp has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
lenwood has quit [Ping timeout: 255 seconds]
bkxd has joined #ruby
dc4 has quit [Ping timeout: 255 seconds]
Dimik has quit [Ping timeout: 276 seconds]
enterprisey has joined #ruby
speakingcode has joined #ruby
bkxd has quit [Ping timeout: 260 seconds]
JeanCarloMachado has quit [Ping timeout: 260 seconds]
speakingcode has quit [Client Quit]
abdulmugni has joined #ruby
harfangk has joined #ruby
lanc has quit [Quit: zzZZZZzzZZZZzzZZzzZZZZzzzzzzzzz]
astrobunny has joined #ruby
enterprisey has quit [Remote host closed the connection]
mistermocha has quit [Remote host closed the connection]
SiliconDon has quit [Quit: SiliconDon]
SiliconDon has joined #ruby
mistermocha has joined #ruby
astrobun_ has quit [Ping timeout: 276 seconds]
hutch34 has joined #ruby
SiliconDon has quit [Quit: SiliconDon]
dman[m] has joined #ruby
lanc has joined #ruby
lanc has quit [Client Quit]
t-recx has quit [Quit: t-recx]
fusta has quit [Quit: Leaving]
<newrubycoder>
is there any way to "unsort" a string? or a way to connect a sorted string to itself before it was sorted?
<dminuoso>
yes.
<dminuoso>
remember it.
<newrubycoder>
yes what is it
<Papierkorb>
a time machine?
flashpoint9 has quit [Remote host closed the connection]
<Papierkorb>
newrubycoder: Remembering the original value in its own variable would work too
despai has joined #ruby
hutch34 has quit [Ping timeout: 264 seconds]
<newrubycoder>
Papierkorb: yeah but i need to sort the original values, then compare them and select the right values, but i gotta output them in their unsorted form
<newrubycoder>
there's probably so many ways to do this but i dont wanna learn about hashes yet
<dminuoso>
newrubycoder, remember the original.
<Papierkorb>
newrubycoder: original = the_thing; sorted = the_thing.sort; return original + sorted
herbmillerjr has joined #ruby
<Papierkorb>
newrubycoder: Which is equivalent to `the_thing + the_thing.sort`, depending on how you built it you can even write it like that
johnny56 has quit [Ping timeout: 264 seconds]
moei has joined #ruby
<newrubycoder>
i need to reject a bunch of elements within the original also
<Papierkorb>
dminuoso: I'm impressed that you can help out while having a long discussion in offtopic
johnny56 has joined #ruby
<newrubycoder>
is offtopic more active than here?
bpmedley has quit [Ping timeout: 252 seconds]
<dminuoso>
It was until right now.
<Papierkorb>
newrubycoder: offtopic isn't for talking about ruby. you're of course welcome to join #ruby-offtopic eitherway
<dminuoso>
Papierkorb, its just like work. Being productive in some place, and venting some mindless tips and pointers in here :p
hotpancakes has quit [Remote host closed the connection]
<Papierkorb>
newrubycoder: If you need to reject stuff (or manipulate the values in any shape or form), just store it into a new variable. If you've been using the bang version (like `reject!`), just use the non-bang version instead (Thus, `reject`)
<newrubycoder>
papercod1: a = words.map {|x| x.chars.sort.join }; a.select { |k| word.include?(k) } it rejects the words that's not an anagram of word, how do i output the non-rejected words in original form?
<newrubycoder>
ops wrong user i meant Papierkorb
skweek has quit [Ping timeout: 240 seconds]
<Papierkorb>
newrubycoder: Your #select call there doesn't modify `a`. you can just use it, it still has the value from before. even `a + a.select{ .. }` will work
abdulmugni has quit [Read error: Connection reset by peer]
danielpclark has joined #ruby
montanonic has joined #ruby
TomyLobo has quit [Ping timeout: 255 seconds]
despai has quit [Ping timeout: 260 seconds]
despai has joined #ruby
hutch34 has joined #ruby
l4v2 has joined #ruby
hotpancakes has joined #ruby
Exuma has joined #ruby
<newrubycoder>
i might do this: instead of selecting strings i'll select their place in the array and get a number, then i'll connect that number up to the original array and output it
flashpoint9 has joined #ruby
<Papierkorb>
newrubycoder: That's much more complicated
_sfiguser has quit [Quit: Leaving]
SteenJobs has quit [Quit: SteenJobs]
<newrubycoder>
Papierkorb: i dont get your solution tbh, it might be over my head, but a is sorted and no good for the output, i gotta connect a to `words` after it's operated on in some way
<Papierkorb>
newrubycoder: `words` is still in its original state after those calls above, nothing has been done to it
<newrubycoder>
yeah that's why i gotta connect the correct elements of it based on the info i got from a