jhass[m] changed the topic of #ruby to: Rules: https://ruby-community.com | Ruby 3.1.2, 3.0.4, 2.7.6: https://www.ruby-lang.org | Paste 4+ lines to: https://gist.github.com | Books: https://goo.gl/wpGhoQ
lucf117_ has quit [Ping timeout: 272 seconds]
Sheilong has quit [Quit: Connection closed for inactivity]
gr33n7007h has quit [Ping timeout: 250 seconds]
gr33n7007h has joined #ruby
perrierj1 has quit [Ping timeout: 240 seconds]
gramps has left #ruby [https://quassel-irc.org - Chat comfortably. Anywhere.]
ur5us has quit [Ping timeout: 250 seconds]
gramps has joined #ruby
weaksauc_ has joined #ruby
emcb547 has joined #ruby
Neopolitan0 has joined #ruby
Byteflux has joined #ruby
Fridtjof_ has joined #ruby
emcb54 has quit [Quit: Ping timeout (120 seconds)]
Neopolitan has quit [Quit: Ping timeout (120 seconds)]
fercell has quit [Quit: ZNC - https://znc.in]
jmcgnh has quit [Remote host closed the connection]
yosafbridge has quit [Quit: Leaving]
Fridtjof has quit [Quit: ZNC - http://znc.in]
Bitflux has quit [Quit: ZNC - https://znc.in]
Neopolitan0 is now known as Neopolitan
emcb547 is now known as emcb54
agrosant has quit [Ping timeout: 272 seconds]
donofrio_ has joined #ruby
John_Ivan_ has joined #ruby
yosafbridge has joined #ruby
gr33n7001 has joined #ruby
atille_ has joined #ruby
fercell has joined #ruby
weaksauce has quit [Ping timeout: 272 seconds]
gr33n7007h has quit [Ping timeout: 272 seconds]
donofrio has quit [Ping timeout: 272 seconds]
miah has quit [Ping timeout: 272 seconds]
atille has quit [Ping timeout: 272 seconds]
John_Ivan has quit [Ping timeout: 272 seconds]
swaggboi has quit [Ping timeout: 272 seconds]
ferr_ has joined #ruby
depesz_ has joined #ruby
fercell has quit [Ping timeout: 272 seconds]
depesz has quit [Ping timeout: 272 seconds]
agrosant has joined #ruby
miah has joined #ruby
swaggboi has joined #ruby
jmcgnh has joined #ruby
John_Ivan_ has quit [Ping timeout: 276 seconds]
dviola has quit [Ping timeout: 276 seconds]
kenichi_ has joined #ruby
asio_ has joined #ruby
hanzo has quit [Quit: Connection closed for inactivity]
fercell has joined #ruby
thoraxe1 has joined #ruby
cognemo_ has joined #ruby
tbob_ has joined #ruby
cognemo has quit [Ping timeout: 272 seconds]
asio has quit [Ping timeout: 272 seconds]
thoraxe has quit [Ping timeout: 272 seconds]
kenichi has quit [Ping timeout: 272 seconds]
ferr_ has quit [Ping timeout: 272 seconds]
tbob has quit [Ping timeout: 272 seconds]
dviola has joined #ruby
ur5us has joined #ruby
crankharder has joined #ruby
FetidToot has quit [Quit: The Lounge - https://thelounge.chat]
FetidToot has joined #ruby
favadi has joined #ruby
dviola has quit [Changing host]
dviola has joined #ruby
dionysus69 has joined #ruby
crankharder has quit [Ping timeout: 256 seconds]
dviola has quit [Ping timeout: 240 seconds]
favadi has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
crankharder has joined #ruby
crankharder has quit [Ping timeout: 256 seconds]
favadi has joined #ruby
dg1727 has joined #ruby
dg1727 has left #ruby [#ruby]
dionysus69 has quit [Ping timeout: 276 seconds]
ur5us has quit [Ping timeout: 240 seconds]
lucf117_ has joined #ruby
favadi has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
crankharder has joined #ruby
crankharder has quit [Ping timeout: 240 seconds]
yossarian has quit [Ping timeout: 246 seconds]
<ox1eef> is there some method on File, Dir, anything that returns a user's home dir relative to their platform? i seem to remember something but can't think of it.
<ox1eef> found it, i think.. Dir.home
favadi has joined #ruby
duds- has quit [Remote host closed the connection]
duds- has joined #ruby
favadi has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
teclator has joined #ruby
crankharder has joined #ruby
yossarian has joined #ruby
yossarian has quit [Changing host]
yossarian has joined #ruby
crankharder has quit [Ping timeout: 246 seconds]
oxfuxxx has joined #ruby
oxfuxxx has quit [Remote host closed the connection]
favadi has joined #ruby
oxfuxxx has joined #ruby
oxfuxxx has quit [Read error: Connection reset by peer]
Rounin has joined #ruby
oxfuxxx has joined #ruby
perrierjouet has joined #ruby
Furai has quit [Quit: WeeChat 3.5]
gr33n7001 has quit [Ping timeout: 276 seconds]
dionysus69 has joined #ruby
dionysus69 has quit [Read error: Connection reset by peer]
Furai has joined #ruby
oxfuxxx has quit [Ping timeout: 276 seconds]
lucf117_ has quit [Ping timeout: 276 seconds]
oxfuxxx has joined #ruby
oxfuxxx has quit [Client Quit]
oxfuxxx has joined #ruby
oxfuxxx has quit [Client Quit]
favadi has quit [Read error: Connection reset by peer]
jpn has joined #ruby
jpn_ has joined #ruby
jpn has quit [Ping timeout: 250 seconds]
oxfuxxx has joined #ruby
crankharder has joined #ruby
depesz_ is now known as depesz
crankharder has quit [Ping timeout: 246 seconds]
yxhuvud has quit [Read error: Connection reset by peer]
yxhuvud has joined #ruby
ur5us has joined #ruby
gr33n7001 has joined #ruby
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jpn has joined #ruby
vit has joined #ruby
jpn_ has quit [Ping timeout: 256 seconds]
vit is now known as freeworld
freeworld has quit [Quit: Konversation terminated!]
vit has joined #ruby
vit is now known as freeworld
freeworld is now known as vit
vit is now known as freeworld
freeworld has quit [Client Quit]
freeworld has joined #ruby
freeworld has quit [Client Quit]
freeworld has joined #ruby
freeworld has quit [Client Quit]
freeworld has joined #ruby
dionysus69 has joined #ruby
oxfuxxx has quit [Ping timeout: 256 seconds]
ur5us has quit [Ping timeout: 240 seconds]
wybpip[m] has joined #ruby
wybpip[m] has left #ruby [#ruby]
dionysus69 has quit [Ping timeout: 256 seconds]
tbob_ has quit [Ping timeout: 248 seconds]
crankharder has joined #ruby
tbob has joined #ruby
jpn has quit [Ping timeout: 248 seconds]
crankharder has quit [Ping timeout: 256 seconds]
libsys has quit [Ping timeout: 256 seconds]
jpn has joined #ruby
jpn has quit [Ping timeout: 256 seconds]
ftajhii has joined #ruby
gproto23 has joined #ruby
crankharder has joined #ruby
freeworld has quit [Ping timeout: 260 seconds]
John_Ivan_ has joined #ruby
<John_Ivan_> is there a way to "puts" out to console a heredoc with ruby syntax highlighting
<John_Ivan_> ?
Sheilong has joined #ruby
<legit> No idea, but it does sound a pretty specific use case
<legit> sound like*
jpn has joined #ruby
AndreYuhai has joined #ruby
jpn has quit [Ping timeout: 256 seconds]
<AndreYuhai> Hey everyone! We've got a test case where we make a get request like this https://paste.ofcode.org/38jWjCArw5hCgpv37nHfyBk and the controllers have protect_from_forgery, however this test fails saying "InvalidCrossOriginRequest: Security warning: an embedded <script> tag on another site requested protected JavaScript. If you know what you're doing, go ahead and disable forgery protection on this action
<AndreYuhai> to permit cross-origin JavaScript embedding....
<AndreYuhai> "
<AndreYuhai> Not sure how to resolve this or why and how I even get this in a test.
crankharder has quit [Ping timeout: 276 seconds]
jpn has joined #ruby
jpn has quit [Ping timeout: 246 seconds]
jpn has joined #ruby
crankharder has joined #ruby
<adam12> John_Ivan_: Nothing built in. I'd maybe pipe to the `bat` tool, but I doubt that's what you want.
jpn has quit [Ping timeout: 250 seconds]
crankharder has quit [Ping timeout: 240 seconds]
freeworld has joined #ruby
<AndreYuhai> Also where can I get more info about the get request in tests? For example there's this https://apidock.com/rails/ActionController/TestCase/Behavior/get but there's no information about the request format.
<AndreYuhai> There's xhr which is deprecated
phryk_ has joined #ruby
phryk has quit [Remote host closed the connection]
jpn has joined #ruby
dionysus69 has joined #ruby
sylario has joined #ruby
Tomte has joined #ruby
moo has quit [Quit: moo]
crankharder has joined #ruby
Tomte has quit [Read error: Connection reset by peer]
Tomte has joined #ruby
<John_Ivan_> adam12, yeah, I think piping it to vim or something would work. thanks for the suggestion.
jpn has quit [Ping timeout: 276 seconds]
Tempesta has quit [Quit: See ya!]
Tempesta has joined #ruby
jpn has joined #ruby
<adam12> It would be interesting to have built in syntax highlighting for Ruby source. I wonder if someone will build it with the improvements to pp and ripper.
Ziyan has joined #ruby
oxfuxxx has joined #ruby
some14u has joined #ruby
oxfuxxx has quit [Remote host closed the connection]
oxfuxxx has joined #ruby
oxfuxxx has quit [Client Quit]
roadie has joined #ruby
some14u has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
some14u has joined #ruby
some14u has quit [Read error: Connection reset by peer]
some14u has joined #ruby
AndreYuhai has quit [Ping timeout: 256 seconds]
bit4bit has joined #ruby
bit4bit has quit [Ping timeout: 250 seconds]
moo has joined #ruby
some14u has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
some14u has joined #ruby
crankharder has quit [Ping timeout: 260 seconds]
crankharder has joined #ruby
AndreYuhai has joined #ruby
dionysus70 has joined #ruby
dionysus69 has quit [Ping timeout: 240 seconds]
dionysus70 is now known as dionysus69
crankharder has quit [Ping timeout: 276 seconds]
AndreYuhai has quit [Ping timeout: 250 seconds]
crankharder has joined #ruby
dionysus69 has quit [Ping timeout: 276 seconds]
comet23 has joined #ruby
<comet23> what is the value of an empty return statement?
<comet23> like just the keyword return by itself
<leah2> nil
<leah2> you could have found that out yourself
<comet23> thank you
<comet23> i tried but i don't know how to do it
<comet23> i tried p return and got an error =/
<leah2> >> def f; return; end; f
<leah2> => nil
<comet23> oh that's mind blowing i never thought of it that way
<leah2> or drop the return, same behavior ;)
<comet23> i feel stupid for calling it a return value and never realizing that nil as the return value is the return value
dionysus69 has joined #ruby
* comet23 feels extremely stupid
<leah2> dont worry :)
<adam12> comet23: I wouldn't feel stupid about learning.
gproto23 has quit [Remote host closed the connection]
AndreYuhai has joined #ruby
<ox1eef> a cool thing about ruby is that practically everything returns a value, all the way from if "statements" to method definitions.
AndreYuhai has quit [Ping timeout: 246 seconds]
<adam12> akeyless 44628 KB
<adam12> I wonder what the largest gem documentation is now. I should look.
<adam12> I'm guessing it's still going to be azure_mgmt_network.
<adam12> Yep. azure_mgmt_network at 781564 KB, with intersight_client next at 566096 KB.
<adam12> 781 MB of YARD docs. Some head shaking necessary there.
duderonomy has joined #ruby
<aeris> o/ here!
<aeris> is there any ruby idiom to be able to linearize some recursive code like f { f { f { … f { a_block } … } ?
<adam12> aeris: o/
<adam12> hmmm
Tomte has quit [Read error: Connection reset by peer]
<ox1eef> i wrote a lot of docs past few days
_ht has joined #ruby
<ox1eef> aeris: maybe Proc#curry, or funkify by banister. github.com/banister/funkify
<aeris> in my case i have a list of list of arguments for the f function, want to do something like (args.each { |a| f a }) &a_block
<aeris> with the block called on the full f function stack
<ox1eef> it looks like the functional style, have you considered partial application to solve it
TCZ has joined #ruby
phryk_ is now known as phryk
mixfix41 has joined #ruby
<aeris> will look for that, ty :)
oxfuxxx has joined #ruby
AndreYuhai has joined #ruby
<ox1eef> args = [1,2,3,4]
<ox1eef> func = proc { |a,b,c,d| a+b+c+d }.curry(args.size)
<ox1eef> puts args.inject(func) { _1[_2] }
<ox1eef> something like that.
AndreYuhai has quit [Ping timeout: 240 seconds]
crankharder has quit [Quit: leaving]
<bougyman> omg I feel so lame.
some14u has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<bougyman> There has to be a better way to compute that without iterating through each reward. I suck at these types of things.
<bougyman> leah2: ^ Any thoughts?
some14u- has joined #ruby
AndreYuhai has joined #ruby
<leah2> erm
<bougyman> I'm trying to remember shit from college. failing miserably.
<leah2> is the result wrong or what?
<bougyman> No, the result is right.
<leah2> just slow
<bougyman> Just trying to do it without a million loops.
<bougyman> This is me failing at math, basically.
<leah2> isnt this some kind of base conversion?
<bougyman> It's the rewards for bitcoin blocks.
<bougyman> at the end, total is the total amount of bitcoin that will be produced.
<bougyman> I just know there's a way to replace lines 6-10 with some metamath.
AndreYuhai has quit [Ping timeout: 248 seconds]
<bougyman> 210,000 is how many blocks happen before rewards (subsidy) halves.
<leah2> i guess it's a geometric sum or so
<bougyman> Yup, something like that.
dionysus70 has joined #ruby
dionysus69 has quit [Ping timeout: 246 seconds]
jpn has quit [Ping timeout: 256 seconds]
dionysus70 has quit [Ping timeout: 240 seconds]
jpn has joined #ruby
some14u- has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
some14u has joined #ruby
jpn has quit [Read error: Connection reset by peer]
jpn has joined #ruby
jpn has quit [Ping timeout: 246 seconds]
Guest1344 has joined #ruby
AndreYuh1i has joined #ruby
Guest1344 has quit [Client Quit]
<leftylink> I think thre should be a way. first is to notice that 5000000000 gets added 210000 times. then 2500000000 gets added 210000 times... basically for 210000 consecutive values of height, the value added is the same
<leftylink> so might as well just do all 210000 iterations at once by multiplying the amount added to the total by 210000, then add 210000 to height instead of 1
<leftylink> you'll compute the exact same answer in 1/210000th the time, which is plenty good enough
<bougyman> Yep, did that.
<bougyman> I mean, that was my first optimization.
<bougyman> It's still not really leveraging "Sum of geometric sequence" which can accomplish this. Only ruby google hit on that is a code kata on codewars.
<leftylink> it may be a little tricky though because usually the formulas involved would not truncate, like this code is doing
comet23 has quit [Quit: Client closed]
<leftylink> so the iteration that adds 9765625 followed by 4882812 would cause a difference. the formula would want to add 4882812.5 afterward
AndreYuh1i has quit [Quit: Lost terminal]
TCZ has quit [Quit: ...]
<bougyman> I think that's about the best I could do: https://gist.github.com/bougyman/5737053038056d075915fc80ce11f5a0
jpn has joined #ruby
some14u has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
lucf117_ has joined #ruby
jpn has quit [Ping timeout: 248 seconds]
<leftylink> for me I would really want to write it as a Enumerable#sum, though I believe to do that, the code structure will have to change to instead predetermine which iteration is the last (can't `break` out of a `sum`). I believe this is achievable by using init_subsidy.bit_length. however, the only reason I would do this is because it hurts me to see a reduce that's used as a sum, whereas this is not true for
<leftylink> everyone who will see the code
<leftylink> so there is no inherent need to do that
<leftylink> and besides, making that change makes no difference to performance, which was the main question, so I shouldn't have brought it up since it's off-topic to the questoin
<leftylink> my apologies for straying off-topic.
jpn has joined #ruby
<bougyman> Haha, no, that's great.
<bougyman> ends up being a 3 liner.
<bougyman> coin = 100_000_000
<bougyman> init_subsidy = 50 * coin
<bougyman> puts (0..init_subsidy.bit_length).sum { |height| (init_subsidy >> height) * 210000 } / coin.to_f
<bougyman> Thanks!
some14u has joined #ruby
<leftylink> pandabot: what's thumbs up emoji
<pandabot> thumbupemoji is: 👍
some14u has quit [Client Quit]
jpn has quit [Ping timeout: 260 seconds]
<leftylink> hmm I could start dissecting the reasons why I say thumbs up emoji instead of saying "you're welcome" or "no problem" or "glad I could be of service" or anything reasonable, but I think that's squarely in -offtopic territory
<leftylink> I'm actually not sure the reasons
oxfuxxx has quit [Quit: [H]EAT ROX FUCK R0X SHIT BRIX. = The Yankies M0th3Rphackers Coconut Aerospace =]
jpn has joined #ruby
comet23 has joined #ruby
jpn has quit [Ping timeout: 256 seconds]
some14u has joined #ruby
some14u has quit [Client Quit]
advorak has joined #ruby
jpn has joined #ruby
jpn has quit [Ping timeout: 240 seconds]
lucf117_ has quit [Quit: Leaving]
ollysmith has quit [Quit: ZNC 1.8.2+deb2+b3 - https://znc.in]
ollysmith has joined #ruby
Ziyan has quit [Ping timeout: 256 seconds]
Ziyan has joined #ruby
ftajhii has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
jpn has joined #ruby
oxfuxxx has joined #ruby
advorak has left #ruby [#ruby]
<newton> passive upthumb from me
jpn has quit [Ping timeout: 248 seconds]
Ziyan has quit [Ping timeout: 240 seconds]
Ziyan has joined #ruby
tbob has quit [Ping timeout: 248 seconds]
tbob has joined #ruby
jpn has joined #ruby
dionysus69 has joined #ruby
Ziyan has quit [Quit: Textual IRC Client: www.textualapp.com]
comet23 has quit [Quit: Client closed]
mixfix41 has quit [Quit: logging out bye]
Ziyan has joined #ruby
ur5us has joined #ruby
Ziyan has quit [Ping timeout: 248 seconds]
_ht has quit [Remote host closed the connection]
Ziyan has joined #ruby
oxfuxxx has quit [Remote host closed the connection]
jpn has quit [Ping timeout: 256 seconds]
Ziyan has quit [Quit: Textual IRC Client: www.textualapp.com]
hanzo has joined #ruby
weaksauc_ is now known as weaksauce
jpn has joined #ruby
jpn has quit [Ping timeout: 240 seconds]
bit4bit has joined #ruby
bit4bit has quit [Ping timeout: 240 seconds]
dionysus69 has quit [Ping timeout: 248 seconds]
jpn has joined #ruby
jpn has quit [Ping timeout: 276 seconds]
roadie has quit [Ping timeout: 260 seconds]
jpn has joined #ruby
jpn has quit [Ping timeout: 246 seconds]
jpn has joined #ruby
roadie has joined #ruby
teclator has quit [Quit: http://quassel-irc.org - Chat comfortably. Anywhere.]
roadie has quit [Ping timeout: 260 seconds]
jpn has quit [Ping timeout: 246 seconds]
jpn has joined #ruby
<havenwood> bougyman: (0..init_subsidy.bit_length).sum { |height| init_subsidy >> height }.fdiv(coin) * 210000
tbob has quit [Ping timeout: 276 seconds]
tbob has joined #ruby
shiru has joined #ruby
<bougyman> havenwood: you someofabatch.
<bougyman> (0..(sub = 50 * (coin = 100_000_000)).bit_length).sum { |height| sub >> height }.fdiv(coin) * 210000
<bougyman> final answer.
sylario has quit [Quit: Connection closed for inactivity]
freeworld has quit [Quit: Konversation terminated!]
roadie has joined #ruby
roadie has quit [Ping timeout: 248 seconds]
crankharder has joined #ruby
crankharder has quit [Ping timeout: 260 seconds]
shiru has quit [Quit: Lost terminal]
comet23 has joined #ruby