« Back to channel list

#ruby - 09 August 2018

« Back 1 day Forward 1 day »
[00:00:47] alfiemax: has joined #ruby
[00:02:11] felix_vs: has joined #ruby
[00:12:03] lxsameer: has joined #ruby
[00:12:17] eckhardt: has joined #ruby
[00:16:40] this_dude: has joined #ruby
[00:16:54] this_dude: howdy folks
[00:17:05] this_dude: gonna do my first attempt at the ruby exam today...im terrified
[00:18:07] havenwood: this_dude: good luck!
[00:18:23] this_dude: someone screen share with me and help ahahaha
[00:18:36] this_dude: i have team viewer lmao
[00:19:31] havenwood: this_dude: https://www.youtube.com/watch?v=07So_lJQyqw
[00:22:08] Radar: this_dude: which ruby exam?
[00:22:18] za1b1tsu: has joined #ruby
[00:22:19] Radar: I thought there was multiple levels like silver / gold
[00:22:37] this_dude: i have entrance exams for appacademy to go to coding school for free
[00:23:06] Radar: Oh those.
[00:23:10] this_dude: lmao havenwood
[00:23:23] this_dude: you know about them or what D:
[00:23:25] Radar: I know of them.
[00:23:29] Radar: I've never done them.
[00:23:33] Radar: Could probably pass them tho
[00:24:00] postmodern: has joined #ruby
[00:24:10] mroutis: has joined #ruby
[00:24:48] eckhardt_: has joined #ruby
[00:25:28] apparition47: has joined #ruby
[00:25:42] Radar: this_dude: ok. pop quiz. Write some code to return the hash that has the email "me@ryanbigg.com": https://gist.github.com/radar/6380938f6e11fa8cabb9c2685b43e6cb
[00:27:14] lxsameer: has joined #ruby
[00:31:40] mroutis: Radar, I didn't understand, maybe I'm late to the conversation
[00:32:29] Radar: mroutis: OK. In that gist there's an array. I want you to write some code that takes that array and returns the hash that contains email: "me@ryanbigg.com"
[00:32:43] Radar: so the return value should be { email: "me@ryanbigg.com", answer: 1 }
[00:32:53] baweaver: user y'mean?
[00:33:02] baweaver: or do you also want to mod the key?
[00:33:03] Radar: uh, yueah
[00:33:10] Radar: user, not email
[00:33:12] Radar: keep the key as-is
[00:34:38] mroutis: array.first { |x| x[:user] == 'me@ryanbigg.com' }
[00:34:46] this_dude: that wouldnt be on my exam
[00:34:52] this_dude: they said hashes wont be on there
[00:34:59] Radar: this_dude: oh.
[00:35:03] Radar: this_dude: what _is_ on the exam then
[00:35:04] baweaver: users.find(user: 'me@ryanbigg.com') # Hehehehe - https://bugs.ruby-lang.org/issues/14869
[00:35:07] Radar: mroutis: also: spoilers.
[00:35:22] s2013: has joined #ruby
[00:35:33] Radar: mroutis: I wouldn't call the variable x.
[00:35:34] mroutis: oh sh... didn't think about spoilers
[00:35:40] this_dude: http://prntscr.com/kgeyqt
[00:36:04] Radar: mroutis: tyvm now I have to think of a new question
[00:36:08] Radar: ACTION strains
[00:36:34] this_dude: hey whats the way to check if a number is in a range of nums?
[00:36:43] this_dude: a.range?(b,c)
[00:37:49] baweaver: this_dude: Remember IRB
[00:37:54] mroutis: this_dude, should I tell you? or send you a gist?
[00:38:04] mroutis: I don't know if this is part of the quizz
[00:38:05] baweaver: Test your code before asking.
[00:38:08] this_dude: just tell me lul
[00:38:23] this_dude: the quiz will need me to write an entire method
[00:38:25] mroutis: range.include? number
[00:38:45] this_dude: range.include? a
[00:39:00] mroutis: [1..10].include? 3
[00:39:11] al2o3-cr: this_dude: (x..y).cover?(z)
[00:39:11] mroutis: how do you tell IRC ruby bot to execute some code?
[00:39:29] baweaver: >> (1..10).include?(3)
[00:39:29] ruby[bot]: baweaver: # => true (https://eval.in/1045837)
[00:39:38] baweaver: array brackets shouldn't work with that mroutis
[00:40:14] baweaver: wanna see something fun?
[00:40:42] mroutis: that's true, baweaver, I don't know what I was thinking about
[00:41:12] baweaver: behold, and shield thine eyes
[00:41:13] baweaver: https://twitter.com/keystonelemur/status/1027329881225408512
[00:41:29] ogres: has joined #ruby
[00:41:55] this_dude: youre using === again baweaver
[00:42:04] this_dude: luckily i read the stuff you sent me
[00:43:13] al2o3-cr: baweaver: TIL, didn't know this either ;)
[00:43:27] this_dude: i have 60 minutes to answer 3 questions
[00:43:30] this_dude: you guys ready?
[00:43:30] baweaver: To be fair I realized it this morning, tried it, and oh man.
[00:43:37] this_dude: im gonna use you as a resource ahahaha
[00:44:11] mroutis: this_dude, could you give us more context? is this an interview for a job?
[00:44:12] baweaver: That wouldn't exactly be very straightforward now would it?
[00:44:36] this_dude: i have to pass 2 exams to get into a coding school
[00:44:51] this_dude: you're 'supposed' to be able to pass with little to no coding experience
[00:44:54] this_dude: but i call bs
[00:45:02] this_dude: these methods are intense
[00:45:02] mroutis: call bs too, indeed
[00:45:30] this_dude: basically i was given 10 days to learn the basics of ruby well enough to code methods and pass the 2 exams
[00:45:35] this_dude: i get 3 tries
[00:45:40] this_dude: im gonna use my first one now to scout out the test
[00:45:46] this_dude: ready guys? D:
[00:46:00] mroutis: are you working fulltime? what did you do with your leasure time, this_dude ? :eyes:
[00:46:11] this_dude: i studied my butt off wdym
[00:46:19] this_dude: im pretty good now ask baweaver
[00:46:27] this_dude: but y'all are my trump card
[00:46:30] mroutis: woah, congrats, this_dude
[00:46:31] this_dude: in case i get stuck hehe
[00:46:51] this_dude: anyways here goes nothin
[00:46:54] s2013: has joined #ruby
[00:46:58] mroutis: bring it on
[00:47:44] this_dude: http://prntscr.com/kgeyqt
[00:47:50] this_dude: wait not that
[00:48:13] this_dude: ok first problem
[00:48:35] this_dude: write a method that takes an array of numbers and multiplies each number by its position in the array and returns the sum
[00:48:39] this_dude: let me see if i can figure it out
[00:48:44] this_dude: yall keep the answer just in case
[00:50:28] Radar: show us yours :)
[00:50:41] this_dude: im giving myself 20 minutes
[00:50:46] this_dude: cause its 60 minutes and 3 questions
[00:50:53] this_dude: someone ping me if i go over time without coming back here
[00:51:10] mroutis: this_dude, 2 min per question, flash it, dude
[00:51:15] DukeDave: has joined #ruby
[00:53:46] this_dude: omg omg omg omg
[00:55:22] this_dude: IM TRYING TO DO IT WITH MAPPING AND ITS HARD
[00:56:56] mroutis: it gets easier, this_dude
[00:57:02] mroutis: but you gotta do it everyday
[00:57:04] mroutis: that's the hard part
[00:57:24] Radar: no answers plz folks
[00:57:28] this_dude: http://prntscr.com/kgf4jv
[00:57:42] this_dude: would that work?
[00:57:46] this_dude: it doesnt give me a way to check
[00:57:52] this_dude: or can someone simplify that with mapping pls
[00:57:57] Radar: this_dude: You're on a computer. Plug it into the irb prompt.
[00:57:58] mroutis: write code to test it and run that code
[00:58:03] Radar: lemur: too slow
[00:58:31] chouhoulis: has joined #ruby
[00:58:59] Radar: Try it in irb. That will let you know if it works.
[00:59:08] Radar: You're lucky here. You know the expected input and output.
[00:59:11] mroutis: chill, Radar, this isn't the west, or is it? :b
[00:59:16] Radar: mroutis: it is
[00:59:28] Radar: mroutis: depends on your perspective though. One person's west is another person's east.
[00:59:58] lemur: Well we can leave the west to you
[01:00:05] this_dude: http://prntscr.com/kgf588
[01:00:07] this_dude: guys please
[01:00:12] this_dude: i dont have time for everyone to be cryptic
[01:00:19] this_dude: is this correct or not
[01:00:43] lemur: y'know we're not being cryptic.
[01:00:43] mroutis: this_dude, IRB is not being cryptic
[01:00:52] mroutis: IRB is your friend
[01:00:59] lemur: If you have Ruby installed, you can run IRB to try your code
[01:01:04] lemur: we've been over this more than once.
[01:01:17] this_dude: idk how to do thatttttt
[01:01:21] this_dude: i have 6 minutes to finish this one
[01:01:25] this_dude: im terrible under pressure
[01:01:38] mroutis: google "how to use IRB"
[01:01:42] mroutis: use your google foo
[01:01:50] Creatornator: has joined #ruby
[01:01:57] lemur: we're not going to give you answers, you do realize.
[01:02:14] lemur: because that'd be cheating.
[01:02:28] mroutis: https://www.youtube.com/watch?v=lPXWt2ESxVY (the flaming lips - do you realize??)
[01:02:31] this_dude: THATS THE POINT
[01:02:46] this_dude: since when are coders so ethical omgggggggg
[01:02:52] mroutis: this is the west, cowboy, we don't cheat here...
[01:02:55] this_dude: i have 4 minutes
[01:02:55] lemur: This channel is
[01:03:07] this_dude: BAWEAVER YOU SLY DOG
[01:03:18] this_dude: well i think its right
[01:03:21] this_dude: so im submitting it
[01:03:25] this_dude: since noone will help me chec
[01:03:27] this_dude: when i fail
[01:03:32] this_dude: ill be back here to cry
[01:03:57] baweaver: This is why we said to learn IRB
[01:04:33] mroutis: there, there... https://www.ruby-lang.org/en/documentation/
[01:04:37] mroutis: chill and read the docs
[01:06:15] this_dude: next problem
[01:06:15] this_dude: http://prntscr.com/kgf6re
[01:06:25] this_dude: i dont even understand what its asking me for
[01:07:36] za1b1tsu: has joined #ruby
[01:08:16] this_dude: nvm i understand it
[01:08:23] this_dude: but have no idea where to even start to code that wtf
[01:10:04] this_dude: you guys have no mercy
[01:10:08] this_dude: im begging you
[01:11:56] lxsameer: has joined #ruby
[01:13:02] this_dude: http://prntscr.com/kgf8hq
[01:13:49] mroutis: test it, boi
[01:13:57] baweaver: https://www.ruby-lang.org/en/documentation/quickstart/
[01:14:25] mroutis: blind coding is fun but you need to run it at some point
[01:15:49] this_dude: its not working
[01:15:54] this_dude: please tell me whats wrong w it
[01:16:05] this_dude: http://prntscr.com/kgf98l
[01:16:12] this_dude: blind coding isnt fun when its AN EXAM
[01:16:14] mroutis: the interpreter should tell
[01:16:23] this_dude: I DONT USE ONE
[01:16:28] this_dude: I RUN IT THROUGH MY COMMAND LINE
[01:17:00] this_dude: HA I GOT IT OMG
[01:17:07] this_dude: im going a little crazy
[01:17:33] this_dude: okay last problem
[01:18:05] this_dude: http://prntscr.com/kgf9pa
[01:18:08] this_dude: wtf looooool
[01:18:12] this_dude: this one will be the death of me
[01:18:20] this_dude: i have 29 mins to code it
[01:22:13] lxsameer: has joined #ruby
[01:23:14] arescorpio: has joined #ruby
[01:24:35] vonfry: has joined #ruby
[01:25:10] this_dude: how do i put in an array
[01:25:26] this_dude: as a response to a gets statement
[01:25:58] baweaver: you don't need gets
[01:26:01] baweaver: just type it in
[01:27:29] this_dude: when i test code
[01:27:35] this_dude: i type it up in notepad
[01:27:42] this_dude: and then run it through my command prompt
[01:27:48] this_dude: with ruby program.rb
[01:28:45] mroutis: you can use "puts" to write to STDOUT, so you can see some output
[01:29:51] kapil___: has joined #ruby
[01:30:33] this_dude: for example i have to add this to the end of all of my code
[01:30:34] this_dude: http://prntscr.com/kgfcog
[01:30:57] this_dude: but when my gets is asking for an array of numbers idk how to enter it in my command line without getting an error
[01:31:18] Radar: popcornnnn\
[01:31:58] baweaver: Radar: be nice
[01:32:26] this_dude: this is my last problem
[01:32:29] this_dude: i think i got it but
[01:32:31] this_dude: i have an issue
[01:32:34] Radar: ?enternotspace
[01:32:34] ruby[bot]: Radar: I don't know anything about enternotspace
[01:32:38] Radar: ruby[bot]: c'mon.
[01:32:41] this_dude: it gives me the right answers
[01:32:47] this_dude: it does this
[01:32:50] Radar: this_dude: Stop using enter like a spacebar plzkthx
[01:34:26] Radar: this_dude: So with your code... I hope you're formatting it with two-space indentation rather than copying + pasting what you have in those screenshots.
[01:34:32] Radar: this_dude: and it's better to share code at gist.github.com
[01:34:59] Radar: this_dude: last warning regarding enter-as-a-spacebar.
[01:35:05] this_dude: my problem is my result is coming back like this http://prntscr.com/kgfdv8
[01:35:11] this_dude: but i need it to come back as an array
[01:35:15] this_dude: i used .to_a
[01:35:15] Radar: this_dude: last warning regarding code output as a screenshot too.
[01:35:20] this_dude: and its still doing that
[01:35:38] this_dude: wait what theres no rule saying i CANT
[01:35:40] Radar: Srsly. Last warning.
[01:35:55] this_dude: it just says when pasting more than 3 lines
[01:35:58] baweaver: Ze hat is out! Ze hat is out!
[01:35:59] baweaver: ACTION ducks
[01:36:03] this_dude: never says anything about a screenshot
[01:36:15] ChanServ: +o baweaver
[01:36:17] Radar: https://ruby-community.com/pages/user_rules#rule_2_4
[01:36:24] Radar: https://ruby-community.com/pages/user_rules#rule_2_5
[01:36:32] mroutis: Radar just raised the ban hammer
[01:36:34] Radar: https://ruby-community.com/pages/user_rules#rule_2_10
[01:36:45] baweaver: ACTION whistles
[01:36:53] ChanServ: -o baweaver
[01:36:59] lxsameer: has joined #ruby
[01:37:04] this_dude: changes the rule because i found a loophole
[01:37:13] ruby[bot]: +qqq $a:this_dude this_dude!*@* *!*@gateway/web/freenode/ip.71.41.174.20
[01:37:17] Radar: Ok, timeout for you.
[01:37:21] Radar: Maybe don't argue with the ops?
[01:38:26] baweaver: Rules are listed, just elided in the channel topic for space reasons.
[01:38:35] ChanServ: +o baweaver
[01:38:55] ChanServ: -o baweaver
[01:41:25] dr_blackjack: has joined #ruby
[01:45:51] wmoxam: has joined #ruby
[01:46:33] ruby[bot]: -qqq $a:this_dude this_dude!*@* *!*@gateway/web/freenode/ip.71.41.174.20
[01:46:59] lxsameer: has joined #ruby
[01:49:07] chouhoulis: has joined #ruby
[01:49:09] ChanServ: +o baweaver
[01:49:19] FrankyCyborg: has joined #ruby
[01:51:10] ChanServ: -o baweaver
[01:55:33] AJA4350: has joined #ruby
[02:01:58] lxsameer: has joined #ruby
[02:04:52] r3my: has joined #ruby
[02:07:34] r3my: Hi, so I’m trying to solve a balanced brackets koan and am running into a problem with a particular case that I’m stumped on
[02:07:38] r3my: Here’s my code so far https://dpaste.de/mgne
[02:08:18] r3my: I have a class level method that’s signature looks like this: `Brackets.paired?(“{]”)`
[02:08:37] r3my: The "{]” test case fails for me and I’m unsure as to how to deal with it
[02:08:52] r3my: I understand why it fails…but not how to get around it
[02:12:11] lxsameer: has joined #ruby
[02:14:53] za1b1tsu: has joined #ruby
[02:17:42] alfiemax: has joined #ruby
[02:21:13] fluxAeon: has joined #ruby
[02:23:22] s2013: has joined #ruby
[02:24:08] rootsudo: has joined #ruby
[02:24:24] Creatornator: has joined #ruby
[02:26:09] rootsudo: What would be good VM specs for a 500 user webapp on Ruby 2.3, Rails 5.1.1, MySQL, React+Jquery,NodeJS and deabating on Heroku
[02:26:41] this_dude: has joined #ruby
[02:26:50] this_dude: am i still muted
[02:27:00] this_dude: i failed the test
[02:28:11] rootsudo: nah not muted
[02:29:05] Aetherical: has joined #ruby
[02:41:54] r29v: has joined #ruby
[02:43:34] AJA4350: has joined #ruby
[02:51:58] lxsameer: has joined #ruby
[02:52:39] mroutis: RootSudo, is rough to say, as it depends on what the app does and how efficient it performs
[02:53:03] mroutis: why don't you try it on a Heroku and run a load test
[02:53:21] this_dude: is anyone still on
[02:53:25] this_dude: i really need help
[02:53:27] bmurt: has joined #ruby
[02:53:42] mroutis: what do you need, this_dude?
[02:54:05] mroutis: did you tried to help yourself before asking?
[02:55:09] mroutis: this_dude: https://hackernoon.com/how-awesome-engineers-ask-for-help-93bcb2c7dbb7
[02:55:32] orbyt_: has joined #ruby
[02:55:44] this_dude: i looked it up
[02:55:47] this_dude: but to no avail
[02:56:40] samort7: has joined #ruby
[02:57:25] samort7: I am trying to learn ftp on a simple ruby file (no rails), but when I do require 'net/ftp' it says "no such file to load" - what am I missing?
[02:57:54] this_dude: its basically what i was asking about earlier..i tried to look it up..when creating a method that asks for an array as an input i cant seem to get the command line to take in my input as an array instead of a string
[02:58:19] this_dude: ive tried changing it in the coding as gets.to_a and ive tried inputting it in the command line as [1,2,3]
[02:58:37] this_dude: but i still get the same error stating that my input is being read as a string
[03:00:33] cadillac_: has joined #ruby
[03:01:13] alfiemax_: has joined #ruby
[03:01:22] al2o3-cr: this_dude: use eval(gets)
[03:01:51] this_dude: so i would put numbers=eval(gets)?
[03:02:11] al2o3-cr: this_dude: yep.
[03:02:19] this_dude: hmm new info..thanks
[03:03:16] this_dude: oh shoot now its stuck in an endless loop
[03:04:11] this_dude: oh nvm my code is wrong
[03:11:44] braincrash: has joined #ruby
[03:14:52] Radar: wb this_dude
[03:15:23] humam: has joined #ruby
[03:15:23] Radar: this_dude: so you failed the test?
[03:15:29] Radar: this_dude: do you still have a copy of the questions?
[03:17:38] this_dude: it was 3 questions
[03:17:56] this_dude: i got one wrong which == fail...i just asked a friend about the one i was pretty sure i got wrong
[03:18:04] this_dude: i forgot to put +1...thats literally it
[03:18:09] this_dude: im very angry with myself
[03:18:19] Radar: this_dude: hmmm maybe you should've followed this channel's advice 🤔
[03:18:30] Radar: oh well too late now 🤷🏻‍♂️
[03:18:36] Radar: 2. Enter not space.
[03:18:44] Radar: 3. Try your code in IRB.
[03:18:45] this_dude: i just now learned how to input an array into the command line
[03:18:57] this_dude: which means i was just now able to check my code from the first question
[03:19:17] Radar: Can you show me the code from the first question?
[03:19:25] this_dude: my answer? or the problem
[03:19:32] Radar: Everything.
[03:20:37] this_dude: so i dont have a copy of the questions but i remember them and i have my code saved...so the first problem was to create a method that takes in an array and returns a sum of (the numbers in the array times their position in the array)
[03:20:57] this_dude: and i used this line
[03:21:03] this_dude: sum = (numbers[i] * i) + sum
[03:21:06] Radar: Ok. An array like: [1,2,3,4,5], and that would then be: [1 * 0, 2 * 1, 3 * 2, 4 * 3, 5 * 4]?
[03:21:07] this_dude: when it shouldve been
[03:21:08] this_dude: sum = (numbers[i] * (i+1)) + sum
[03:21:19] Radar: this_dude: but that can'tve been all of your code. Show me the rest please.
[03:21:28] Radar: For instance, you are not defining `numbers` in that code of yours.
[03:21:42] this_dude: let me uh...figure out how to use gist again gimme a sec ill paste the link here
[03:22:05] Radar: this_dude: dpaste.de or hastebin.com is better if you don't have a GH login
[03:22:43] this_dude: https://dpaste.de/0tuM
[03:22:48] this_dude: just saw that
[03:22:53] this_dude: super useful thanks for the change
[03:23:44] this_dude: oh shoot it also shouldn't have been "while i<= numbers.length" should it ...should just been <
[03:23:53] Radar: >> [1,2,3,4,5].with_index
[03:23:59] ruby[bot]: Radar: I'm terribly sorry, I could not evaluate your code because of an error: NoMethodError:undefined method `[]' for nil:NilClass
[03:24:04] Radar: >> [1,2,3,4,5].with_index
[03:24:09] Radar: ruby[bot]: no.
[03:24:10] ruby[bot]: Radar: I'm terribly sorry, I could not evaluate your code because of an error: NoMethodError:undefined method `[]' for nil:NilClass
[03:24:27] Radar: >> [1,2,3,4,5].each_with_index
[03:24:33] ruby[bot]: Radar: I'm terribly sorry, I could not evaluate your code because of an error: NoMethodError:undefined method `[]' for nil:NilClass
[03:24:36] this_dude: i understand how indexing works
[03:24:38] Radar: Ok. I give up on ruby[bot].
[03:24:46] Radar: [1,2,3,4,5].each_with_index.to_a
[03:24:46] Radar: => [[1, 0], [2, 1], [3, 2], [4, 3], [5, 4]]
[03:24:55] Radar: this_dude: Do you see that this then gives you a 2D array with the numbers you want?
[03:25:09] baweaver: Radar: nice hat
[03:25:16] Radar: this_dude: [[1, 0], [2, 1], [3, 2], [4, 3], [5, 4]].map { |e, i| e * i }
[03:25:18] this_dude: oh hey weaver..
[03:25:27] this_dude: im not supposed to know how to use .map
[03:25:29] this_dude: for the test
[03:25:41] Radar: okayyyyyyy
[03:25:50] baweaver: I'm not supposed to know a lot of things
[03:25:54] this_dude: i need to be able to write it out the long way
[03:25:55] baweaver: I know them anyways
[03:26:00] Radar: that's a crap test
[03:26:02] baweaver: Then people give me magic internet points
[03:26:13] Radar: ok, so without map...
[03:26:28] s2013: has joined #ruby
[03:27:03] Radar: https://gist.github.com/radar/328f0b1d126e6b3123387a73e85d9500
[03:27:25] al2o3-cr: this_dude: https://eval.in/1045848
[03:28:19] this_dude: wait isnt that exactly what i had^?
[03:28:19] Radar: And then with ONLY each: https://gist.github.com/radar/000459fd3ce634accd44cfba200f0e20... but this is not idiomatic Ruby at all. I would go as far as to say it is idiotic Ruby.
[03:28:41] this_dude: radar im not supposed to know how to do that
[03:28:46] this_dude: actually...i DONT know how to do that
[03:29:00] baweaver: >> def map(list, &fn) new_list = []; list.each { |v| new_list.push(fn.call(v)) }; new_list end; map([1,2,3]) { |v| v * 2 } # :D
[03:29:01] ruby[bot]: baweaver: # => [2, 4, 6] (https://eval.in/1045849)
[03:29:08] baweaver: bot likes me
[03:29:11] this_dude: @al203-cr isnt that the same as mine? except you incremented the sum in a different way
[03:29:15] baweaver: ACTION sticks out tongue at Radar 
[03:29:15] Radar: baweaver: well done you've gone and blown this guy's brain.
[03:29:27] this_dude: wtf is that
[03:29:36] Radar: this_dude: al2o3-cr actually indented his code correctly...
[03:29:44] al2o3-cr: this_dude: you're incrementing the index outside of the loop
[03:29:57] al2o3-cr: well, trying.
[03:30:09] this_dude: i just saw that
[03:30:09] Radar: Yeah there is that too.
[03:30:19] this_dude: why are you incrementing inside the loop?
[03:30:36] Radar: because i needs to increase as you move through the elements of the array
[03:30:39] Radar: otherwise you only increment it once.
[03:30:45] Radar: and actually your while loop wouldn't finish.
[03:31:02] Radar: Well this has been fun but I have other things to do. Bye.
[03:31:08] this_dude: later @radar
[03:31:40] baweaver: def map(list, &fn) return [] if list.empty?; head, *tail = list; [fn.call(head)].concat(map(tail, &fn)); end; map([1,2,3]) { |v| v * 2 }
[03:32:00] lxsameer: has joined #ruby
[03:32:00] this_dude: wtf are you saying lol
[03:33:36] al2o3-cr: the idiomatic way would be something like this; [10,20,30,40,50].map.with_index { |n, i| n * i }.sum
[03:34:03] this_dude: its also * (i+1)
[03:36:46] this_dude: nevermind no its not
[03:37:01] lxsameer: has joined #ruby
[03:37:03] duderonomy: has joined #ruby
[03:37:59] NightMonkey: has joined #ruby
[03:38:12] this_dude: wow so i literally got that question wrong because i incremented i outside of the loop..
[03:38:17] this_dude: i feel like a moron
[03:39:10] zenspider: this_dude: hah. we've all done it
[03:39:26] s2013: has joined #ruby
[03:39:38] zenspider: al2o3-cr: (10..50).step(10) ...
[03:39:41] this_dude: im so mad dude...
[03:39:53] this_dude: at myself ofc
[03:40:03] this_dude: i didnt notice because i was busy panicking during the exam
[03:40:42] zenspider: eh. no reason to beat yourself up. we've all done it. even in exams. it's a learning experience
[03:43:55] this_dude: should i just take the test again?
[03:44:03] this_dude: is there anyone still online to help me if i need it
[03:45:11] maryo: has joined #ruby
[03:45:22] this_dude: i guess thats a no :/
[03:45:37] al2o3-cr: this_dude: it's 4:45am here and have to be up in a few hours. but if you're here later i can give you a helping hand.
[03:46:06] al2o3-cr: i need my 40 winks ;)
[03:46:59] this_dude: alright...ill probably be up around 14 hours from now to try the test again
[03:47:00] lxsameer: has joined #ruby
[03:47:40] al2o3-cr: zenspider: i always forget Integer#step too :(
[03:48:13] al2o3-cr: anyway, away with the fairies i go, chow for now.
[03:48:28] this_dude: talk to you tomorrow when i get ready to fail again lul
[03:48:56] al2o3-cr: this_dude: np.
[03:49:21] this_dude: i also didnt know you can use .size
[03:49:25] this_dude: i always thought it was .length
[03:50:07] al2o3-cr: yeah, the synonymous with each other.
[03:51:19] this_dude: well im gonna get some sleep too
[03:51:23] this_dude: night everyone
[03:52:03] lxsameer: has joined #ruby
[03:55:48] Creatornator: has joined #ruby
[03:57:21] AJA4350: has joined #ruby
[04:02:54] za1b1tsu: has joined #ruby
[04:03:39] NightMonkey: has joined #ruby
[04:07:11] lxsameer: has joined #ruby
[04:07:39] reber: has joined #ruby
[04:08:12] reber__: has joined #ruby
[04:17:19] lxsameer: has joined #ruby
[04:30:40] tty: has joined #ruby
[04:31:06] alfiemax: has joined #ruby
[04:42:23] eckhardt: has joined #ruby
[04:51:38] cadillac_: has joined #ruby
[04:57:00] lxsameer: has joined #ruby
[05:02:00] lxsameer: has joined #ruby
[05:05:03] Apocalypse: has joined #ruby
[05:07:00] lxsameer: has joined #ruby
[05:08:06] maryo: has joined #ruby
[05:08:07] \void: has joined #ruby
[05:19:30] s2013: has joined #ruby
[05:22:16] lxsameer: has joined #ruby
[05:23:29] quazimodo: has joined #ruby
[05:31:11] sauvin: has joined #ruby
[05:32:00] lxsameer: has joined #ruby
[05:36:42] apeiros_: has joined #ruby
[05:40:23] za1b1tsu: has joined #ruby
[05:40:44] Tempesta: has joined #ruby
[05:41:53] KevinSjoberg: has joined #ruby
[05:42:14] lxsameer: has joined #ruby
[05:52:03] lxsameer: has joined #ruby
[05:55:00] Apocalypse: has joined #ruby
[06:02:56] blackmesa1: has joined #ruby
[06:07:04] alem0lars: has joined #ruby
[06:17:29] mozzarel1: has joined #ruby
[06:21:07] snickers: has joined #ruby
[06:31:27] aufi: has joined #ruby
[06:33:08] Tempesta: has joined #ruby
[06:36:59] lxsameer: has joined #ruby
[06:43:45] hays: has joined #ruby
[06:44:17] pwnd_nsfw: has joined #ruby
[06:46:58] lxsameer: has joined #ruby
[06:48:42] p4p0l0: has joined #ruby
[06:58:11] drale2k_: has joined #ruby
[06:59:44] bmurt: has joined #ruby
[07:01:30] alfiemax: has joined #ruby
[07:02:09] lxsameer: has joined #ruby
[07:04:31] orbyt_: has joined #ruby
[07:06:56] sysvalve: has joined #ruby
[07:10:14] rootsudo: I don't know what I'm doing
[07:10:19] rootsudo: Why am I here
[07:12:00] lxsameer: has joined #ruby
[07:13:34] alfiemax: has joined #ruby
[07:14:44] za1b1tsu: has joined #ruby
[07:15:45] dionysus69: has joined #ruby
[07:16:15] clemens3: has joined #ruby
[07:20:43] vondruch: has joined #ruby
[07:22:15] lxsameer: has joined #ruby
[07:22:43] tristanp: has joined #ruby
[07:22:56] burgestrand: has joined #ruby
[07:23:50] alfiemax_: has joined #ruby
[07:24:18] desperek: has joined #ruby
[07:25:35] TomyWork: has joined #ruby
[07:25:49] TomyWork: has left #ruby: ("Leaving")
[07:26:17] TomyWork: has joined #ruby
[07:28:07] TomyWork: sorry about the join spam, i'm not on my own comp here, so i'm authenticating manually, and this +r stuff is killing me
[07:28:38] TomyWork: still preferable to the bot situation though :)
[07:36:29] ArahaelPi: +R, you mean.
[07:42:39] psychicist__: has joined #ruby
[07:45:19] avelldiroll: has joined #ruby
[07:50:57] za1b1tsu: has joined #ruby
[07:51:45] Sylario: has joined #ruby
[07:57:53] za1b1tsu: has joined #ruby
[07:58:14] apeiros_: has joined #ruby
[07:58:24] DoubleMalt: has joined #ruby
[08:02:55] p4p0l0: has joined #ruby
[08:03:42] DarthGandalf: has joined #ruby
[08:05:23] lxsameer: has joined #ruby
[08:05:24] mikecmpbll: has joined #ruby
[08:12:36] TomyWork: ArahaelPi no, i mean +r on the channel, which blocks unidentified users
[08:13:42] ChanServ: +o apeiros_
[08:13:50] mistym-: has joined #ruby
[08:13:56] Fridtjof_: has joined #ruby
[08:13:56] Biohazard: has joined #ruby
[08:13:59] bier: has joined #ruby
[08:14:01] nikivi-: has joined #ruby
[08:14:08] apeiros_: -o apeiros_
[08:14:11] erratic: has joined #ruby
[08:14:54] ArahaelPi: TomyWork: Ah. Yeah, everyone should be identified, even if with a unique email address.
[08:19:50] TomyWork: apeiros uh, i still see evidence of the botspam situation here and there. you should leave that on until that blows over
[08:21:25] apeiros__: has joined #ruby
[08:21:33] TomyWork: apeiros uh, i still see evidence of the botspam situation here and there. you should leave that on until that blows over
[08:21:36] apeiros__: god damit, that cable is feebly connected
[08:21:46] apeiros: TomyWork: saw your message :)
[08:21:54] apeiros: I'm around. if necessary I'll reactivate +r
[08:21:59] apeiros: feel free to ping me
[08:26:06] tvw: has joined #ruby
[08:33:45] Beams: has joined #ruby
[08:42:30] Kingsy24: has joined #ruby
[08:42:34] Kingsy24: Christel just posted this "denial" on the freenode blog https://freenode.net/news/spam-shake Why does this blog post mention "10.2 million" THREE times?
[08:44:16] mojtaba: has joined #ruby
[08:46:27] za1b1tsu: has joined #ruby
[08:46:43] ferhaty: has joined #ruby
[08:46:53] apeiros: ok, I guess +r it still is :D
[08:47:02] apeiros: even if Sigyn works great
[08:47:21] vondruch: has joined #ruby
[08:47:35] apeiros: -o apeiros
[08:55:07] Nicmavr: has joined #ruby
[08:56:06] alex``: has joined #ruby
[09:01:05] dhollin3: has joined #ruby
[09:01:45] dionysus69: how do I tell god to restart one of the processes it's handling without restarting the god itself
[09:02:06] apeiros: you send a prayer (scnr)
[09:02:33] apeiros: TomyWork: you're stronger than I :D
[09:03:41] drale2k_: has joined #ruby
[09:03:59] TomyWork: last thing christel posted on twitter is the handshake release post. after that it's just dozens of retweets. maybe someone is pissed off at handshake for some irrational reason... ex team member?
[09:04:49] TomyWork: forgot the 2nd premise: the release post is from about the same time as the start of the spambot attack
[09:23:49] tristanp: has joined #ruby
[09:27:24] mozzarella: has joined #ruby
[09:29:39] vondruch: has joined #ruby
[09:31:03] alfiemax: has joined #ruby
[09:34:19] alex``: has joined #ruby
[09:37:30] ciro: has joined #ruby
[09:51:18] drale2k_: has joined #ruby
[10:01:07] lunarkitty7: has joined #ruby
[10:07:58] KevinSjoberg: has joined #ruby
[10:25:50] sticaz: has joined #ruby
[10:26:17] blackmesa1: has joined #ruby
[10:30:17] gray_-_wolf: Is there noticeable performance impact when using refinements? I'm reading the docs on them and all this activating/deactivating on scope change seems expensive
[10:34:02] yohji: has joined #ruby
[10:35:10] gray_-_wolf: Also, if anyone would be so kind, why I'm getting NoMethodError in this snippet https://paste.vpsfree.cz/UAhbdR7+/ ?
[10:36:02] arahael1: has joined #ruby
[10:36:53] ur5us: has joined #ruby
[10:41:42] beefjoe: has joined #ruby
[10:44:44] za1b1tsu: has joined #ruby
[10:46:04] wildermind: has joined #ruby
[10:47:41] sysvalve: has joined #ruby
[10:48:55] Emmanuel_Chanel: has joined #ruby
[10:49:19] burgestrand: has joined #ruby
[10:50:01] FernandoBasso: has joined #ruby
[10:58:28] balo: gray_-_wolf: i am not familiar with refinements but refining the class method made me interested :D so i looked for it, maybe it's relevant https://stackoverflow.com/questions/27833447/do-refinements-apply-only-to-instance-methods
[10:58:37] balo: it's a bit trickier
[11:00:51] gray_-_wolf: ooooh, so it's `refine ::String.signleton_class do ...` for me
[11:00:54] lxsameer: has joined #ruby
[11:01:37] gray_-_wolf: thank you balo :)
[11:04:37] savolla: has joined #ruby
[11:05:51] balo: sure. just for educational purposes, could you share what is your use-case to use refinements and add class methods to String?
[11:09:13] gray_-_wolf: serialization code, I have bunch of types I want to serialize/deserialize (and one of them is ::String), so I'm basically using `"foo".serialize` and `String.deserialize('bar')`; Since I'm putting stuff onto core class I thought refinements would be good idea
[11:09:35] burgestrand: has joined #ruby
[11:15:32] c0ncealed2: has joined #ruby
[11:19:54] beefjoe: has joined #ruby
[11:24:44] tristanp: has joined #ruby
[11:26:51] burgestrand: has joined #ruby
[11:27:03] yohji: has joined #ruby
[11:28:27] ur5us: has joined #ruby
[11:32:08] vondruch: has joined #ruby
[11:35:10] arekushi: has joined #ruby
[11:39:27] alex``: has joined #ruby
[11:50:57] pulkit4tech: has joined #ruby
[11:51:07] pulkit4tech: has left #ruby: ()
[11:52:42] za1b1tsu: has joined #ruby
[11:55:25] za1b1tsu_: has joined #ruby
[11:58:03] apeiros_: has joined #ruby
[12:04:55] AJA4350: has joined #ruby
[12:06:29] clemens3: has joined #ruby
[12:14:40] AJA4350: has joined #ruby
[12:23:46] Emmanuel_Chanel: has joined #ruby
[12:27:26] maryo_: has joined #ruby
[12:27:26] Dbugger: has joined #ruby
[12:29:15] postmodern: has joined #ruby
[12:42:43] dr_blackjack: has joined #ruby
[12:43:21] fmcgeough: has joined #ruby
[12:48:30] snuz: has joined #ruby
[12:50:47] snuz: has joined #ruby
[13:03:09] gnufied: has joined #ruby
[13:03:41] discopatrick: has joined #ruby
[13:07:27] maryo: has joined #ruby
[13:08:04] flips: has joined #ruby
[13:15:22] dionysus69: so I was dealing with infinite loops with sleep and sometimes I was getting Interrupt Exception, anyone knows potential reasons?
[13:16:29] apeiros: also if you send it via kill command
[13:17:00] dionysus69: no way, I didnt do anything with it, it would exit by itself
[13:18:13] apeiros: interrupts don't happen on their own, you know? :)
[13:19:20] apeiros__: has joined #ruby
[13:21:07] alem0lars: has joined #ruby
[13:26:15] HoierM: has joined #ruby
[13:27:39] KevinSjoberg: has joined #ruby
[13:27:41] bmurt: has joined #ruby
[13:29:40] dionysus69: it wasn't an interrupt, but interrupt exception, I just did interupt with ctrl-c and it was a totally different error
[13:30:01] dionysus69: it had regular ruby error trace
[13:31:27] InfinityFye: has joined #ruby
[13:32:08] apeiros__: yes, interrupt exceptions happen on interrupts. hence the name.
[13:41:12] blackmesa1: has joined #ruby
[13:43:10] drale2k_: has joined #ruby
[13:47:43] akofink: has joined #ruby
[13:47:59] akofink: has left #ruby: ("WeeChat 2.2")
[13:49:25] vondruch: has joined #ruby
[13:55:41] Dbugger: has joined #ruby
[13:57:02] gnufied: has joined #ruby
[13:57:04] gnufied__: has joined #ruby
[13:57:54] pwnd_nsfw: has joined #ruby
[13:58:43] jottr: has joined #ruby
[13:59:51] mojtaba: has joined #ruby
[14:11:04] augcesar: has joined #ruby
[14:11:49] quazimodo: has joined #ruby
[14:14:05] pulkit4tech: has joined #ruby
[14:14:17] pulkit4tech: has left #ruby: ()
[14:15:20] Rapture: has joined #ruby
[14:24:20] akaiiro: has joined #ruby
[14:28:20] maryo_: has joined #ruby
[14:29:39] nofxx: has joined #ruby
[14:33:22] savolla: has joined #ruby
[14:34:11] Beams_: has joined #ruby
[14:34:18] maryo_: has joined #ruby
[14:53:08] akaiiro: has joined #ruby
[14:55:13] Beams: has joined #ruby
[14:57:19] maryo: has joined #ruby
[14:58:57] k0mpa: has joined #ruby
[15:00:33] TvL2386: hey everybody! I'm reading about metaprogramming here https://viewsourcecode.org/why/hacking/seeingMetaclassesClearly.html and I followed an example which doesn't output what the blog says it does. Unfortunately it has no date, so I am assuming it just works differently on my ruby-2.5.1. Can someone please look at my little gist and tell me why it doesn't output what I'd expect?
[15:00:38] TvL2386: https://gist.github.com/TvL2386/98313758cfd527b2bb9dd07bec4ba225
[15:01:16] TvL2386: I've tried to dig through YAML::dump to see if it actually calls :to_yaml_properties somewhere, but I'm lost
[15:06:53] apeiros_: has joined #ruby
[15:07:01] dionysus69: lambdas can't be named with question mark at the end like methods?
[15:07:18] apeiros_: lambdas can't be named period
[15:07:23] apeiros_: what you named was a variable
[15:07:30] apeiros_: and no, those can't have question marks at the end.
[15:08:23] dionysus69: ok thanks apeiros_
[15:11:49] za1b1tsu_: has joined #ruby
[15:12:23] rippa: has joined #ruby
[15:14:39] HoierM: has joined #ruby
[15:19:43] apeiros_: has joined #ruby
[15:26:34] havenwood: TvL2386: Define #to_yaml_properties in MailTrunk, not at top level.
[15:27:08] havenwood: TvL2386: %i[@driver @route]
[15:27:32] havenwood: TvL2386: (You'll want `[:@driver, :@route]` instead of `[@driver, @route]`.
[15:30:05] ur5us: has joined #ruby
[15:30:34] snuz: has joined #ruby
[15:31:00] apeiros_: has joined #ruby
[15:32:29] havenwood: TvL2386: Oh, I see - you're doing it that way on purpose.
[15:33:34] havenwood: Defining it on the instance, I mean.
[15:35:26] havenwood: TvL2386: The only problem I see is the way you're providing the instance variables. It looks like #to_yaml_properties was deprecated a while back.
[15:38:33] mynameisdebian: has joined #ruby
[15:44:27] havenwood: warn "#{loc}: to_yaml_properties is deprecated, please implement \"encode_with(coder)\""
[15:50:26] AJA4350: has joined #ruby
[15:53:27] reber: has joined #ruby
[15:54:25] s2013: has joined #ruby
[15:55:39] AJA4350: has joined #ruby
[15:58:28] havenwood: TvL2386: Here's an example with YAML and Marshal: https://gist.github.com/havenwood/1e0111232b3e441d3ec60f103212508a
[15:59:03] havenwood: P.S. - Shouldn't this be a "dump" truck?
[16:07:44] _Caerus: has joined #ruby
[16:08:55] AJA4350: has joined #ruby
[16:10:22] Blaguvest: has joined #ruby
[16:10:38] NightMonkey: has joined #ruby
[16:13:12] polishdub: has joined #ruby
[16:19:58] KevinSjoberg: has joined #ruby
[16:20:38] KevinSjoberg: has joined #ruby
[16:22:12] mikecmpbll: has joined #ruby
[16:28:11] Emmanuel_Chanel: has joined #ruby
[16:28:56] thy0: has joined #ruby
[16:30:03] thy0: has joined #ruby
[16:33:57] TomyLobo: has joined #ruby
[16:34:43] darix: has joined #ruby
[16:38:58] orbyt_: has joined #ruby
[16:39:37] Puffball: has joined #ruby
[16:40:58] s2013: has joined #ruby
[16:41:18] akaiiro: has joined #ruby
[16:44:53] AJA4351: has joined #ruby
[16:46:48] HoierM: has joined #ruby
[16:49:10] SeepingN: has joined #ruby
[16:52:59] zxq2: has joined #ruby
[16:54:33] cadillac_: has joined #ruby
[16:54:56] orbyt_: has joined #ruby
[16:56:13] AJA4350: has joined #ruby
[16:57:09] Eiam: has joined #ruby
[16:58:11] Miron: has joined #ruby
[16:58:48] maryo: has joined #ruby
[17:00:20] vasilakisFiL: has joined #ruby
[17:01:35] vasilakisFiL: if you would accept a proc/lambda in some part of your code as an argument, would you check it using responds_to?(:call) or is_a?(Proc) ? The former has the advantage the you can send whatever as long as it responds to call, what is the advantage of the latter ?
[17:02:40] apeiros_: vasilakisfil: I'd usually accept a proc as a block argument. no need to perform checks then (beyond block_given?, but I usually save myself even doing that)
[17:03:11] apeiros: in case you're unaware: using &, you can convert a Proc instance to a block.
[17:03:35] apeiros: >> add1 = ->(val) { val+1 }; [1,2,3].map(&add1)
[17:03:36] ruby[bot]: apeiros: # => [2, 3, 4] (https://eval.in/1046077)
[17:04:30] vasilakisFiL: yeah I agree, I do the same when dealing with method arguments. My use case is a hash-based DSL that you can set an option using a symbol or a proc.
[17:04:33] vasilakisFiL: cool I didn't know that
[17:07:06] jcarl43: has joined #ruby
[17:07:19] snickers: has joined #ruby
[17:09:20] akaiiro: has joined #ruby
[17:14:15] s2013: has joined #ruby
[17:18:12] AJA4351: has joined #ruby
[17:18:43] sonne: has joined #ruby
[17:19:28] mojtaba: has joined #ruby
[17:23:34] za1b1tsu: has joined #ruby
[17:30:49] ur5us: has joined #ruby
[17:33:51] al2o3-cr: why does the proc seem to consume the array; https://eval.in/1046086
[17:33:55] cadillac_: has joined #ruby
[17:34:50] Caerus: has joined #ruby
[17:34:52] apeiros: al2o3-cr: the return value of p *args is *args
[17:35:05] AJA4351: has joined #ruby
[17:35:15] apeiros: since `p x, y` is your last expression in the block, the block's return value is [x, y]
[17:35:23] al2o3-cr: apeiros: why is it different with lambda though?
[17:36:08] apeiros: different auto-unsplatting-rules
[17:37:26] al2o3-cr: apeiros: ah, ok. just thought they would work the same.
[17:38:06] apeiros: na, procs behave like blocks. and for historic reasons they're rather, lets say, liberal in how they auto-splat
[17:38:25] apeiros: lambdas otoh behave like defined methods wrt their arguments
[17:39:14] al2o3-cr: apeiros: that straightened that up then. :)
[17:39:15] gnufied__: has joined #ruby
[17:39:41] apeiros: if you explicitly splat, you can get the same behavior btw.
[17:40:20] apeiros: oh, actually not, since arity is enforced in lambdas 🙈
[17:40:28] nowhere_man: has joined #ruby
[17:40:53] al2o3-cr: apeiros: ah, of course yeah.
[17:41:21] al2o3-cr: oops i'm getting like this dude :(
[17:42:24] baweaver: apeiros: the auto-unsplatting diff is a bug in 2.4+
[17:42:37] apeiros: baweaver: huh? you sure?
[17:42:39] baweaver: should be patched soon iirc.
[17:42:57] baweaver: I remember because I was pissed off at it and had to patch Qo to use proc instead everywhere
[17:43:18] baweaver: I'd been working on 2.3 because RVM shenanigans
[17:44:04] rfoust: has joined #ruby
[17:48:24] tag: has joined #ruby
[17:56:22] jottr: has joined #ruby
[17:56:41] r29v: has joined #ruby
[17:58:32] yoshida_: has joined #ruby
[17:59:07] kapil___: has joined #ruby
[17:59:58] yoshida_: has left #ruby: ()
[18:01:27] darkhanb: has joined #ruby
[18:02:54] blackmesa1: has joined #ruby
[18:02:57] jcarl43: has joined #ruby
[18:04:31] Inline: has joined #ruby
[18:11:14] eckhardt: has joined #ruby
[18:11:55] Creatornator: has joined #ruby
[18:14:06] sameerynho: has joined #ruby
[18:15:13] jottr: has joined #ruby
[18:17:45] AJA4350: has joined #ruby
[18:23:06] AJA4351: has joined #ruby
[18:28:04] Creatornator: has joined #ruby
[18:30:22] c0ncealed2: has joined #ruby
[18:33:46] AJA4351: has joined #ruby
[18:36:28] tty: has joined #ruby
[18:41:41] AJA4351: has joined #ruby
[18:47:28] mojtaba: has joined #ruby
[18:53:43] linuxdaemon: has joined #ruby
[18:53:49] tdy: has joined #ruby
[19:01:31] mroutis: has joined #ruby
[19:11:15] Eldritch: has joined #ruby
[19:14:37] Creatornator: has joined #ruby
[19:21:12] dtzuzu: has joined #ruby
[19:28:36] ur5us: has joined #ruby
[19:29:02] jottr: has joined #ruby
[19:34:19] blackmesa1: has joined #ruby
[19:34:47] Nicmavr: has joined #ruby
[19:35:47] Dbugger: has joined #ruby
[19:36:05] eckhardt: has joined #ruby
[19:38:33] akaiiro: has joined #ruby
[19:45:32] blackmesa: has joined #ruby
[19:48:43] jcalla: has joined #ruby
[19:51:48] orbyt_: has joined #ruby
[19:51:56] d^sh: has joined #ruby
[19:56:05] blackmesa: has joined #ruby
[20:01:30] Rapture: has joined #ruby
[20:08:41] blackmesa1: has joined #ruby
[20:15:39] ptx0_: has joined #ruby
[20:20:52] zerowaitstate: has joined #ruby
[20:21:58] mikecmpbll: has joined #ruby
[20:22:17] zerowaitstate: I am writing a test case in RSpec, and I need to mock the result of a factory method, but the result of the call needs to be different based upon the input. In RSpec, the mocks provided appear to rely on the order in which the method is called. I need the mock to return a particular output for a given input, irrespective of the order it is called. How do I do that?
[20:30:53] AJA4350: has joined #ruby
[20:31:59] mroutis: has joined #ruby
[20:32:41] duderonomy: has joined #ruby
[20:33:43] AJA4351: has joined #ruby
[20:35:02] dionysus69: has joined #ruby
[20:40:51] Creatornator: has joined #ruby
[20:44:38] AJA4351: has joined #ruby
[20:48:38] AJA4350: has joined #ruby
[20:51:54] AJA4351: has joined #ruby
[20:54:49] AJA4351: has joined #ruby
[20:54:51] jcalla: has joined #ruby
[20:58:19] cagomez: has joined #ruby
[21:01:46] blackmesa1: has joined #ruby
[21:03:31] jcarl: has joined #ruby
[21:03:58] eckhardt: has joined #ruby
[21:04:18] AJA4350: has joined #ruby
[21:08:15] nicesignal: has joined #ruby
[21:13:16] AJA4351: has joined #ruby
[21:15:32] AJA4351: has joined #ruby
[21:21:07] AJA4350: has joined #ruby
[21:21:15] r29v: has joined #ruby
[21:29:03] AJA4350: has joined #ruby
[21:31:51] al2o3-cr: >> ([?x]*3).map{|*a|a*3}
[21:31:51] ruby[bot]: al2o3-cr: # => [["x", "x", "x"], ["x", "x", "x"], ["x", "x", "x"]] (https://eval.in/1046137)
[21:32:57] al2o3-cr: i need this 3 bytes shorter
[21:33:19] eckhardt: has joined #ruby
[21:34:37] mroutis: >> [[?x]*3]*3
[21:34:43] ruby[bot]: mroutis: I'm terribly sorry, I could not evaluate your code because of an error: NoMethodError:undefined method `[]' for nil:NilClass
[21:35:41] al2o3-cr: mroutis: by using map only.
[21:37:17] arescorpio: has joined #ruby
[21:41:03] AJA4350: has joined #ruby
[21:41:53] al2o3-cr: evil this: eval "STDIN.ioctl 0x00005412, \"\u001a\""
[21:41:57] akaiiro: has joined #ruby
[21:45:17] SirFunk: has joined #ruby
[21:50:36] AJA4350: has joined #ruby
[21:53:11] eckhardt: has joined #ruby
[21:58:07] Caerus: has joined #ruby
[22:01:16] beowuff: has joined #ruby
[22:07:11] SirFunk: has joined #ruby
[22:07:44] improv42: has joined #ruby
[22:10:25] mroutis: has joined #ruby
[22:12:27] apeiros: has joined #ruby
[22:16:29] sonne: has joined #ruby
[22:21:02] baweaver: al2o3-cr: got any cookies?
[22:21:15] baweaver: cause I got yer bytes
[22:22:35] baweaver: >> [ (1..3).map{[?x]*3}, '(1..3).map{[?x]*3}'.size, '([?x]*3).map{|*a|a*3}'.size ]
[22:22:36] ruby[bot]: baweaver: # => [[["x", "x", "x"], ["x", "x", "x"], ["x", "x", "x"]], 18, 21] (https://eval.in/1046145)
[22:22:54] Creatornator: has joined #ruby
[22:22:58] baweaver: mroutis: al2o3-cr owes us cookies
[22:23:20] orbyt_: has joined #ruby
[22:23:32] al2o3-cr: baweaver: free cookies forever ;)
[22:23:50] baweaver: Trick with map is no one said a dang thing about it needing a param, or that it even needs to respect the left-hand
[22:23:56] al2o3-cr: baweaver: i knew you could do it.
[22:24:06] baweaver: Took me a bit to think of one.
[22:24:40] baweaver: My first thought was making another trick, then I thought screw it: what can we do to cheat?
[22:25:43] al2o3-cr: baweaver: i got a question?
[22:25:59] baweaver: i got an answer?
[22:26:36] al2o3-cr: >> [-> a {}.parameters, proc { |a| }.parameters]
[22:26:42] ruby[bot]: al2o3-cr: I'm terribly sorry, I could not evaluate your code because of an error: NoMethodError:undefined method `[]' for nil:NilClass
[22:26:52] al2o3-cr: >> [-> a {}.parameters, proc { |a| }.parameters]
[22:26:56] baweaver: bot is screwy
[22:26:57] ruby[bot]: al2o3-cr: I'm terribly sorry, I could not evaluate your code because of an error: NoMethodError:undefined method `[]' for nil:NilClass
[22:27:21] al2o3-cr: why is lambda required and proc optional?
[22:27:38] baweaver: proc is a lot looser with params
[22:27:45] baweaver: which is why I almost universally prefer lambdas
[22:27:58] baweaver: but wait! Why the heck do you use procs in Qo everywhere!?
[22:28:07] baweaver: Aha! That's the trick, now isn't it
[22:28:16] baweaver: 2.4+ broke implicit destructuring of lambdas
[22:28:27] baweaver: so for compat reasons I had to use procs T-T
[22:29:05] al2o3-cr: baweaver: you're an evil lemur ;)
[22:29:25] mroutis: haha! coool
[22:29:46] baweaver: This was fun if you haven't seen it yet: https://medium.com/@baweaver/creating-reducing-enumerable-an-illustrated-adventure-c6adfcc30d5b
[22:31:30] chouhoulis: has joined #ruby
[22:31:37] baweaver: al2o3-cr: This means the quality of art in the book just took a massive leap forward.
[22:31:51] baweaver: and the entire conference talk was practice to get there.
[22:33:59] al2o3-cr: baweaver: did you go to art school or was it just a natural gift?
[22:35:13] al2o3-cr: the only thing i draw is the curtains ;)
[22:35:14] mroutis: maybe a lot of doodling at school :p
[22:35:32] al2o3-cr: mroutis: maybe :)
[22:35:49] al2o3-cr: some talent that though drawing and ruby!
[22:36:53] bambanx: has joined #ruby
[22:39:00] baweaver: Funny story on that actually
[22:39:14] al2o3-cr: 'baweaver the reducer'. nice name of a ruby god ;)
[22:39:59] baweaver: I had a tendency to sketch when I was done with things. One teacher didn't like that too much, so he confiscated the pad and told me to pay attention. By the time he was back at it, I had another pad out to sketch more. He wasn't amused, so he sent me to ISS after confiscating it and my other sketch books.
[22:40:13] baweaver: Little did he know I had one more up my sleeve.
[22:40:28] baweaver: Nice try though. Football coaches are always the worst teachers.
[22:41:12] al2o3-cr: my best teachers were science and maths.
[22:41:32] baweaver: But no, never had any formal art education. Self-taught. There was one time I was walking around the arts department while the art teacher was giving a presentation on digital work.
[22:41:33] baweaver: I recognized one of my pieces, so I popped in and said so.
[22:41:45] baweaver: She stopped class, grabbed me, and forced me to apply for AP art on the spot my Senior year
[22:42:08] mroutis: desperate teachers ^
[22:42:26] baweaver: This one specifically - https://www.deviantart.com/baweaver/art/Koinonia-89308458
[22:42:34] Emmanuel_Chanel: has joined #ruby
[22:42:35] al2o3-cr: mroutis: or teachers that value talent
[22:42:51] baweaver: So I have a question for you all
[22:43:07] baweaver: on a scale of 1 to 10, how do the following talk titles jump out to you
[22:43:31] baweaver: The Most RSpectacular Show on Earth! An Illustrated Guide to Testing
[22:43:57] baweaver: The Pattern Matching Express - An Illustrated Guide to FP
[22:44:12] al2o3-cr: >> 22.divmod(7).reduce(:**)
[22:44:18] ruby[bot]: al2o3-cr: I'm terribly sorry, I could not evaluate your code because of an error: NoMethodError:undefined method `[]' for nil:NilClass
[22:44:19] mroutis: baweaver, your deviantart has a lot of wallpaper potential :p ! nice content
[22:44:41] al2o3-cr: jk, i'd give a 9.5 easily :)
[22:45:01] baweaver: There are two more Reducing Enumerable talks I have mostly plotted
[22:45:31] baweaver: "The Continuing Adventures of Red" and "The Path of Master Scarlett"
[22:45:37] baweaver: The first goes into more Enumerable hackery, the second goes hardcore into transducers
[22:46:18] mroutis: I'd give the FP one an 8 the testing one 4
[22:46:45] baweaver: Here's a fun one for ya: Given a count of seconds, tell me how many (seconds, minutes, hours, days, months, years) that constitutes
[22:46:51] al2o3-cr: mroutis: harsh! =P
[22:47:22] mroutis: al2o3-cr, sorry, didn't mean it
[22:47:31] baweaver: Eh, maybe not months
[22:47:32] baweaver: we'll say just years
[22:47:36] al2o3-cr: mroutis: i know ;)
[22:47:58] mroutis: baweaver, can you give an example? (input -> output)
[22:48:42] al2o3-cr: i'd use the start of the epoch.
[22:48:51] al2o3-cr: and the Time.class
[22:49:18] al2o3-cr: damn, i'm even typing ruby in a sentence now
[22:50:30] baweaver: seconds_to_units(1_000_000) => [40, 46, 13, 11, 0]
[22:51:41] baweaver: >> UNITS = [60, 60, 24, 365]; def seconds_to_units(s) UNITS.reduce([s]) { |x, u| x.concat(x.pop.divmod(u).reverse) } end; seconds_to_units(1_000_000)
[22:51:42] ruby[bot]: baweaver: # => [40, 46, 13, 11, 0] (https://eval.in/1046147)
[22:51:48] al2o3-cr: baweaver: don't tell me reduce?
[22:51:59] mroutis: ufff :ok_hand:
[22:52:08] za1b1tsu: has joined #ruby
[22:52:10] baweaver: divmod returns the total times it goes in cleanly with the remainder
[22:52:25] baweaver: So what you do is you reverse that which gives you clean divides, remainder
[22:52:29] this_dude: has joined #ruby
[22:52:33] baweaver: meaning the next pop is the remainder
[22:52:36] this_dude: howdy folks
[22:52:44] this_dude: hey baweaver
[22:52:47] baweaver: you need to see
[22:52:52] this_dude: ready to help me fail agian?
[22:52:55] baweaver: >> UNITS = [60, 60, 24, 365]; def seconds_to_units(s) UNITS.reduce([s]) { |x, u| x.concat(x.pop.divmod(u).reverse) } end; seconds_to_units(1_000_000)
[22:52:56] ruby[bot]: baweaver: # => [40, 46, 13, 11, 0] (https://eval.in/1046148)
[22:53:03] mroutis: a wild this_dude appeared
[22:53:09] baweaver: seconds -> seconds, minutes, hours, days, years
[22:53:09] this_dude: hey routis hehe
[22:53:29] this_dude: ACTION uses study mode...its was super effective
[22:53:31] baweaver: this_dude: get good with IRB before you try it
[22:53:53] mroutis: can't agree more ^
[22:54:06] baweaver: al2o3-cr: stack reduction, much fun.
[22:54:10] this_dude: is irb anywhere else except in the command line?
[22:54:17] this_dude: or am i just confused
[22:54:19] al2o3-cr: baweaver: sure is :)
[22:54:35] baweaver: There are online REPLs, but IRB locally yeah
[22:54:44] baweaver: eval.in for instance
[22:54:50] al2o3-cr: this_dude: use pry dude
[22:55:02] mroutis: gem install pry
[22:55:21] this_dude: i still dont know what pry is XD
[22:55:23] mroutis: it is IRB on steroids
[22:55:31] al2o3-cr: big muscles
[22:55:31] 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
[22:55:59] baweaver: The problem with IRC is you get the entire fire hose
[22:56:06] this_dude: the questions were mad easy last time i just made a dumb mistake i think i got this
[22:56:10] al2o3-cr: and many opinions
[22:56:12] this_dude: and everyone is here so its a good time
[22:56:22] al2o3-cr: or is that onions
[22:56:37] this_dude: we going into the deep web now?
[22:56:51] this_dude: ACTION uses .onion to access secret website with all answers to his exam
[22:57:05] this_dude: ACTION cries because this is all fantasy
[22:57:10] al2o3-cr: nah, just chicken and onions
[22:57:36] this_dude: i took a prescribed xanax so im calm so i wont freak out on the test this tiem
[22:57:42] this_dude: lets ace this test
[22:58:28] mroutis: lol, this_dude, are you kidding?
[22:58:51] al2o3-cr: this_dude: you don't need that dude, just relax
[22:58:59] this_dude: they got harder
[22:59:00] duderonomy: has joined #ruby
[22:59:05] this_dude: guys lmao its a scam
[23:00:41] this_dude: this is the problem (please dont ban me its not a screenshot of code its the problem) http://prntscr.com/kgtoaz
[23:01:08] bmurt: has joined #ruby
[23:01:20] al2o3-cr: this_dude: fIzZBuZz
[23:04:31] this_dude: let me code it and then we can see if its right
[23:06:03] al2o3-cr: this_dude: remember the modulo operator ;)
[23:06:41] this_dude: ok im done i think
[23:06:55] this_dude: https://dpaste.de/905G
[23:07:12] this_dude: gonna test it now but lets see if you notice any obvious syntax errors
[23:07:53] bmurt: has joined #ruby
[23:08:06] jcarl43: has joined #ruby
[23:08:50] baweaver: you'd have a much easier time if you indented things properly
[23:09:32] this_dude: so the result when testing with the number 15 is it goes
[23:09:43] this_dude: 1 2 Fizz and then ends
[23:10:09] this_dude: i typoed elsif
[23:10:22] baweaver: https://dpaste.de/DcdM
[23:10:32] baweaver: See? Easier to read.
[23:10:44] Sembei: has joined #ruby
[23:11:12] this_dude: did i increment i inside the loop correctly?
[23:12:17] al2o3-cr: this_dude: yeah, but fgs indent dude.
[23:12:42] this_dude: https://dpaste.de/NksO#L9
[23:12:58] al2o3-cr: this_dude: ALWAYS inc inside
[23:13:44] al2o3-cr: or decrement for that matter.
[23:13:59] this_dude: sounds good
[23:14:00] al2o3-cr: or modulo or what ever
[23:14:04] this_dude: thanks guys..submitting now
[23:14:18] al2o3-cr: this_dude: did you test it first?
[23:14:51] noobineer: has joined #ruby
[23:15:10] this_dude: worked perfectly
[23:15:37] al2o3-cr: what does 97 give?
[23:16:07] havenwood: ?gist this_dude
[23:16:07] ruby[bot]: this_dude: https://gist.github.com - Multiple files, syntax highlighting, even automatically with matching filenames, can be edited
[23:16:14] havenwood: ?gist_usage this_dude
[23:16:14] ruby[bot]: this_dude: To properly use gist, please enable syntax highlighting, either by choosing the language manually or by entering a proper filename. If you post multiple things, separate them into multiple files. If you have a Github account, please update your gist with new information instead of posting
[23:16:22] havenwood: ?gist-usage this_dude
[23:16:23] ruby[bot]: this_dude: https://github.com/radar/guides/blob/master/using-gist.markdown
[23:16:57] this_dude: oh this one is complicated
[23:17:01] this_dude: http://prntscr.com/kgtt8v
[23:17:01] sparr: if !by['group'].nil? && by['group'] != :undef <-- what part of this might possibly throw a "can't convert String into Integer" error?
[23:17:13] Alina-malina: has joined #ruby
[23:17:41] this_dude: its gives a super long list
[23:17:58] al2o3-cr: sparr: that way to sparse.
[23:18:06] this_dude: in response to your question al203^
[23:18:06] havenwood: sparr: Is `by` an Array?
[23:18:31] this_dude: hey so i know in map theres a way to rotate with .rotate
[23:18:40] this_dude: how do i know it in different directions
[23:18:54] havenwood: >> [1, 2, 3].rotate -1
[23:18:55] this_dude: for example in the problem theres a gets value for a right shift and a left shift
[23:18:55] ruby[bot]: havenwood: # => [3, 1, 2] (https://eval.in/1046156)
[23:19:08] this_dude: and when i need it to do both?
[23:19:11] sparr: havenwood: by is a hash, or should be
[23:19:31] this_dude: in the problem it asks for me a left rotate and a right rotate
[23:19:39] this_dude: i need it to do both at the same tiem
[23:19:43] havenwood: sparr: []['group'] #!> TypeError: no implicit conversion of String into Integer
[23:20:17] havenwood: this_dude: Rotating left and right at the same time would do nothing, right?
[23:20:34] havenwood: this_dude: Please use text rather than images to represent text when showing example in the channel.
[23:20:43] blood: has joined #ruby
[23:21:07] sparr: ok, thanks, I'll try to figure out why by is the wrong type
[23:21:18] this_dude: no but for example
[23:21:23] jdawgaz: has joined #ruby
[23:21:30] this_dude: if i need a 1 left rotation and then 2 right rotation
[23:21:55] this_dude: so i need it to execute the left_rotation followed by right_rotation
[23:22:17] blood: I'm using puppet's xml_fragment module which uses REXML and i'm trying to add support to remove a tag along with its parent assuming parent isn't root. Any idea how I can accomplish this?
[23:22:46] blood: https://github.com/Areson/xml_fragment/blob/master/lib/puppet/util/xml_file.rb#L152 This is where the removal is done for a single tag
[23:22:54] havenwood: this_dude: isn't 1 left and 2 right the same as 1 right?
[23:23:17] this_dude: so can i do this?
[23:23:18] this_dude: res=s.map { |v| v.rotate(leftShifts).rotate(rightShifts)}
[23:23:46] this_dude: or well actually s.chars.map
[23:24:22] this_dude: i gotta hurry only 14 minutes left for this problem
[23:25:10] al2o3-cr: this_dude: you're testing us now lol :)
[23:25:35] this_dude: sorry if im being annoying
[23:25:43] ur5us: has joined #ruby
[23:26:04] havenwood: headlessCamelsAreAnAbomination
[23:26:47] baweaver: rotate works on an array
[23:26:54] baweaver: so string.chars.rotate ....
[23:27:31] baweaver: Just remember that they want a string back
[23:27:32] baweaver: so you have to have a way to put it back together
[23:28:22] baweaver: join, close.
[23:29:03] this_dude: in the code they use to test my answer they put rightShifts = gets.strip.to_i
[23:29:07] this_dude: what is .strip?
[23:29:31] baweaver: >> "string\n".strip
[23:29:32] ruby[bot]: baweaver: # => "string" (https://eval.in/1046161)
[23:29:41] baweaver: I prefer chomp, but doesn't matter.
[23:30:08] this_dude: im getting a weird answer
[23:30:12] this_dude: here is my code so far
[23:30:16] this_dude: weird error**
[23:31:07] this_dude: https://dpaste.de/GUMb
[23:31:15] this_dude: and i only have 8 minutes to fix it uhoh
[23:31:25] this_dude: anything stand out as off?
[23:32:25] mroutis: ri String.strip
[23:32:56] mroutis: oh, I thought that ruby bot had ri integrated
[23:33:11] havenwood: &ri String#strip
[23:33:34] al2o3-cr: havenwood: `derpy gone too :(
[23:33:36] havenwood: https://ruby-doc.org/core/String.html#method-i-strip
[23:33:54] this_dude: i literally dont have time to rad
[23:33:59] this_dude: its a timed test
[23:34:37] this_dude: can someone just tell me where my error is please..
[23:34:44] this_dude: i dont see anything wrong??
[23:34:51] al2o3-cr: this_dude: are you for real?
[23:35:30] mroutis: there's always time for a good lecture on ruby-doc
[23:35:52] al2o3-cr: this_dude: your hair is brown?
[23:36:21] mroutis: https://www.xkcd.com/1168/
[23:36:24] this_dude: omg guys im out of time
[23:36:28] al2o3-cr: this_dude: and you pineapple?
[23:36:42] this_dude: im gonna cry seriously
[23:36:48] this_dude: i cant afford to fail again
[23:36:54] baweaver: It doesn't take a block.
[23:37:22] al2o3-cr: this_dude: why take the test if it's timed, then come in here asking questions?
[23:37:25] this_dude: s.chars.map { |v| (v.rotate(leftShifts)).rotate(rightShifts) }
[23:37:32] this_dude: because if i dont ill def fail
[23:37:33] baweaver: Already said as much above.
[23:37:36] this_dude: im trying to debug it
[23:37:41] this_dude: its not working
[23:37:46] baweaver: Then you don't deserve to pass.
[23:37:58] baweaver: Harsh, but that's how it is.
[23:38:02] this_dude: the test is so i can go to school to be taught this stuff
[23:38:14] mroutis: failing gives you feedback of your practice/study
[23:38:29] this_dude: i wasnt given the resources i need for mapping
[23:38:47] mroutis: wikipedia -> map
[23:38:50] baweaver: Look at the docs for string#chars
[23:39:43] this_dude: its saying undefined method for .rotate
[23:40:22] baweaver: Read. The. Docs. https://ruby-doc.org/core-2.5.1/String.html#method-i-chars
[23:40:29] ByronJohnson: has joined #ruby
[23:41:09] baweaver: https://ruby-doc.org/core-2.5.1/Array.html#method-i-rotate
[23:41:25] this_dude: I dont have time to read it!!!
[23:41:28] this_dude: jesus dude!
[23:41:36] this_dude: i only get one more attempt at this test!!
[23:41:48] baweaver: This channel is not here to help you cheat on applications.
[23:41:59] baweaver: We're already being nice by answering as much as we are.
[23:42:50] this_dude: this channel is here to help me code
[23:42:55] baweaver: and if you keep implying we're here to do so, you'll find yourself on a week-long time out.
[23:42:56] this_dude: thats the whole point
[23:43:00] mroutis: obviously a troll
[23:43:11] this_dude: im not a troll i just need help omg
[23:43:12] baweaver: so choose your next words carefully.
[23:43:22] al2o3-cr: or not listening carefully
[23:43:24] MyMind: has joined #ruby
[23:43:51] al2o3-cr: this_dude: stop panicking
[23:50:04] Creatornator: has joined #ruby
[23:53:51] this_dude: 4 minutes left
[23:53:54] this_dude: and im stuck on #2
[23:55:33] DarthGandalf: has joined #ruby
[23:55:40] galaxie: has joined #ruby
[23:57:00] galaxie: What's the equivalent of Python's (or at least flake8's) NOQA comment, allowing the linter to ignore a certain line for whatever reason?
[23:57:05] mroutis: this_dude, I'm sorry that you couldn't pass the test by your own, but honestly, if you want to improve your coding/ruby skills and getting a job writting code, you don't need a bootcamp neither help from IRC; at least, you'll need to know how to read english, the rest is on the docs, seriously, people have spend tremendously amount of time writing them
[23:57:31] mroutis: galaxie, depending on the linter you are using, I'm asuming rubocop
[23:57:57] galaxie: mroutis: Oh, I forgot to mention that. Yes, RuboCop.
[23:58:08] mroutis: you need to wrap the code in two comments, #rubocop:disable and #rubocop:enable
[23:58:32] galaxie: mroutis: Wait, there's not a simpler way?
[23:58:48] mroutis: https://rubocop.readthedocs.io/en/latest/configuration/#disabling-cops-within-source-code
[23:59:02] mroutis: afaik, no, galaxie, and I think is intended
[23:59:03] this_dude: yeah pretty sure i failed
[23:59:17] this_dude: so now that the test is over can you tell me what i did wrong
[23:59:41] this_dude: I learn by understanding the actual solution..not by someone having an epiphany of what i did wrong
[23:59:56] al2o3-cr: this_dude: it seems that you want to fail.