<baweaver>
IRB goes straight into an infinite loop
<baweaver>
Waitasecond
<baweaver>
How does a class know its own name?
<baweaver>
If there were a way to cheat and tap that, making it think it's an "Object" then...
banisterfiend has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<baweaver>
havenwood: Got a new idea
<baweaver>
Circus theme, Indigo as the ring master, cue: The Most RSpectacular Show on Earth!
<baweaver>
Each of the rings correspond to one type of testing
<baweaver>
Unit, Integration, Acceptance
banisterfiend has joined #ruby
<havenwood>
baweaver: "moar tests!" roared the lion!
<baweaver>
Testy testy aren't you?
<havenwood>
"rwar tests" roared zenspider!
<baweaver>
I'd kinda like to give "Reducing Enumerable - An Illustrated Guide" a few more runs before I start on another super ambitious presentation
<havenwood>
no doubt
<baweaver>
That said, I'm also massively faster now in preparing them
dviola has quit [Quit: WeeChat 2.2]
this_dude has joined #ruby
<this_dude>
anyone online?
<baweaver>
perhaps
<this_dude>
trying to code a method to do the following: Write a method that takes in a string of lowercase letters and # spaces, producing a new string that capitalizes the first letter of each word
<this_dude>
running across some trouble
<baweaver>
What have you tried
<this_dude>
do i post my code so far on the github?
<baweaver>
Yeah, that should work.
<this_dude>
oh do i need to be registered or something?
<ruby[bot]>
havenwood: I'm terribly sorry, I could not evaluate your code because of an error: NoMethodError:undefined method `[]' for nil:NilClass
<baweaver>
bot go boom
<havenwood>
But yeah, it's been in Ruby core since forever.
<this_dude>
wtf
<this_dude>
so
<this_dude>
in my case where I need "string".upcase
<this_dude>
is it not the same as .capitalize?
<havenwood>
this_dude: Try in irb or pry.
<baweaver>
Try it out in IRB on your computer
<baweaver>
ninja
<havenwood>
?irb
<ruby[bot]>
irb is "interactive ruby", it is part of ruby. You can run ruby code and see results immediately. it's useful for testing code. Also see ?pry, a gem which is a popular alternative to irb.
<this_dude>
ok gimme a sec
<havenwood>
?pry
<ruby[bot]>
Pry, the better IRB, provides easy object inspection `ls`, `history`, viewing docs `?`, viewing source `$`, syntax highlighting and other features (see `help` for more). Put `binding.pry` in your source code for easy debugging. Install Pry (https://pryrepl.org/): gem install pry pry-doc
<this_dude>
could i use that .map function for another problem on there...the caesar cipher?
<havenwood>
this_dude: yes
<this_dude>
oh yeah i saw something on an article about the triple equals
<baweaver>
map is generic.
<baweaver>
It operates on any Enumerable type, and returns a new Array
<this_dude>
dude if i go into these exams using advanced ruby code im sure to get into the program lmao
<this_dude>
i love you guys
<baweaver>
These are the basic building blocks, there's still more to learn, but once you have these building blocks down it unlocks a ton.
<this_dude>
ok so let me try to code the caesar cipher using that then...cause the exam is supposedly gonna only go up to the "medium difficulty" category questions and the cipher is in the "hard" category
<baweaver>
What's funny about Caesar and ROT13 is they can be done in a handful of characters
<baweaver>
barely even a full line worth.
<baweaver>
but I'd use map for now.
<baweaver>
well, rather I'd use map, ord, and modulo.
<baweaver>
the way that'd be a bit hard to reason about is tr, which is translate.
<baweaver>
It basically says take set a and transform it to set b
<baweaver>
but that's also super dense
alfiemax has quit [Ping timeout: 256 seconds]
alfiemax has joined #ruby
this_dude has quit [Ping timeout: 252 seconds]
this_dude has joined #ruby
<this_dude>
sorry had to relocate pc
<this_dude>
im back lol
<this_dude>
so you said use .map .ord and %?
tdy has joined #ruby
tdy1 has joined #ruby
tdy has quit [Ping timeout: 248 seconds]
agent_white has quit [Quit: gnight]
<this_dude>
what does string.each_char do?
FredrikThuresson has joined #ruby
white_lilies has quit [Ping timeout: 256 seconds]
FredrikThuresson is now known as FredrikT
alfiemax_ has joined #ruby
ciro has quit [Quit: WeeChat 2.2]
cschneid_ has joined #ruby
alfiemax has quit [Ping timeout: 240 seconds]
zenspider has quit [Ping timeout: 268 seconds]
cschneid_ has quit [Ping timeout: 248 seconds]
dviola has joined #ruby
alfiemax_ has quit [Ping timeout: 240 seconds]
braincrash has quit [Quit: bye bye]
<al2o3-cr>
>> 'qefp_arab tfii yb x jxpqbo lc oryv fk kl qfjb :)'.tr'x-za-w','a-z'
<ruby[bot]>
al2o3-cr: # => "this_dude will be a master of ruby in no time :)" (https://eval.in/1044781)
braincrash has joined #ruby
FredrikT has quit [Ping timeout: 252 seconds]
gix has joined #ruby
patr0clus has joined #ruby
tdy1 is now known as tdy
Creatornator has joined #ruby
this_dude has quit [Ping timeout: 252 seconds]
rdavila has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
cschneid_ has joined #ruby
patr0clus has quit [Ping timeout: 265 seconds]
patr0clus has joined #ruby
Caerus has joined #ruby
patr0clus has quit [Client Quit]
patr0clus has joined #ruby
cschneid_ has quit [Remote host closed the connection]
this_dude has joined #ruby
JamJam_kid has joined #ruby
<this_dude>
@al2o3-cr
<this_dude>
i just saw the code you sent lol
<this_dude>
how the hell does that compute xD
patr0clus has quit [Ping timeout: 264 seconds]
patr0clus has joined #ruby
alfiemax has joined #ruby
ltd has quit [Quit: leaving]
Creatornator has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
kapil___ has quit [Quit: Connection closed for inactivity]
_aeris_ has quit [Remote host closed the connection]
_aeris_ has joined #ruby
tristanp has joined #ruby
<this_dude>
ill repeat my question from the other channel..can someone please help me correct the syntax of this line
<havenwood>
this_dude: String doesn't mixin Enumerable or anything else that defined #map, and it isn't defined on String itself either.
tristanp has quit [Ping timeout: 264 seconds]
<this_dude>
i have no idea what that means D:
<havenwood>
this_dude: Above I asked an empty string if it responds to #map, and it doesn't.
<this_dude>
ohhh sorry forgot to give you the context
<this_dude>
this is for an any offset caesar cipher
<this_dude>
i will use a gets to ask for the offset
<this_dude>
and another to ask for the string
<havenwood>
this_dude: It looks like you're calling #map on a String, but String doesn't respond to the #map method because #map isn't defined on String.
<havenwood>
this_dude: In Ruby, different Objects respond to different methods.
<this_dude>
so .map is for integers
<this_dude>
and .chars is for characters
<havenwood>
this_dude: No, map is for things that respond to map. And chars is for things that respond to chars.
<havenwood>
[].respond_to? :map #=> true
<havenwood>
42.respond_to? :map #=> false
<this_dude>
ive never heard of .chars thats why
<havenwood>
this_dude: The `[]` or `42` is the "receiver" of the method call. You call the method on the receiver object.
<this_dude>
i didnt even know .map existed until earlier
<havenwood>
?pry
<ruby[bot]>
Pry, the better IRB, provides easy object inspection `ls`, `history`, viewing docs `?`, viewing source `$`, syntax highlighting and other features (see `help` for more). Put `binding.pry` in your source code for easy debugging. Install Pry (https://pryrepl.org/): gem install pry pry-doc
<this_dude>
so can I use (string.split).char?
<havenwood>
this_dude: In Pry, you can easily check what methods an object respond to. You can do it in irb too, it's just more work.
<baweaver>
>> ALPHABET = ('a'..'z').to_a; offset = 13; translation = ALPHABET.zip(ALPHABET.rotate(offset)).to_h; 'strings are real fun BUT NOT THIS'.chars.map { |c| translation[c] || c }.join
<this_dude>
oh i removed the .to_i from the .char.map
<this_dude>
but still getting the same error
ineb has joined #ruby
JamJam_kid has quit [Ping timeout: 256 seconds]
<ineb>
if you go the dynamic approach and generate a client api out of the REST specifications
<ineb>
would you generate the actual ruby code via erb templates
<ineb>
or load the specifications (json) and create the code via meta programming?
<baweaver>
Calling it a night. 'cheers
<this_dude>
waittttt
<baweaver>
Apipie or Swagger
<baweaver>
Don't make it complicated.
<this_dude>
i have to finish at least this one
<baweaver>
You're close, you have to think it through though
<this_dude>
me?
<baweaver>
mainly what's an offset and what's the string
<baweaver>
Anyways, late here and sleep is good.
<this_dude>
oh i forgot offset to int?
<this_dude>
hmm alright :/ g'night
<this_dude>
oh i fixed the integer error and got a new one instead lmao
snickers has joined #ruby
clemens3_ has joined #ruby
apeiros has joined #ruby
mikecmpbll has joined #ruby
snickers has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ferhaty has joined #ruby
alex`` has joined #ruby
mikecmpbll has quit [Quit: inabit. zz.]
p4p0l0 has joined #ruby
snickers has joined #ruby
vedu has joined #ruby
WA9ACE has quit []
this_dude has quit [Ping timeout: 252 seconds]
<vedu>
Hello. I am unable to get `rake task` working in my project https://github.com/vedant1811/customer-records. Currently it runs with "0 runs, 0 assertions, 0 failures, 0 errors, 0 skips"
mikecmpbll has joined #ruby
Beams has joined #ruby
MuffinPimp has quit [Read error: Connection reset by peer]
MuffinPimp has joined #ruby
drale2k_ has joined #ruby
TomyWork has joined #ruby
arup_r has quit []
sameerynho has joined #ruby
Zaab1t has joined #ruby
amelliaa has joined #ruby
Freshnuts has joined #ruby
Freshnuts has quit [Quit: Leaving]
cabotto has joined #ruby
Freshnuts has joined #ruby
alicef has quit [Ping timeout: 240 seconds]
Mike11 has joined #ruby
alicef has joined #ruby
meinside has quit [Quit: Connection closed for inactivity]
rishibit has joined #ruby
ansraliant has quit [Quit: Konversation terminated!]
dhollin3 has joined #ruby
rishibit has left #ruby [#ruby]
dhollinger has quit [Ping timeout: 240 seconds]
cabotto has quit [Remote host closed the connection]
cabotto has joined #ruby
aufi has quit [Ping timeout: 264 seconds]
User458764 has joined #ruby
User458764 has quit [Client Quit]
cabotto has quit [Ping timeout: 260 seconds]
cabotto has joined #ruby
tdy has quit [Ping timeout: 264 seconds]
morantron has joined #ruby
Caerus has quit [Read error: Connection reset by peer]
<morantron>
hi! is there a way to set a breakpoint when a constant in a class is being defined? some gem is defining a constant, and I'm not sure where it comes from...
Caerus has joined #ruby
alfiemax has quit [Remote host closed the connection]
p4p0l0 has quit [Read error: No route to host]
drale2k_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Freshnuts has quit [Quit: Leaving]
<apeiros>
morantron: just define it again, ruby will tell you that it already exists and where the original definition was
jp has quit [Ping timeout: 268 seconds]
desperek has joined #ruby
jp has joined #ruby
Dbugger has joined #ruby
drale2k_ has joined #ruby
<dionysus69>
return some_var if > 0 would be great syntax, wouldn't it? instead of return some_var if some_var > 0
<dionysus69>
I assume it would require one more line in ruby's source code
<apeiros>
mid-method returns are the way of the spaghetti
TJ- has joined #ruby
<dionysus69>
apeiros: why what's wrong with them? never found anything against guard clause, until now ^.^ rubocop actually tells you to use them in some cases
Bish has joined #ruby
<Bish>
does anyone of you guys operate your own DNS server written in ruby?
<apeiros>
there's plenty of material online about what's spaghetti code and why it's bad. I suggest you make use of google.
erlend has left #ruby ["WeeChat 1.9.1"]
tdy has joined #ruby
elphe has quit [Ping timeout: 264 seconds]
morantron has quit [Remote host closed the connection]
postmodern has quit [Quit: Leaving]
apparition has joined #ruby
aufi has joined #ruby
FernandoBasso has joined #ruby
dminuoso has joined #ruby
<dminuoso>
Given `[:foo, :bar, :quux]` and `:baz` I want to obtain `{ foo: :baz, bar: :baz, quux: :baz}` is there an expressive but compact way to do this?
<dionysus69>
I think the first one is better though
GodFather has quit [Remote host closed the connection]
elphe has quit [Ping timeout: 260 seconds]
tristanp has joined #ruby
elphe has joined #ruby
oldandwise has joined #ruby
tristanp has quit [Ping timeout: 260 seconds]
ArahaelPi has quit [Ping timeout: 240 seconds]
flakas_ has joined #ruby
ciro has joined #ruby
flakas_ has quit [Quit: Leaving]
flakas has joined #ruby
arahael1 has joined #ruby
schneider has joined #ruby
arahael1 has quit [Read error: Connection reset by peer]
Mike11 has quit [Quit: Leaving.]
arahael1 has joined #ruby
AJA4350 has joined #ruby
aufi has quit [Ping timeout: 240 seconds]
schneider has quit [Ping timeout: 240 seconds]
schneider has joined #ruby
elphe has quit [Ping timeout: 240 seconds]
schneider has quit [Quit: WeeChat 2.0.1]
wildermind has joined #ruby
tty has joined #ruby
elphe has joined #ruby
fmcgeough has joined #ruby
fmcgeough has quit [Client Quit]
elphe has quit [Ping timeout: 268 seconds]
drale2k_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
AJA4351 has joined #ruby
AJA4350 has quit [Ping timeout: 260 seconds]
AJA4351 is now known as AJA4350
AJA4351 has joined #ruby
elphe has joined #ruby
bmurt has joined #ruby
savolla has joined #ruby
AJA4350 has quit [Ping timeout: 260 seconds]
AJA4351 is now known as AJA4350
elphe has quit [Ping timeout: 248 seconds]
Sigyn has quit [Quit: People always have such a hard time believing that robots could do bad things.]
AJA4351 has joined #ruby
Sigyn has joined #ruby
AJA4350 has quit [Ping timeout: 240 seconds]
elphe has joined #ruby
AJA4351 has quit [Ping timeout: 255 seconds]
AJA4350 has joined #ruby
hs366 has joined #ruby
elphe has quit [Ping timeout: 248 seconds]
amelliaa has quit [Quit: -]
AJA4351 has joined #ruby
elphe has joined #ruby
AJA4350 has quit [Ping timeout: 268 seconds]
AJA4351 is now known as AJA4350
elphe has quit [Ping timeout: 244 seconds]
drale2k_ has joined #ruby
InfinityFye has joined #ruby
elphe has joined #ruby
ciro has quit [Ping timeout: 240 seconds]
jcalla has joined #ruby
elphe has quit [Ping timeout: 248 seconds]
elphe has joined #ruby
snickers has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
AJA4351 has joined #ruby
AJA4350 has quit [Ping timeout: 244 seconds]
AJA4351 is now known as AJA4350
elphe has quit [Ping timeout: 268 seconds]
cabotto has quit [Remote host closed the connection]
elphe has joined #ruby
cabotto has joined #ruby
fmcgeough has joined #ruby
aufi has joined #ruby
yokel has joined #ruby
elphe has quit [Ping timeout: 240 seconds]
snickers has joined #ruby
aufi has quit [Read error: Connection reset by peer]
aufi has joined #ruby
AJA4351 has joined #ruby
AJA4350 has quit [Ping timeout: 240 seconds]
AJA4351 is now known as AJA4350
snickers has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Caius has quit [Ping timeout: 244 seconds]
soahccc has quit [Ping timeout: 248 seconds]
Caius has joined #ruby
elphe has joined #ruby
ciro has joined #ruby
gray_-_wolf has joined #ruby
<gray_-_wolf>
I want to have "read-only" Struct, I've come up with `Struct.new(:foo, :bar) { members.each { |m| remove_method("#{m}=") } }`, is there a better way?
elphe has quit [Ping timeout: 244 seconds]
<dminuoso>
gray_-_wolf: Live with the fact that Ruby has no type system?
<dminuoso>
gray_-_wolf: Regardless of what you do, there's enough backdooring to undo what you do.
<dminuoso>
gray_-_wolf: If you just want some basic "I dont want to shoot myself" protection, what you wrote is the best you can get.
Inline has joined #ruby
<ineb>
wait. just #freeze and/or its members
<ineb>
*just #freeze the struct
* dminuoso
readies his fiddled thaw method..
amelliaa has joined #ruby
<gray_-_wolf>
ineb: heh, that's probably a better way :) didn't think of that
elphe has joined #ruby
<ineb>
np :)
snickers has joined #ruby
<havenwood>
>> %i[foo bar quux].each_with_object(:baz).to_h
<dminuoso>
havenwood: This is why I dont like Ruby.
<havenwood>
dminuoso: What's wrong with each_with_baz?
<ineb>
dminuoso: i dont think its possible to easily unfreeze an object
<havenwood>
ineb: dup it
<ineb>
maybe with some hacks of the ruby interpreter
elphe has quit [Ping timeout: 248 seconds]
* havenwood
mutters something about the 11th bit
snickers has quit [Client Quit]
<dminuoso>
havenwood: why would you ever dup over cloning?
<dminuoso>
oh well.
<dminuoso>
to unfreeze I guess
<dminuoso>
heh
<havenwood>
The ^
<havenwood>
hehe, yup
<dminuoso>
havenwood: But seriously, its regarded because it's unclear why that works.
<dminuoso>
*retarded
reber has joined #ruby
<dminuoso>
I mean the stuff Ruby does to block arity to *implicitly* always somehow fit..
elphe has joined #ruby
GodFather has joined #ruby
gnufied has joined #ruby
keanny479 has joined #ruby
apparition has quit [Quit: Bye]
ciro has quit [Ping timeout: 265 seconds]
elphe has quit [Ping timeout: 268 seconds]
User458764 has joined #ruby
cabotto has quit [Remote host closed the connection]
elphe has joined #ruby
AJA4351 has joined #ruby
cabotto has joined #ruby
cabotto has quit [Client Quit]
memo1 has joined #ruby
<keanny479>
hey everyone
AJA4350 has quit [Ping timeout: 265 seconds]
AJA4351 is now known as AJA4350
elphe has quit [Ping timeout: 240 seconds]
<keanny479>
which gems do you use for a ruby script ? the purpose of the script is to manage unix daemons (copy configuration file, replace keywords like sed...)
clemens3_ has quit [Remote host closed the connection]
elphe has quit [Ping timeout: 240 seconds]
dionysus69 has quit [Ping timeout: 240 seconds]
amelliaa has quit [Quit: -]
aufi has quit [Ping timeout: 265 seconds]
TomyWork has quit [Ping timeout: 240 seconds]
qolq has joined #ruby
GodFather has quit [Ping timeout: 245 seconds]
yohji has quit [Remote host closed the connection]
Creatornator has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<keanny479>
thanks havenwood
cagomez has quit [Remote host closed the connection]
cagomez has joined #ruby
<mensvaga>
!paste
elphe has joined #ruby
<gray_-_wolf>
is there global variable for value case is being matched for? atm I have `case (v = a.b.c.d.foo()); when 'a'; when 'b'; else puts "Unknown #{v}"; end`... is there a global variable like there are for regular expressions I could use to not need the `v` variable?
keanny479 has quit [Ping timeout: 252 seconds]
elphe has quit [Ping timeout: 240 seconds]
orbyt_ has joined #ruby
flakas has joined #ruby
banisterfiend has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
white_lilies has joined #ruby
<apeiros_>
gray_-_wolf: no. if you need that, assign before the case statement.
<apeiros_>
not all your code needs to fit on a single line.
apeiros_ is now known as apeiros
mikecmpb_ has quit [Quit: inabit. zz.]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bak1an has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<gray_-_wolf>
shame :/
drale2k_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Nicmavr has quit [Read error: Connection reset by peer]
cagomez has quit [Remote host closed the connection]
Nicmavr has joined #ruby
elphe has joined #ruby
cagomez has joined #ruby
za1b1tsu has joined #ruby
desperek has joined #ruby
flakas_ has joined #ruby
cagomez has quit [Remote host closed the connection]
flakas has quit [Ping timeout: 260 seconds]
elphe has quit [Ping timeout: 244 seconds]
za1b1tsu has quit [Ping timeout: 256 seconds]
elphe has joined #ruby
cagomez has joined #ruby
eckhardt_ has joined #ruby
banisterfiend has joined #ruby
alex`` has quit [Ping timeout: 240 seconds]
mostlybadfly has quit [Quit: Connection closed for inactivity]
<elomatreb>
siaw23: There must be something missing, you should probably show your entire code
<siaw23>
elomatreb that’s my entire code
<siaw23>
elomatreb: that’s my entire code
evdubs has joined #ruby
<elomatreb>
In that case what do you mean by getting string?
<siaw23>
the value from the first line `string = gets.chomp`
GodFather has quit [Ping timeout: 244 seconds]
<siaw23>
so whatever i type in the terminal when i run this i get it back instead of []
<siaw23>
i’m trying to get [] if the lenth of whatever i type is not 1
<elomatreb>
By get you mean print to the terminal in this case, or return from a method?
evdubs has quit [Client Quit]
Caerus has quit [Ping timeout: 256 seconds]
<apeiros>
can't be the whole code. toplevel return raises "in `<main>': unexpected return (LocalJumpError)"
<siaw23>
both, return and print to the terminal
<elomatreb>
apeiros: It doesn't (although I'm not quite sure why..)
<siaw23>
apeiros: it doesn't
<apeiros>
I ran this code and it does if I type e.g. "hi\n"
<apeiros>
so not quite sure how you folks run this code…
<siaw23>
wow this is very weird
<siaw23>
i ran it by doing
<siaw23>
ruby lab.rb
<siaw23>
lab.rb has the code in the gist
<siaw23>
nothing more nothing less
<apeiros>
hm, interesting. `ruby` and then running the code is different from running it as a file (running it as a file didn't raise)
<elomatreb>
Anyway, if you want something to be printed you will need some method that actually prints
evdubs has joined #ruby
<elomatreb>
E.g. in your code, the upper branch uses puts for this
<apeiros>
ok. as of ruby 2.4+, toplevel return *in a file* no longer raises.
<apeiros>
interesting.
<siaw23>
elomatreb: i can’t do `puts Array.new`
<siaw23>
yeah so this confuses the hell out of me!
<elomatreb>
siaw23: Depending on what you want, you can use the debug output, `puts Array.new.inspect` (or just `p Array.new`)
lunarkitty7 has quit [Ping timeout: 256 seconds]
<siaw23>
elomatreb: OK so i think just leaving it as `Array.new` works becaues it actually returns []
thy0 has joined #ruby
<elomatreb>
Yes, Ruby always returns the last evaluated expression from a block. This is why an explicit return is often only necessary if you want to abort early
snickers has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ur5us has joined #ruby
desperek has quit [Quit: xoxo]
this_dude has joined #ruby
memo1 has joined #ruby
ur5us has quit [Ping timeout: 260 seconds]
chouhoulis has quit [Ping timeout: 240 seconds]
Caerus has joined #ruby
scrptktty has quit [Quit: Connection closed for inactivity]
siaw23 has quit [Quit: siaw23]
siaw23 has joined #ruby
r3m has joined #ruby
joast has quit [Quit: Leaving.]
zapata has quit [Quit: WeeChat 2.2]
Creatornator has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
siaw23 has quit [Quit: siaw23]
mondz has joined #ruby
zapata has joined #ruby
siaw23 has joined #ruby
alfiemax has joined #ruby
eckhardt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
apeiros has quit []
joast has joined #ruby
<SuperLag>
assureone_packages.grep(/AssureNow4-Cumulative\d{2}.zip$/).max(2).min <-- what does the ".max(2).min" part do?
alfiemax has quit [Ping timeout: 256 seconds]
<SuperLag>
I read that, so far, as "from all the values in var assureone_packages, match on AssureNow4-Cumulative(with any two digits).zip" then I'm lost at what the max & min part does.
siaw23 has quit [Quit: siaw23]
eckhardt_ has joined #ruby
white_lilies has joined #ruby
joast has quit [Quit: Leaving.]
<TJ->
SuperLag: Enumerable.max(2) will return the two largest values. .min will then return the lowest of those
<this_dude>
wait
<this_dude>
so
<this_dude>
im writing a method right now that returns the 3 largest numbers in a string of numbers
<SuperLag>
pay your dues by figuring it out the hard way first... then after you've grown your skills some... okay, here's this MUCH easier way to do it
<this_dude>
but like...everything in that list makes your life 10000000% easier
<this_dude>
thats what i always hated about school
<Caerus>
makes sense, specially if the program is suited for someone that is just comming into programming
<SuperLag>
you just want the calculator up front
<this_dude>
i have the intellect to understand the easier ways from the gitgo but they always made me go at everyone else's pace
<SuperLag>
pay your dues, dude :)
<this_dude>
for example i needed to code a method that takes a string and capitalizes the first letter of each word in the string
<this_dude>
and opposed to their massive code block i did it in one line..again
<SuperLag>
or... maybe they want to know... Can you find out about Enumerable, and how to do it with that?
<SuperLag>
with no help from IRC or anyone else, just pure research skills on your part
<this_dude>
i think im supposed to do self research and blow them away or something
<this_dude>
idk
<this_dude>
but i have 2 exams to take on hacker rank in the next few days
<this_dude>
so lets see how i do
<SuperLag>
I bombed my first try at HR.
<this_dude>
uhoh
<this_dude>
tell me about it
<this_dude>
btw that capitalize method i did like this lo
<Caerus>
well. you could argue that knowing the ´procedural´ way of acomplishing some task makes it so you can appreate the elegance that ruby and it´s core libs provide.
<SuperLag>
It was hard. Over my head. I wasn't ready.
<this_dude>
D:
<this_dude>
dont tell me thatttttt
<Caerus>
its*
<this_dude>
I only have to code midlevel programs according to the email i got
<this_dude>
such as the capitalize one i just described
<SuperLag>
this_dude: ever heard of Chef?
<this_dude>
from ifunny lol?
<SuperLag>
no
<SuperLag>
as in the Ruby DSL for automating "infrastructure as code"
<SuperLag>
like Puppet, like Ansible
<SuperLag>
(and others)
<SuperLag>
but those are The Big Three for automation
<this_dude>
never heard of em
<SuperLag>
Chef development has literally been *my INTRODUCTION* to code, past anything other than bash and perl stuff for sysadmin work
<this_dude>
<Caerus> well. you could argue that knowing the ´procedural´ way of acomplishing some task makes it so you can appreate the elegance that ruby and it´s core libs provide.
<this_dude>
^ in response to this
<TJ->
this_dude: orchestration and configuration management tools
<this_dude>
its because the idea is that they're making it so people who have never coded can get into the program
<SuperLag>
this_dude: and even though I couldn't pass the HR exam, I'm self-employed doing automation work, and doing *very* well for myself.
<this_dude>
but what i dont get is...those people are already at a disadvantage because the way HackerRank works is it ranks you based off points scored in the exams..
<TJ->
this_dude: sounds like it's 2 things: teaching programming, and teaching Ruby
<this_dude>
^ exactly
<SuperLag>
this_dude: I am working to improve my skills, and the more I learn of Ruby, the easier Chef becomes.
<Caerus>
this_dude, I did mention that in the previous comment :)
siaw23 has joined #ruby
<this_dude>
didnt see that srry
<SuperLag>
Caerus: that's better worded than I would have come up with
<SuperLag>
this_dude: if you don't make the grade with the HR exam, just keep working at it
<this_dude>
but yeah i wanna learn the easier ways to do these things considering I already have the coding background for the most part
<this_dude>
but...
<this_dude>
the HR exams are my key to my futureee
wilbert has joined #ruby
<this_dude>
if i dont pass i dont get accepted
<SuperLag>
BS.
<this_dude>
and then i dont get to go to school for free
<this_dude>
and my dreams are deeeed
<this_dude>
DED dead
<SuperLag>
why? who says you need school?
<this_dude>
I wouldnt know what else to do to make money off of coding
<SuperLag>
I went to school. Had zero to do with programming, yet I'm making a living doing just that (imperfectly, I might add!).
<this_dude>
AppAcademy sets its graduates up with jobs
<SuperLag>
<puke>
<this_dude>
):
<SuperLag>
sorry, that's a good line
<SuperLag>
nobody can guarantee you a job
<this_dude>
let me rephrase
<TJ->
Find an open-source project you like, hack on it, contribute code. You'll both learn and be able to point to it as evidence of skill - I'd always take that over some artificial 'exam'
<this_dude>
thats how they get their tuition reimbursed
<this_dude>
they dont charge tuition until you get a job
eckhardt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<this_dude>
so they try their damndest to get you a job
<SuperLag>
all this time you're spending on trying to get in... you could be spending learning, and you'd be closer to paying gigs. You don't need school to do it.
<this_dude>
well uh
<this_dude>
"all this time"
<SuperLag>
If there's anything that I've learned over the past 3+ years of doing this... it's that the best way to learn to code... is TO CODE.
<this_dude>
i was given 10 days to learn ruby enough to pass the exams
<TJ->
^^
<this_dude>
im on day 5
<SuperLag>
read. experiment. break things. figure out how to fix things.
<SuperLag>
lather. rinse. repeat.
siaw23 has quit [Client Quit]
<SuperLag>
Do it crappy OVER and OVER and OVER AGAIN, until eventually you get good at it.
<SuperLag>
this_dude: Very good. Don't stop.
<TJ->
I've found ruby to be a mess, feels like ver sloppy thinking/organisation in many areas. Things like multiple syntaxes for the same code
siaw23 has joined #ruby
<SuperLag>
TJ-: I think many of 'em have many ways to do the same thing
<TJ->
I mean being able to optionally drop syntax
<havenwood>
TJ-: In Ruby TIMTOWTDI.
<TJ->
It's almost worse than python making invisible whitespace syntactially significant
<TJ->
havenwood: right... no engineering discipline
<this_dude>
i have multiple books on violent python i need to study
<TJ->
havenwood: one man's expressiveness, is another man's confusion
<this_dude>
got them off the darkweb hehehe
<havenwood>
TJ-: You can remove more than one way to do it syntax from English, and give that a try. It's overly strict and targeted at new speakers only.
<SuperLag>
this_dude: that is from my invoicing system, so it doesn't reflect all my expenses. it's taken me A. LONG. TIME. to get to this point... but full-time in code every single day? That's been about 3 years.
<this_dude>
oh hey havenwood
<this_dude>
i pm'd you hehehe
<havenwood>
TJ-: It ends up that it's more important to be expressive than to only have one way.
<havenwood>
TJ-: If you prefer one way, you can choose a lang that constrains you in that way!
<SuperLag>
this_dude: there's so much good stuff on Python *FOR FREE* that you don't need to steal anything.
<SuperLag>
this_dude: did you look at that screenshot I linked to?
<this_dude>
yeah holy cow
<SuperLag>
$100/hr.
<SuperLag>
and that's *LOW*
<this_dude>
WHAT
<havenwood>
TJ-: IIR Larry Wall had some interesting things to say about how we gravely err if we target languages at new speakers only.
<this_dude>
HOW
<TJ->
havenwood: that isn't my point; having multiple ways to do the same thing is a recipe for confusion and arguments especially in teams
wilbert has quit [Quit: wilbert]
<this_dude>
minimum wage in my town is 7.25.
<SuperLag>
this_dude: blood. sweat. tears. hard f'n work.
<havenwood>
TJ-: When the team isn't fluent in the language, that's definitely true.
<this_dude>
i'd be happy making 20/hour :'(
<havenwood>
TJ-: If you're looking for a language that best suits amateurs, an essential would be only way way to do anything.
<SuperLag>
this_dude: if you're programming, and experienced at it.... I'd say $40-50/hr is THE FLOOR, for in the US
<TJ->
havenwood: I'm only touching ruby to fix programs that are missing functionality; I woulndn't choose to use it for anything serious
<SuperLag>
this_dude: but listen... I'm *not* an employee. I'm self-employed. I pay all the taxes and insurance and expenses out of that rate.\
<havenwood>
TJ-: I think that''s one reason Python is a great teaching lang.
<SuperLag>
this_dude: it's not even close to the same
<SuperLag>
havenwood: does it have fewer ways to do things? is that part of the reason why you say that?
<havenwood>
SuperLag: Yup.
<havenwood>
SuperLag: I prefer Ruby aesthetically.
<havenwood>
TJ-: Being able to express more with less ends up being incredibly valuable. We've built tons of *serious* things in Ruby.
Creatornator has joined #ruby
<havenwood>
I guess I don't know how serious we're talking. ;-P