havenwood changed the topic of #ruby to: Rules & more: https://ruby-community.com | Ruby 2.6.5, 2.5.7, 2.7.0-preview3: https://www.ruby-lang.org | Paste 4+ lines of text to https://dpaste.de/ and select Ruby as the language | Rails questions? Ask in #RubyOnRails | Books: https://goo.gl/wpGhoQ | Logs: https://irclog.whitequark.org/ruby | Can't talk? Register/identify with Nickserv first!
mokha has joined #ruby
CalimeroTeknik has joined #ruby
wallace__ has quit [Remote host closed the connection]
oncall-pokemon has quit [Quit: Connection closed for inactivity]
fig-le-deunch has joined #ruby
<adam12> Anybody using hanami-controller / hanami-router outside of a Hanami project?
davidw has quit [Ping timeout: 265 seconds]
dviola has quit [Quit: WeeChat 2.7]
stryek has quit [Quit: Connection closed for inactivity]
wallace_mu has joined #ruby
jenrzzz has joined #ruby
akemhp_ has joined #ruby
akemhp has quit [Ping timeout: 265 seconds]
davidw has joined #ruby
jenrzzz has quit [Ping timeout: 268 seconds]
drincruz has joined #ruby
wallace_mu has quit [Remote host closed the connection]
wallace_mu has joined #ruby
davidw has quit [Ping timeout: 265 seconds]
wallace_mu has quit [Read error: Connection reset by peer]
wallace_mu has joined #ruby
fphilipe has joined #ruby
chalkmonster has joined #ruby
sergioro has quit [Quit: leaving]
drincruz has quit [Ping timeout: 276 seconds]
fphilipe has quit [Ping timeout: 250 seconds]
ElFerna has joined #ruby
ElFerna has quit [Quit: ElFerna]
ElFerna has joined #ruby
Fernando-Basso has quit [Quit: Leaving]
ogres has joined #ruby
ElFerna has quit [Client Quit]
wallace_mu has quit [Remote host closed the connection]
davidw has joined #ruby
davidw has quit [Changing host]
davidw has joined #ruby
fig-le-deunch has quit [Quit: Konversation terminated!]
jenrzzz has joined #ruby
fig-le-deunch has joined #ruby
wallace_mu has joined #ruby
drincruz has joined #ruby
akemhp_ has quit [Ping timeout: 240 seconds]
fig-le-deunch has quit [Ping timeout: 268 seconds]
mokha has quit [Quit: .]
akemhp has joined #ruby
akemhp has quit [Remote host closed the connection]
davidw has quit [Ping timeout: 265 seconds]
akemhp has joined #ruby
wildtrees has quit [Quit: Leaving]
cthulchu has quit [Ping timeout: 268 seconds]
kapil_ has quit [Quit: Connection closed for inactivity]
sarink has joined #ruby
lucasb has quit [Quit: Connection closed for inactivity]
sarink has quit [Ping timeout: 250 seconds]
william1 has quit [Ping timeout: 265 seconds]
iMadper|` has quit [Remote host closed the connection]
drnerdius has joined #ruby
gix has quit [Ping timeout: 240 seconds]
<drnerdius> Is there a way to get an inner product of an array to produce all the combinations? The syntax is array1.product(array2, array3, ...), but what about an array of arrays? I can hack a little bit and do this: array[0].product(array[1..-1]), but there has to be a cleaner way.
<drnerdius> sorry, missed the asterisk; it's actually: array[0].product(*array[1..-1])
<drnerdius> I also tried this: [].product(*array), but it returns an empty array...
TCZ has quit [Quit: Bye Bye]
RyanMcCoskrie has joined #ruby
fig-le-deunch has joined #ruby
<havenwood> drnerdius: One way is: array.reduce(&:product).map(&:flatten)
<drnerdius> Thanks havenwood. I found another: Array:product.to_proc.(*array) :)
<havenwood> drnerdius: Hmm, there are other ways. Lemme think..
<havenwood> drnerdius: array.then { |head, *tail| head.product *tail }
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
davispuh has quit [Quit: http://quassel-irc.org - Chat comfortably. Anywhere.]
<drnerdius> Thanks again. Array:product.to_proc.(*array) looks cleaner to me... well, unless, it's a bad practice or something. Is it?
<drnerdius> For me, performance is the most important factor, though
wallace_mu has quit [Remote host closed the connection]
<drnerdius> havenwood
<leftylink> whoa does it work
<leftylink> the single colon
<leftylink> &>> Array:product
<rubydoc> # => [:product] (https://carc.in/#/r/8741)
<havenwood> &>> require 'ripper'; Ripper.lex 'Array:product.to_proc.call(*array)'
<rubydoc> # => [[[1, 0], :on_const, "Array", #<Ripper::Lexer::State: EXPR_CMDARG>], [[1, 5], :on_symbeg, ":",... check link for more (https://carc.in/#/r/8742)
<leftylink> sorry I am a little not right in the head right now
<drnerdius> &>> :product
<rubydoc> # => :product (https://carc.in/#/r/8743)
<drnerdius> this also works
<al2o3-cr> arr.transpose.product(arr.transpose)
<leftylink> ,my password is 19980819
<leftylink> pls don't steal accts
<al2o3-cr> don't know if it's faster you'd have to benchmark.
<havenwood> al2o3-cr: nice, but i think that needs a flatten: arr.transpose.product(arr.transpose).flatten(1)
<al2o3-cr> havenwood: it works without flatten
<leftylink> I can est don't have to take others word for it
<leftylink> &>> a=[1,2,3]; Array:product.to_proc.call(*a)
<rubydoc> stderr: -e:4:in `<main>': undefined method `product' for 1:Integer (NoMethodError)... check link for more (https://carc.in/#/r/8744)
<havenwood> &>> arr = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]; arr.transpose.product(arr.transpose)
<rubydoc> # => [[[1, 4, 7], [1, 4, 7]], [[1, 4, 7], [2, 5, 8]], [[1, 4, 7], [3, 6, 9]], [[2, 5, 8], [1, 4, 7]], [[2, 5,... check link for more (https://carc.in/#/r/8745)
_phaul has quit [Ping timeout: 276 seconds]
<leftylink> noooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
<al2o3-cr> havenwood: yep, you're right lol.
RyanMcCoskrie has quit [Remote host closed the connection]
howdoi has quit [Quit: Connection closed for inactivity]
<drnerdius> leftylink, your code is correct; it should be a 2D array, lol.
<drnerdius> &>> a=http://en.wikipedia.org/wiki/Special:Search?go=Go&search=1,2],[3,4],[5,6; Array:product.to_proc.call(*a)
<leftylink> I am sorry
<drnerdius> what's with the wikipedia link now? haha
<drnerdius> oh, double left bracket, maybe
<drnerdius> &>> a=[ [1,2],[3,4],[5,6] ]; Array:product.to_proc.call(*a)
<drnerdius> &>> a=[ [1,2],[3,4],[5,6] ]; Array:product.to_proc.call(*a)
<rubydoc> # => [[1, 3, 5], [1, 3, 6], [1, 4, 5], [1, 4, 6], [2, 3, 5], [2, 3, 6], [2, 4, 5], [2, 4, 6]] (https://carc.in/#/r/8746)
<drnerdius> &>> arr = [ [1,2], [3,4], [5,6] ]; arr.transpose.product(arr.transpose)
<rubydoc> # => [[[1, 3, 5], [1, 3, 5]], [[1, 3, 5], [2, 4, 6]], [[2, 4, 6], [1, 3, 5]], [[2, 4, 6], [2, 4, 6]]] (https://carc.in/#/r/8747)
<havenwood> drnerdius: array.first.product(array[1..])
<leftylink> I am sorry I think I do not understand
<leftylink> wh is the Array there
<leftylink> why not
<leftylink> &>> :product.to_proc.call(*[[1, 2, 3], [4, 5, 6]])
<rubydoc> # => [[1, 4], [1, 5], [1, 6], [2, 4], [2, 5], [2, 6], [3, 4], [3, 5], [3, 6]] (https://carc.in/#/r/8748)
<leftylink> maybe I misunderstand
<leftylink> it's already an array who do I smkae it more an array
<leftylink> I'm so fucked up right now
<drnerdius> that also works, yes
<leftylink> I;m 23
<leftylink> I'm a.... puzzle? I don't even understand what is even that lyric
<leftylink> pk better go
<leftylink> bye
<drnerdius> i'm one year older
sameerynho has quit [Ping timeout: 240 seconds]
<drnerdius> havenwood: I think this one produces 3D array: arr.transpose.product(arr.transpose)
<drnerdius> there are extra brackets
fphilipe has joined #ruby
fig-le-deunch has quit [Ping timeout: 268 seconds]
jenrzzz has quit [Ping timeout: 250 seconds]
<drnerdius> anyway, thanks everyone
_phaul has joined #ruby
<havenwood> drnerdius: the explicit first, *rest is the fastest
<havenwood> fwiw
fphilipe has quit [Ping timeout: 276 seconds]
<havenwood> drnerdius: jruby also takes the cake
<havenwood> just under 4M iterations/sec
_phaul has quit [Ping timeout: 265 seconds]
Benett- has joined #ruby
<havenwood> drnerdius: Just: :product.to_proc.call(*array)
<havenwood> (for the proc version)
NODE has quit [Ping timeout: 240 seconds]
Benett has quit [Ping timeout: 264 seconds]
Benett- is now known as Benett
_phaul has joined #ruby
<drnerdius> havenwood: yeah. Thanks a lot. Interesting. I always assumed using [0] was preferable to .first.
sarink has joined #ruby
NODE has joined #ruby
sarink has quit [Remote host closed the connection]
NODE has quit [Client Quit]
_phaul has quit [Ping timeout: 246 seconds]
blobsson has joined #ruby
NODE has joined #ruby
NODE has quit [Client Quit]
NODE has joined #ruby
_phaul has joined #ruby
NODE has quit [Client Quit]
NODE has joined #ruby
_phaul has quit [Ping timeout: 268 seconds]
ogres has quit [Quit: Connection closed for inactivity]
_phaul has joined #ruby
fig-le-deunch has joined #ruby
blobsson has quit [Read error: Connection reset by peer]
ivanskie has joined #ruby
_phaul has quit [Ping timeout: 268 seconds]
jenrzzz has joined #ruby
drnerdius has quit [Quit: Konversation terminated!]
_phaul has joined #ruby
_phaul has quit [Ping timeout: 250 seconds]
<adam12> Argh, I wish Zeitwerk didn't require a dummy folder before it starts to build the namespace constant.
akemhp_ has joined #ruby
mynameisbrian has joined #ruby
_phaul has joined #ruby
akemhp has quit [Read error: Connection reset by peer]
Milos has quit [Quit: ZNC 1.7.5 - https://znc.in]
akem__ has joined #ruby
_phaul has quit [Ping timeout: 250 seconds]
akemhp_ has quit [Ping timeout: 276 seconds]
rcvu has quit [Quit: leaving]
rcvu has joined #ruby
Fr4n has quit [Ping timeout: 265 seconds]
_phaul has joined #ruby
NODE has quit [Quit: changing servers]
reaVer has quit [Remote host closed the connection]
romanblanco has quit [Read error: Connection reset by peer]
NODE has joined #ruby
kapil_ has joined #ruby
_phaul has quit [Ping timeout: 265 seconds]
yann-kaelig has quit [Quit: yann-kaelig]
_phaul has joined #ruby
drincruz has quit [Ping timeout: 276 seconds]
NODE has quit [Read error: Connection reset by peer]
jenrzzz has quit [Ping timeout: 268 seconds]
_phaul has quit [Ping timeout: 252 seconds]
Guest22869 has joined #ruby
akemhp has joined #ruby
Guest22869 has quit [Client Quit]
NODE has joined #ruby
_phaul has joined #ruby
akem__ has quit [Ping timeout: 240 seconds]
howdoi has joined #ruby
_phaul has quit [Ping timeout: 276 seconds]
ritalinona has joined #ruby
ritalinona has quit [Changing host]
ritalinona has joined #ruby
_phaul has joined #ruby
Code_[24]_ has joined #ruby
_phaul has quit [Ping timeout: 265 seconds]
_phaul has joined #ruby
jenrzzz has joined #ruby
reaVer has joined #ruby
_phaul has quit [Ping timeout: 265 seconds]
Esa_ has quit [Read error: Connection reset by peer]
fig-le-deunch has quit [Quit: Konversation terminated!]
Esa_ has joined #ruby
_phaul has joined #ruby
_phaul has quit [Ping timeout: 276 seconds]
_phaul has joined #ruby
mynameisbrian has quit [Quit: Leaving]
Esa_ has quit [Ping timeout: 240 seconds]
_phaul has quit [Ping timeout: 276 seconds]
bitwinery has quit [Ping timeout: 265 seconds]
_phaul has joined #ruby
_phaul has quit [Ping timeout: 268 seconds]
bitwinery has joined #ruby
_phaul has joined #ruby
fphilipe has joined #ruby
_phaul has quit [Ping timeout: 240 seconds]
fphilipe has quit [Ping timeout: 252 seconds]
bitwinery has quit [Read error: Connection reset by peer]
_phaul has joined #ruby
_phaul has quit [Ping timeout: 268 seconds]
donofrio has quit [Remote host closed the connection]
_phaul has joined #ruby
sergioro has joined #ruby
_phaul has quit [Ping timeout: 276 seconds]
_phaul has joined #ruby
bvdw has quit [Read error: Connection reset by peer]
bvdw has joined #ruby
rippa has joined #ruby
_phaul has quit [Ping timeout: 276 seconds]
_phaul has joined #ruby
Thyla has joined #ruby
_phaul has quit [Ping timeout: 245 seconds]
jenrzzz has quit [Ping timeout: 240 seconds]
ritalinona has quit [Quit: Leaving]
_phaul has joined #ruby
wallace_mu has joined #ruby
_phaul has quit [Ping timeout: 265 seconds]
xall has joined #ruby
_phaul has joined #ruby
<xall> is there a more idiomatic way to lift an array (correct terminology?) or do you have to do `arr.map { |e| [e] }`?
wallace_mu has quit [Ping timeout: 265 seconds]
<Rudolph> can you show an example array and the desired resulting array?
<xall> Rudolph: sure
<xall> [["V", "R"], ["C", "V"], ["R", "G"]] => [[["V", "R"]], [["C", "V"]], [["R", "G"]]]
<Rudolph> oh, so just array-ize (definitely not correct terminology :) ) each element? yeah your way should work fine
<Rudolph> IE im not sure of a better way for it
<xall> i'm fairly iffy on FP terminology but i thought lifting was wrapping something in this manner
<xall> what is lifting then?
_phaul has quit [Ping timeout: 276 seconds]
<Rudolph> no clue, i don't do much fp
<Rudolph> lifting could be the right term
<Rudolph> (i meant my word was not correct terminology, fwiw)
<xall> i see. thanks Rudolph
<Rudolph> sure thing
_phaul has joined #ruby
Milos has joined #ruby
_phaul has quit [Ping timeout: 265 seconds]
_phaul has joined #ruby
<xall> `str.join.chars.map(&HASH)` what's going on here? you can map an array to a hash. what's with & syntax? i'm not sure what to search for
<Rudolph> it makes it a block iirc
<havenwood> xall: The & there does two things, it calls #to_proc on HASH and it passes the result as a block rather than a standard paramater
<xall> so you can pass Array#map a block thats a hash?
<xall> havenwood: thanks
<havenwood> &>> HASH = {aim: true}.freeze; [:aim, :nope].map(&HASH)
<rubydoc> # => [true, nil] (https://carc.in/#/r/874e)
_phaul has quit [Ping timeout: 276 seconds]
<xall> so turning a hash into a proc makes it callable with keys
<havenwood> &>> HASH = {aim: true}.freeze; HASH.to_proc.call(:aim)
<rubydoc> # => true (https://carc.in/#/r/874f)
<havenwood> xall: Yes, exactly.
<havenwood> xall: Not actually suggesting doing this, but fun:
<havenwood> &>> [["V", "R"], ["C", "V"], ["R", "G"]].map(&:then).map(&:to_a)
<rubydoc> # => [[["V", "R"]], [["C", "V"]], [["R", "G"]]] (https://carc.in/#/r/874g)
<xall> neat
<havenwood> &>> :then.to_proc
<rubydoc> # => #<Proc:0x0000562eff19b840(&:then)> (https://carc.in/#/r/874h)
<havenwood> &>> :then.class
<rubydoc> # => Symbol (https://carc.in/#/r/874i)
<xall> #then must be newer than my current Ruby
<havenwood> xall: Does it have #yield_self
<havenwood> xall: (aliases)
<havenwood> &>> [["V", "R"], ["C", "V"], ["R", "G"]].map(&:yield_self).map(&:to_a)
<rubydoc> # => [[["V", "R"]], [["C", "V"]], [["R", "G"]]] (https://carc.in/#/r/874j)
<xall> havenwood: yeah
<havenwood> &>> 42.yield_self.size
<rubydoc> # => 1 (https://carc.in/#/r/874k)
<havenwood> &>> 42.yield_self.class
<rubydoc> # => Enumerator (https://carc.in/#/r/874l)
<xall> is there a way to chain into zip without using temp vars here? L1 `fst, snd = str.split.map(&:chars)`, L2 `fst.zip(snd).each_slice(2).map { |e| e.join.chars.map(&HASH) }`
howdoi has quit [Quit: Connection closed for inactivity]
_phaul has joined #ruby
<havenwood> xall: reduce(&:zip)
<havenwood> xall: str.split.map(&:chars).reduce(&:zip).each_slice(2).map(&:join).map(&:chars).map(&HASH)
jenrzzz has joined #ruby
_phaul has quit [Ping timeout: 240 seconds]
<havenwood> xall: Or fewer iterations. Sometimes the quicker parsing of the shorthand actually saves more time than the loops. Depends.
<havenwood> xall: The #chars step doesn't quite seem right?
<havenwood> The second one.
<havenwood> oh, nvm
<havenwood> xall: str.split.map(&:chars).reduce(&:zip).each_slice(2).map(&:join).map(&:chars).map { |a| a.map(&HASH) }
<xall> havenwood: something wrong with the last map to hash there: https://i.imgur.com/RjKAv6w.png
_phaul has joined #ruby
<xall> yeah, you got it
Code_[24]_ has quit [Quit: Connection closed for inactivity]
howdoi has joined #ruby
<havenwood> :)
<havenwood> xall: I think I got the name `chars` wrong? Anyways, I just mean the idea.
_phaul has quit [Ping timeout: 276 seconds]
<havenwood> lemme try actually running this >.>
<xall> havenwood: yeah that looks good. much better than my original solution: https://dpaste.org/DDyx#
<havenwood> xall: nice
_phaul has joined #ruby
<havenwood> xall: I'd suggest moving your CUPS_PER_ROW and PLANTS constants inside your class. It's nice to namespace them rather than have them be global.
<havenwood> xall: Consider using keyword arguments beyond the first, obvious positional argument. So maybe: def initialize(diagram, students: STUDENTS)
_phaul has quit [Ping timeout: 245 seconds]
<havenwood> xall: Your @plants instance variable is unused, so you might consider not setting it.
<havenwood> xall: You could just drop: @plants ||=
<havenwood> (still works)
<havenwood> xall: I like the use of #fetch.
<havenwood> xall: Maybe #downcase STUDENTS when you create the constant, rather than in the method.
<havenwood> xall: STUDENTS = [...].map(&:downcase).freeze
<havenwood> xall: nifty class—congrats on the code
_phaul has joined #ruby
<xall> havenwood: thanks for the useful feedback. My STUDENTS constant is an array of symbols but the given test cases pass in an array of strings - I don't think calling downcase on symbols is going to do anything, eh?
<xall> er, the tests optionally pass in strings
_phaul has quit [Ping timeout: 276 seconds]
fphilipe has joined #ruby
_phaul has joined #ruby
akemhp_ has joined #ruby
akemhp has quit [Ping timeout: 240 seconds]
fphilipe has quit [Ping timeout: 276 seconds]
sauvin has joined #ruby
_phaul has quit [Ping timeout: 265 seconds]
Thyla has quit [Quit: Leaving]
_phaul has joined #ruby
<havenwood> &>> :XALL.downcase
<rubydoc> # => :xall (https://carc.in/#/r/874m)
<havenwood> xall: Symbol does respond to #downcase, but if they're already lower, no need.
_phaul has quit [Ping timeout: 276 seconds]
<xall> havenwood: Roger. I think I'd typically put the constants in the class. Not sure if I was hit with comic ray bombardment or just too much javascript lately.
<xall> and probably better to get the KeyError with fetch than use the fancy hash to_proc, eh
<havenwood> xall: Yeah, nice to avoid nils.
duderonomy has joined #ruby
<havenwood> xall: maybe do a #tr at a string stage?
<havenwood> &>> 'xall'.tr('xl', 'lx')
<rubydoc> # => "laxx" (https://carc.in/#/r/874n)
_phaul has joined #ruby
<xall> havenwood: use #tr to replace rather than a Hash?
<havenwood> xall: yeah
<xall> havenwood: hmm. can you use regex groups to have concise mappings or something? Or do you have to call it for each translation?
_phaul has quit [Ping timeout: 268 seconds]
_phaul has joined #ruby
<baweaver> Rudolph: Where'd you read about lifting?
<baweaver> It's not really wrapping per-se like you're thinking there
<baweaver> Where are you on Functors, Applicatives, and Monoids?
<baweaver> xall *
<baweaver> Misread who said what, don't mind me
<baweaver> An array is already technically "wrapped"
<havenwood> xall: Updated the gist to show the parallel more clearly.
<baweaver> If you give me about a month I'm already planning to write about all of this in Ruby
<baweaver> but I can give the short version depending on where you're at
<baweaver> _phaul: We're learning Category Theory :D
<baweaver> Oh yes. Someone got me started.
<xall> baweaver: I've read a few functional javascript books and almost finished Learn You a Haskell. An Array is a functor, right?
<baweaver> havenwood: join our merriment!
_phaul has quit [Ping timeout: 240 seconds]
<havenwood> baweaver: Always happy to play with variants of such things in Ruby!
<xall> or a monad. the terminology hasn't seeped in yet
<xall> havenwood: i think i see what you're saying. i think i didn't quite grok #tr
<havenwood> xall: it replaces positionally
<havenwood> baweaver: It's too weird, but fun to play with #then: https://gist.github.com/havenwood/b0c6bdd59be549a6bb701b575480e55b
<havenwood> It embraces like half of what i think a monad is
<havenwood> baweaver: We should implement more proper monads—composable and wrappery.
<havenwood> Bring *a* concept forward, or the whole lot?
<havenwood> xall: Whenever I have that "what's a functor again?" feeling, I reference these pics: http://adit.io/posts/2013-04-17-functors,_applicatives,_and_monads_in_pictures.html
jenrzzz has quit [Ping timeout: 250 seconds]
ivanskie has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
_phaul has joined #ruby
_phaul has quit [Ping timeout: 250 seconds]
<xall> havenwood: nice, thank you. i usually feel like i've seen enough memes in my life but that oreilly one is A+
<baweaver> An array is technically a lot of different things
sarink has joined #ruby
_phaul has joined #ruby
justache has left #ruby [#ruby]
sarink has quit [Ping timeout: 240 seconds]
<xall> sounds like religion
_phaul has quit [Ping timeout: 276 seconds]
<xall> mystical arrays
_phaul has joined #ruby
_phaul has quit [Ping timeout: 268 seconds]
moonshine_ has joined #ruby
_phaul has joined #ruby
_phaul has quit [Ping timeout: 265 seconds]
houhoulis has quit [Remote host closed the connection]
_phaul has joined #ruby
johnny56_ has quit [Ping timeout: 240 seconds]
Swyper has quit [Remote host closed the connection]
johnny56_ has joined #ruby
_phaul has quit [Ping timeout: 265 seconds]
ivanskie has joined #ruby
_phaul has joined #ruby
_phaul has quit [Ping timeout: 265 seconds]
DTZUZO has quit [Ping timeout: 252 seconds]
_phaul has joined #ruby
ivanskie has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
_phaul has quit [Ping timeout: 276 seconds]
moonshine_ has quit [Quit: Leaving]
_phaul has joined #ruby
_phaul has quit [Ping timeout: 240 seconds]
howdoi has quit [Quit: Connection closed for inactivity]
jenrzzz has joined #ruby
_phaul has joined #ruby
fphilipe has joined #ruby
jenrzzz has quit [Ping timeout: 265 seconds]
_phaul has quit [Ping timeout: 276 seconds]
crella133 has joined #ruby
fphilipe has quit [Ping timeout: 276 seconds]
_phaul has joined #ruby
crella133 has quit [Remote host closed the connection]
crella133 has joined #ruby
<crella133> &>> 100.times { 3==5}
<rubydoc> # => 100 (https://carc.in/#/r/874s)
_phaul has quit [Ping timeout: 276 seconds]
_phaul has joined #ruby
Nicmavr has quit [Read error: Connection reset by peer]
jenrzzz has joined #ruby
Nicmavr has joined #ruby
jcalla has quit [Ping timeout: 252 seconds]
<crella133> Hi, what object's id is 2 in ruby? Curious in it.
_phaul has quit [Ping timeout: 265 seconds]
crella133 has quit [Quit: crella133]
_phaul has joined #ruby
_phaul has quit [Ping timeout: 240 seconds]
_phaul has joined #ruby
xall has quit [Ping timeout: 268 seconds]
_phaul has quit [Ping timeout: 276 seconds]
_phaul has joined #ruby
dasher00 has joined #ruby
_phaul has quit [Ping timeout: 252 seconds]
xall has joined #ruby
_phaul has joined #ruby
dionysus69 has joined #ruby
_phaul has quit [Ping timeout: 265 seconds]
_phaul has joined #ruby
SCHAPiE has quit [Quit: ZNC - https://znc.in]
dionysus69 has quit [Ping timeout: 240 seconds]
_phaul has quit [Ping timeout: 265 seconds]
SCHAPiE has joined #ruby
_phaul has joined #ruby
_phaul has quit [Ping timeout: 265 seconds]
Tikku has joined #ruby
schne1der has joined #ruby
_phaul has joined #ruby
_phaul has quit [Ping timeout: 265 seconds]
Tikku has quit [Quit: Leaving]
schne1der has quit [Ping timeout: 240 seconds]
dionysus69 has joined #ruby
_phaul has joined #ruby
femtogram has joined #ruby
_phaul has quit [Ping timeout: 268 seconds]
<femtogram> hey guys, so i want to use slim for some templating of a bunch of xml files using the command line, so i'm trying to use slimrb. i'm new to slim, and i'm trying to use partials. do i need to define an include header? is this even the right tool to be using? i was drawn to ruby because of the ease of calling bash commands (using backticks), and slim because of how clean the syntax is but is there a tool that is better suited to what i'm
<femtogram> trying to do (use as a commandline utility instead of as part of a webapp)
xall has quit [Read error: Connection reset by peer]
dionysus69 has quit [Ping timeout: 276 seconds]
_phaul has joined #ruby
_phaul has quit [Ping timeout: 250 seconds]
_phaul has joined #ruby
romanblanco has joined #ruby
reber has joined #ruby
_phaul has quit [Ping timeout: 240 seconds]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
_phaul has joined #ruby
dionysus69 has joined #ruby
fphilipe has joined #ruby
_phaul has quit [Ping timeout: 240 seconds]
_phaul has joined #ruby
dionysus69 has quit [Ping timeout: 265 seconds]
hiroaki has quit [Ping timeout: 276 seconds]
_phaul has quit [Ping timeout: 250 seconds]
suukim has joined #ruby
_phaul has joined #ruby
dionysus69 has joined #ruby
_phaul has quit [Ping timeout: 265 seconds]
_phaul has joined #ruby
_phaul has quit [Ping timeout: 240 seconds]
Fernando-Basso has joined #ruby
JJonah_ has quit [Quit: Connection closed for inactivity]
_phaul has joined #ruby
fphilipe has quit [Ping timeout: 276 seconds]
_phaul has quit [Ping timeout: 240 seconds]
sameerynho has joined #ruby
_phaul has joined #ruby
nowhereman has joined #ruby
bvdw has quit [Read error: Connection reset by peer]
_phaul has quit [Ping timeout: 265 seconds]
bvdw has joined #ruby
_phaul has joined #ruby
_phaul has quit [Ping timeout: 245 seconds]
_phaul has joined #ruby
zapata has quit [Ping timeout: 250 seconds]
_phaul has quit [Ping timeout: 265 seconds]
TCZ has joined #ruby
sergioro has left #ruby [#ruby]
_phaul has joined #ruby
_phaul has quit [Ping timeout: 245 seconds]
_phaul has joined #ruby
lbrandon has joined #ruby
_phaul has quit [Ping timeout: 265 seconds]
sarink has joined #ruby
_phaul has joined #ruby
sarink has quit [Ping timeout: 265 seconds]
_phaul has quit [Ping timeout: 240 seconds]
akemhp has joined #ruby
akemhp_ has quit [Read error: Connection reset by peer]
_phaul has joined #ruby
_phaul has quit [Ping timeout: 246 seconds]
akemhp has quit [Ping timeout: 240 seconds]
jenrzzz has quit [Ping timeout: 240 seconds]
_phaul has joined #ruby
NODE has quit [Quit: changing servers]
NODE has joined #ruby
NODE has quit [Client Quit]
_phaul has quit [Ping timeout: 268 seconds]
NODE has joined #ruby
NODE has left #ruby [#ruby]
reber_ has joined #ruby
NODE has joined #ruby
NODE has quit [Client Quit]
reber has quit [Ping timeout: 240 seconds]
_phaul has joined #ruby
NODE has joined #ruby
_phaul has quit [Ping timeout: 276 seconds]
_phaul has joined #ruby
NODE has quit [Quit: changing servers]
gearnode1 has joined #ruby
schne1der has joined #ruby
gearnode has quit [Ping timeout: 252 seconds]
femtogram has quit [Remote host closed the connection]
_phaul has quit [Ping timeout: 240 seconds]
NODE has joined #ruby
NODE has quit [Client Quit]
NODE has joined #ruby
NODE has quit [Client Quit]
_phaul has joined #ruby
william1 has joined #ruby
dionysus69 has quit [Ping timeout: 252 seconds]
NODE has joined #ruby
romanblanco has quit [Ping timeout: 246 seconds]
NODE has quit [Client Quit]
NODE has joined #ruby
davispuh has joined #ruby
jinie has quit [Quit: ZNC 1.6.1 - http://znc.in]
reber_ is now known as reber
fphilipe has joined #ruby
fphilipe has quit [Ping timeout: 276 seconds]
flughafen has quit [Ping timeout: 268 seconds]
drincruz has joined #ruby
yann-kaelig has joined #ruby
NODE has quit []
Benett has quit [Quit:  ]
Benett has joined #ruby
fphilipe has joined #ruby
NODE has joined #ruby
NODE has quit [Client Quit]
NODE has joined #ruby
fphilipe has quit [Ping timeout: 252 seconds]
flughafen has joined #ruby
NODE has quit [Client Quit]
romanblanco has joined #ruby
NODE has joined #ruby
reber_ has joined #ruby
drincruz has quit [Ping timeout: 250 seconds]
NODE has quit [Client Quit]
reber has quit [Ping timeout: 240 seconds]
NODE has joined #ruby
NODE has quit [Client Quit]
NODE has joined #ruby
NODE has quit [Client Quit]
NODE has joined #ruby
phaul has joined #ruby
_phaul has quit [Ping timeout: 252 seconds]
phaul has quit [Ping timeout: 265 seconds]
zapata has joined #ruby
phaul has joined #ruby
lucasb has joined #ruby
NODE has quit []
phaul has quit [Ping timeout: 240 seconds]
Benett has quit [Remote host closed the connection]
Benett has joined #ruby
jacksoow_ has quit [Ping timeout: 250 seconds]
phaul has joined #ruby
phaul has quit [Ping timeout: 246 seconds]
jacksoow has joined #ruby
phaul has joined #ruby
NODE has joined #ruby
phaul has quit [Ping timeout: 265 seconds]
phaul has joined #ruby
woodruffw has quit [Ping timeout: 268 seconds]
woodruffw has joined #ruby
woodruffw has quit [Changing host]
woodruffw has joined #ruby
reber has joined #ruby
gix has joined #ruby
reber_ has quit [Ping timeout: 268 seconds]
phaul has quit [Ping timeout: 250 seconds]
galaxie has quit [Read error: Connection reset by peer]
iNs has quit [Read error: Connection reset by peer]
al2o3-cr has quit [Write error: Broken pipe]
lineus has quit [Remote host closed the connection]
lineus has joined #ruby
al2o3-cr has joined #ruby
iNs has joined #ruby
galaxie has joined #ruby
romanblanco has quit [Ping timeout: 240 seconds]
phaul has joined #ruby
phaul has quit [Ping timeout: 276 seconds]
TCZ has quit [Quit: Bye Bye]
phaul has joined #ruby
phaul has quit [Ping timeout: 265 seconds]
phaul has joined #ruby
Abhijit has joined #ruby
<Abhijit> Hi. can i pass gets.to_i or variations of gets as function argument and then execute it in that function? how?
phaul has quit [Ping timeout: 252 seconds]
phaul has joined #ruby
howdoi has joined #ruby
phaul has quit [Ping timeout: 276 seconds]
<Abhijit> havenwood, i mean dynamically. you are hardcoding .to_i
<havenwood> Abhijit: Dynamically doing what? Knowing that the #gets return value is an integer?
<Abhijit> right now i am keeping gets as it is and using .send() and passing 'to_i' 'to_s' etc as argument. but can i directly pass the whole gets.to_i and run it?
<havenwood> Abhijit: I don't understand what you mean?
<havenwood> Abhijit: Show the code you have?
woodruffw has quit [Ping timeout: 265 seconds]
phaul has joined #ruby
<havenwood> Abhijit: What's the dynamic part and what does it depend onn?
woodruffw has joined #ruby
woodruffw has joined #ruby
woodruffw has quit [Changing host]
stimpy_ has joined #ruby
stimpy__ has joined #ruby
<Abhijit> havenwood, different functions can pass their choice of gets variation to my_ui. can they cass gets.to_i as one example?
<Abhijit> pass*
william1 has quit [Ping timeout: 250 seconds]
DaRock has quit [Remote host closed the connection]
DaRock has joined #ruby
<stimpy__> how do i calculate the time left with a timestamp
<havenwood> Abhijit: So what you have works but you want to cover the `input_type` is `nil` case?
<havenwood> stimpy__: Time left to do what?
<stimpy__> @havenwood lets say i want to implement a feature that blocks a user and after 24 hours the user is unblocked, how do i get the distance between the blocked_at timestamp and the end_time(blocked_at + 24 hours) timestamp
<stimpy__> i cant get it to work, i think its a thought issue
<Abhijit> havenwood, no. in current code we need to pass 'to_i' as argument for input_type. instead of that i want to rename input_type to run_this_method_to_get_input and pass 'gets.to_i' as argument!
<Abhijit> e.g. my_ui('get me input', 'gets.to_i')
<stimpy__> to get the distance it should be (end_time - Time.now)
<Abhijit> can I do that?
<havenwood> stimpy__: The problem with Time.now is it can change between the measurements since it's not monotonic.
<havenwood> stimpy__: Think like daylight savings time, etc.
<stimpy__> @havenwood, then im thinking wrong on the calculation?
<havenwood> stimpy__: Milliseconds, for example: Process.clock_gettime(Process::CLOCK_MONOTONIC, :millisecond)
<havenwood> &>> Process.clock_gettime(Process::CLOCK_MONOTONIC, :nanosecond)
<rubydoc> # => 188613322828740 (https://carc.in/#/r/875n)
<havenwood> stimpy__: ^ Measuring like that will be solid, without the possible time shifts you get with Time.now.
Esa_ has joined #ruby
<havenwood> &>> Process.clock_gettime(Process::CLOCK_MONOTONIC, :nanosecond) - Process.clock_gettime(Process::CLOCK_MONOTONIC, :nanosecond)
<rubydoc> # => -1603 (https://carc.in/#/r/875p)
<havenwood> stimpy__: But yes, `earlier - later`.
<havenwood> stimpy__: I'd just suggest using monotonic time.
<stimpy__> @havenwood, thanks for the input!
NODE has quit [Quit: changing servers]
Inline has quit [Quit: Leaving]
phaul has quit [Ping timeout: 268 seconds]
NODE has joined #ruby
<leftylink> Abhijit: perhaps if the caller were required to pass it as a block, my_ui can yield to the block. or if the caller were required to pass it as a lambda, my_ui can call the lambda
sarink has joined #ruby
rkoller has joined #ruby
Mia has quit [Ping timeout: 240 seconds]
DTZUZO has joined #ruby
<havenwood> Abhijit: FWIW: 'gets.to_i'.split('.').reduce($stdin) { |acc, meth| acc.public_send meth }
sarink has quit [Ping timeout: 240 seconds]
<havenwood> Abhijit: Is this along the lines of what you were thinking? https://gist.github.com/havenwood/d68f4235b38abbcd6dbb725a36a271f9
dviola has joined #ruby
fphilipe has joined #ruby
Mia has joined #ruby
Mia has joined #ruby
Mia has quit [Changing host]
phaul has joined #ruby
fphilipe has quit [Ping timeout: 250 seconds]
<havenwood> Abhijit: Note, a user would be able to run arbitrary, malicious commands with that, just like evaling.
phaul has quit [Ping timeout: 252 seconds]
<havenwood> Abhijit: eval 'gets.to_i'
<havenwood> Abhijit: If you want to expose user input, consider a safe list.
phaul has joined #ruby
<havenwood> updated
phaul has quit [Ping timeout: 252 seconds]
skyikot has joined #ruby
sarink has joined #ruby
blobsson has joined #ruby
Inline has joined #ruby
william1 has joined #ruby
phaul has joined #ruby
sarink has quit [Ping timeout: 265 seconds]
NODE has quit [Quit: changing servers]
phaul has quit [Ping timeout: 240 seconds]
Inline has quit [Quit: Leaving]
<Abhijit> leftylink, ok. will check with block and lambda.
<Abhijit> havenwood, yes something like that but without hardcoding line = getss on line numbber 11
<Abhijit> havenwood, ok nevermind actually thats very much what i wanted.
<Abhijit> havenwood, leftylink Thanks.
<Abhijit> havenwood, yes will try to get safe list
Mia has quit [Ping timeout: 250 seconds]
phaul has joined #ruby
Fernando-Basso has quit [Remote host closed the connection]
NODE has joined #ruby
NODE has quit [Client Quit]
william1 has quit [Quit: WeeChat 1.9.1]
william1 has joined #ruby
NODE has joined #ruby
phaul has quit [Ping timeout: 240 seconds]
Swyper has joined #ruby
phaul has joined #ruby
DaRock has quit [Ping timeout: 268 seconds]
Abhijit has quit [Ping timeout: 240 seconds]
jenrzzz has joined #ruby
william1 has quit [Ping timeout: 240 seconds]
Inline has joined #ruby
jenrzzz has quit [Ping timeout: 268 seconds]
buckworst has joined #ruby
stimpy_ has quit [Quit: Leaving]
stimpy__ has quit [Quit: Leaving]
ivanskie has joined #ruby
vondruch has quit [Quit: vondruch]
al2o3-cr has quit [Quit: WeeChat 2.6]
suukim has quit [Quit: Konversation terminated!]
akemhp has joined #ruby
al2o3-cr has joined #ruby
akemhp has quit [Ping timeout: 265 seconds]
buckworst has quit [Quit: WeeChat 2.3]
dasher00 has quit [Ping timeout: 268 seconds]
Tikku has joined #ruby
buckworst has joined #ruby
akemhp has joined #ruby
Tikku has quit [Client Quit]
fphilipe has joined #ruby
romanblanco has joined #ruby
dasher00 has joined #ruby
Mia has joined #ruby
Mia has joined #ruby
Mia has quit [Changing host]
vondruch has joined #ruby
ivanskie has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
wildtrees has joined #ruby
wildtrees has quit [Max SendQ exceeded]
wildtrees has joined #ruby
hotpancakes has joined #ruby
tens0r has joined #ruby
tens0r has quit [Client Quit]
Abhijit has joined #ruby
NODE has quit [Quit: changing servers]
NODE has joined #ruby
bvdw has quit [Read error: Connection reset by peer]
bvdw has joined #ruby
Macrobiotic has joined #ruby
buckworst has quit [Quit: WeeChat 2.3]
hotpancakes has quit [Remote host closed the connection]
hotpancakes has joined #ruby
akemhp_ has joined #ruby
akemhp_ has quit [Remote host closed the connection]
akemhp has quit [Ping timeout: 240 seconds]
akemhp has joined #ruby
hotpancakes has quit [Ping timeout: 250 seconds]
reber_ has joined #ruby
reber has quit [Ping timeout: 240 seconds]
jinie has joined #ruby
jinie has quit [Client Quit]
CalimeroTeknik has quit [Ping timeout: 240 seconds]
hotpancakes has joined #ruby
CalimeroTeknik has joined #ruby
Abhijit has quit [Quit: Leaving]
hotpancakes has quit [Client Quit]
drincruz has joined #ruby
drincruz has quit [Read error: Connection reset by peer]
drincruz has joined #ruby
NODE has quit [Quit: changing servers]
NODE has joined #ruby
NODE has left #ruby [#ruby]
NODE has joined #ruby
drincruz has quit [Ping timeout: 265 seconds]
fanta1 has joined #ruby
hiroaki has joined #ruby
sagax has quit [Quit: Konversation terminated!]
jenrzzz has joined #ruby
al2o3-cr has quit [Remote host closed the connection]
jenrzzz has quit [Ping timeout: 268 seconds]
al2o3-cr has joined #ruby
sergioro has joined #ruby
Swyper has quit [Remote host closed the connection]
Swyper has joined #ruby
drincruz has joined #ruby
Xiti has quit [Quit: Xiti]
fanta1 has quit [Quit: fanta1]
ivanskie has joined #ruby
drincruz has quit [Ping timeout: 265 seconds]
morozovm has joined #ruby
morozovm has quit [Read error: Connection reset by peer]
Xiti has joined #ruby
_whitelogger has joined #ruby
yann-kaelig has quit [Quit: yann-kaelig]
<akemhp> Hey, i got an issue, when i have one script with just: s = gets; puts "s: #{s}"; in my script, if run the script with a command line argument (i want to use it later in the script) i got an error: ./test_argv_gets.rb:3:in `gets': No such file or directory @ rb_sysopen - e (Errno::ENOENT)
<akemhp> Ok, solved with STDIN.gets instead. Nm.
romanblanco has quit [Read error: Connection reset by peer]
romanblanco has joined #ruby
drincruz has joined #ruby
ivanskie has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
drincruz has quit [Ping timeout: 252 seconds]
akem__ has joined #ruby
akemhp has quit [Ping timeout: 268 seconds]
romanblanco has quit [Ping timeout: 250 seconds]
akem__ has quit [Ping timeout: 252 seconds]
jinie has joined #ruby
akemhp has joined #ruby
orbyt_ has joined #ruby
Nicmavr has quit [Read error: Connection reset by peer]
Nicmavr has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 252 seconds]
akemhp has quit [Ping timeout: 250 seconds]
sagax has joined #ruby
dionysus69 has joined #ruby
romanblanco has joined #ruby
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
reber__ has joined #ruby
reber_ has quit [Ping timeout: 250 seconds]
romanblanco has quit [Ping timeout: 250 seconds]
NODE has quit [Quit: changing servers]
NODE has joined #ruby
NODE has quit [Client Quit]
NODE has joined #ruby
NODE has quit [Client Quit]
NODE has joined #ruby
NODE has quit [Client Quit]
NODE has joined #ruby
mn3m has joined #ruby
NL3limin4t0r_afk has quit [Ping timeout: 265 seconds]
NL3limin4t0r_afk has joined #ruby
jenrzzz has joined #ruby
drincruz has joined #ruby
dionysus69 has quit [Ping timeout: 268 seconds]
kaleido has quit [Remote host closed the connection]
kaleido has joined #ruby
jenrzzz has quit [Ping timeout: 245 seconds]
drincruz has quit [Ping timeout: 250 seconds]
wildtrees has quit [Remote host closed the connection]
akemhp has joined #ruby
NODE has quit [Quit: changing servers]
wildtrees has joined #ruby
romanblanco has joined #ruby
wildtrees has quit [Remote host closed the connection]
NODE has joined #ruby
wildtrees has joined #ruby
jenrzzz has joined #ruby
dviola has quit [Quit: WeeChat 2.7]
NODE has quit [Client Quit]
NODE has joined #ruby
NODE has quit [Client Quit]
jenrzzz has quit [Ping timeout: 276 seconds]
NODE has joined #ruby
Esa_ has quit [Ping timeout: 246 seconds]
lbrandon has quit [Quit: My MacBook Air has gone to sleep. ZZZzzz…]
Emmanuel_Chanel has quit [Quit: Leaving]
Emmanuel_Chanel has joined #ruby
howdoi has quit [Quit: Connection closed for inactivity]
mn3m has quit [Ping timeout: 268 seconds]
kaleido has quit [Quit: out]
kaleido has joined #ruby
mn3m has joined #ruby
SeepingN has quit [Ping timeout: 240 seconds]
Macrobiotic has quit [Quit: Connection closed for inactivity]
NODE has quit [Quit: changing servers]
NODE has joined #ruby
ivanskie has joined #ruby
reber_ has joined #ruby
reber__ has quit [Ping timeout: 250 seconds]
dviola has joined #ruby
skyikot has quit [Ping timeout: 260 seconds]
reber_ has quit [Ping timeout: 265 seconds]
duderonomy has quit [Ping timeout: 276 seconds]
drincruz has joined #ruby
drincruz has quit [Ping timeout: 240 seconds]
jinie has quit [Quit: ZNC 1.6.1 - http://znc.in]
jinie has joined #ruby
bvdw has quit [Read error: Connection reset by peer]
bvdw has joined #ruby
ivanskie has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
akemhp_ has joined #ruby
akemhp has quit [Ping timeout: 240 seconds]
rkoller has quit [Quit: Textual IRC Client: www.textualapp.com]
fphilipe has quit [Ping timeout: 276 seconds]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
fphilipe has joined #ruby
bluevinyl0x1 has joined #ruby