<havenwood>
baweaver: I was just talking with adam12 about the Proc#using proposal earlier today (was it today? days blend.) https://bugs.ruby-lang.org/issues/16461
wymillerlinux has quit [Read error: Connection reset by peer]
cgfbee has quit [Quit: cgfbee]
ericm has quit [Ping timeout: 272 seconds]
xco has joined #ruby
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
batisi[m] has joined #ruby
sergushakov has quit [Quit: WeeChat 2.3]
<jhass>
KrzaQ: put it into a loop? begin; ...; end until logged_in?
cgfbee has joined #ruby
wilhelm418 has quit [Ping timeout: 240 seconds]
Technodrome has joined #ruby
rcvalle has quit [Remote host closed the connection]
rcvalle has joined #ruby
schne1der has joined #ruby
jinmiaoluo has joined #ruby
Vashy has quit [Ping timeout: 252 seconds]
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jinmiaoluo has quit [Client Quit]
jinmiaoluo has joined #ruby
jinmiaoluo has quit [Client Quit]
jinmiaoluo has joined #ruby
rmnull has joined #ruby
rmnull has quit [Client Quit]
Mikaela has quit [Quit: Mikaela]
jetchisel has quit [Ping timeout: 256 seconds]
Mikaela has joined #ruby
spectra has quit [*.net *.split]
batisi[m] has quit [*.net *.split]
execat[m] has quit [*.net *.split]
arekushi has quit [*.net *.split]
afisher has quit [*.net *.split]
jimeh has quit [*.net *.split]
MentalPower has quit [*.net *.split]
Hobbyboy has quit [*.net *.split]
kashike has quit [*.net *.split]
mnemon has quit [*.net *.split]
Hobbyboy|BNC has joined #ruby
execat[m] has joined #ruby
d3bug has quit [Quit: Connection closed for inactivity]
jetchisel has joined #ruby
xco has quit [Ping timeout: 264 seconds]
xMopx has quit [Ping timeout: 246 seconds]
spectra has joined #ruby
batisi[m] has joined #ruby
kashike has joined #ruby
jimeh has joined #ruby
mnemon has joined #ruby
afisher has joined #ruby
MentalPower has joined #ruby
arekushi has joined #ruby
xMopx has joined #ruby
roadie has joined #ruby
kashike has quit [Max SendQ exceeded]
Technodrome has joined #ruby
kashike has joined #ruby
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
burgestrand has quit [Quit: burgestrand]
Garb0 has joined #ruby
ur5us has quit [Ping timeout: 260 seconds]
hassox has joined #ruby
dionysus69 has joined #ruby
gato has joined #ruby
<KrzaQ>
jhass: a loop feels weird if I want it to execute once, and only do it twice in exceptional cases. I ended up raising my exception when the code returned wwas 401
impermanence has quit [Ping timeout: 240 seconds]
Vashy has joined #ruby
olavx200 has quit [Quit: killed]
mbarbar has quit [Quit: killed]
turt2live has quit [Quit: killed]
hsiktas[m] has quit [Quit: killed]
batisi[m] has quit [Quit: killed]
stan has quit [Quit: killed]
linuus[m] has quit [Quit: killed]
execat[m] has quit [Quit: killed]
haylon[m] has quit [Quit: killed]
arekushi has quit [Quit: Gateway shutdown]
kinduff has quit [Read error: Connection reset by peer]
kinduff has joined #ruby
olavx200 has joined #ruby
donofrio has joined #ruby
sergioro has quit [Quit: Lost terminal]
jetchisel has quit [Ping timeout: 265 seconds]
jetchisel has joined #ruby
TCZ has joined #ruby
execat[m] has joined #ruby
mbarbar has joined #ruby
turt2live has joined #ruby
hsiktas[m] has joined #ruby
stan has joined #ruby
haylon[m] has joined #ruby
linuus[m] has joined #ruby
Garb0 has quit [Ping timeout: 256 seconds]
chalkmon1 has quit [Quit: WeeChat 2.8]
chalkmonster has joined #ruby
Garb0 has joined #ruby
Garb0 has quit [Max SendQ exceeded]
Garb0 has joined #ruby
caterfxo has joined #ruby
cd has quit [Quit: cd]
jinmiaoluo has quit [Ping timeout: 256 seconds]
gato has quit [Quit: Connection closed]
burningserenity has joined #ruby
Vashy has quit [Ping timeout: 252 seconds]
Technodrome has joined #ruby
Vashy has joined #ruby
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Technodrome has joined #ruby
drincruz has joined #ruby
drincruz has quit [Ping timeout: 260 seconds]
jetchisel has quit [Ping timeout: 246 seconds]
Vashy has quit [Ping timeout: 252 seconds]
conta has quit [Quit: conta]
Vashy has joined #ruby
drincruz has joined #ruby
cadbury_ has joined #ruby
<cadbury_>
Hi, I need to automate the download of https://mygovtagency.gov/statistics-may-7.xlsx where "may" and "7" obviously differ every day. what is the best way of doing this? ALso note that the name of the month may is in a foreign language! so i'd need some array mapping stuff or something as well...
<cadbury_>
I'm trying to create a cron script which will feed it to my website app..
evdubs_ has joined #ruby
evdubs has quit [Remote host closed the connection]
fercell has joined #ruby
nowhere_man has joined #ruby
gato has joined #ruby
burningserenity has quit [Remote host closed the connection]
<jhass>
cadbury_: yeah, just have an array for the month names and build the URL with something like "...#{MOTNHS[Time.now.month]}-#{Time.now.day}.xlsx"
Garb0_ has joined #ruby
Garb0_ has quit [Max SendQ exceeded]
TzilTzal has joined #ruby
drincruz has quit [Ping timeout: 256 seconds]
gitter1234 has joined #ruby
burgestrand has joined #ruby
chalkmonster has quit [Quit: WeeChat 2.8]
grimgnr has joined #ruby
grimgnr has quit [Client Quit]
rkoller has joined #ruby
me has joined #ruby
me is now known as Guest723
Guest723 is now known as sergushakov
sergushakov is now known as grimgnr
rmnull has joined #ruby
arekushi has joined #ruby
rmnull has quit [Client Quit]
grimgnr has quit [Quit: WeeChat 2.3]
me1 has joined #ruby
drincruz has joined #ruby
me1 is now known as grimgnr
grimgnr has quit [Client Quit]
me1 has joined #ruby
me1 has quit [Client Quit]
me1 has joined #ruby
nobitanobi has joined #ruby
me1 has quit [Client Quit]
grimgnr has joined #ruby
<nobitanobi>
hello - I've installed rbenv and I'm using fish shell. When I run `which irb` I see `/Users/catali/.rbenv/shims//ruby` (notice extra `/ before ruby. However, when I do `echo $PATH`, I see `/Users/catali/.rbenv/bin /Users/catali/.nvm/versions/node/v10.19.0/bin /Users/catali/.nvm/versions/node/v10.19.0/bin /Users/catali/.rbenv/bin /Users/catali/.rbenv/shims/ /usr/local/bin /usr/bin /bin /usr/sbin /sbin` - how can I see who is adding that wr
<nobitanobi>
ong route?
<jhass>
does it seriously break fish? :D
<jhass>
what steps did you follow to install rbenv?
<nobitanobi>
jhass: I followed the basic Github checkout approach (https://github.com/rbenv/rbenv#basic-github-checkout), which besides adding `.rbenv`, for fish asks you to do `set -Ux fish_user_paths $HOME/.rbenv/bin $fish_user_paths`
<quuxman>
and I also don't like editing files when I'm debugging
burgestrand has quit [Quit: burgestrand]
postmodern has quit [Quit: Leaving]
<quuxman>
Is it nicer with Test::Unit (I've only used RSpec so far)
<jhass>
maybe, I never felt the need to try something like that
<quuxman>
Also with my project the rails instantiation takes a couple seconds, but making any call from the REPL is instant. Also I can hold various useful state between running tests
<jhass>
pry-rescue's rspec integration and binding.pry is just perfect for me
sergioro has joined #ruby
<quuxman>
it's definitely a huge improvement over running rspec, waiting for failure, canceling tests, opening file, adding break point, saving, then rerunning. I can't believe anybody puts up with that
<quuxman>
:-P
<jhass>
we just get good at spotting the bug from the initial failure output :P
chouhoulis has joined #ruby
gato has quit [Ping timeout: 240 seconds]
burningserenity has joined #ruby
kinduff has quit [Read error: Connection reset by peer]
kinduff has joined #ruby
<quuxman>
I spent a lot of time with a Python project that needed a statistical approach to tests, so needed a several hundred MBs of test results in memory which took a few minutes to generate. Instead of using unit tests we just had a nice library of development tools for running various selections of tests and getting stats out of the results (our unit and integration tests could import this lib)
<quuxman>
The only time I would run tests from the command line was to check for regressions before committing
<quuxman>
that's why using Pry.rescue method directly could be very useful, mainly for maintaining state between test calls
TCZ has quit [Quit: Leaving]
jinmiaoluo has quit [Quit: WeeChat 2.8]
<quuxman>
I bet someone who knows RSpec well enough could come up with a one liner to call a single test from REPL
ldepandis has quit [Remote host closed the connection]
inguz has joined #ruby
<adam12>
havenwood baweaver That's eerily what I was trying to do 2 days ago. Very weird.
chalkmonster has joined #ruby
chalkmonster has quit [Client Quit]
wymillerlinux has joined #ruby
renich has joined #ruby
chalkmonster has joined #ruby
<havenwood>
Was that two days ago not earlier today? Hah. According to Steph I have "datetime insanity."
<havenwood>
A baby doesn't help that. :)
<havenwood>
52 days old, but no signs of Ruby or Python preference yet.
ChmEarl has joined #ruby
dionysus69 has quit [Quit: dionysus69]
ellcs has joined #ruby
dionysus69 has joined #ruby
<adam12>
havenwood: 52 days already! wow
Garb0 has quit [Read error: Connection reset by peer]
Garb0 has joined #ruby
Garb0 has quit [Max SendQ exceeded]
Garb0 has joined #ruby
rippa has joined #ruby
sergioro has quit [Quit: Lost terminal]
burningserenity has quit [Quit: Leaving.]
lupulo has joined #ruby
<lupulo>
why is useful ruby?
<lupulo>
is it compatible with django?
<havenwood>
lupulo: Ruby is useful for programming.
<olavx200>
No
<havenwood>
lupulo: Django is written in Python, so it's compatible with Python.
chalkmonster has quit [Quit: WeeChat 2.8]
<havenwood>
lupulo: Django is based loosely on a Ruby framework called Rails.
<olavx200>
Django is a python framefork. There are Ruby frameworks such as rails though.
<lupulo>
havenwood, i used nokogiri, but it seems nowdays obsoled, what i could use to work with json?
renich has quit [Ping timeout: 264 seconds]
<havenwood>
lupulo: Nokogiri isn't osoled.
<havenwood>
lupulo: JSON ships with the Ruby stdlib.
<cadbury_>
i dont even maintain a ~.zshrc for that very same fact
<cadbury_>
dont want it to creep up over time
<havenwood>
cadbury_: I could extract the prompt to get it back down, it looks like.
<cadbury_>
havenwood: you need to work on yourself brother. ditch some solutions you thought were mandatory
<havenwood>
cadbury_: I don't use Oh My Zsh, so this is quite minimalist.
<havenwood>
cadbury_: The prompt is most the file, it looks like. I
<havenwood>
cadbury_: I like to ditch dependencies I thought were mandatory and write minimalist alternatives. Sue me!
<cadbury_>
oh my zsh is garbage!!!!!!!
<cadbury_>
hehe
<cadbury_>
well, your approach seems very minimal and kudos for that!
<cadbury_>
although, the large walls you've set up around your approach seem less appealing
<havenwood>
cadbury_: Large walls?
<havenwood>
cadbury_: I just read the manual. ¯\_(ツ)_/¯
<havenwood>
Nothing spooky.
<havenwood>
(Other than #ls, but that's a work in progress. >.>)
* havenwood
puts another brick in the wall.
<havenwood>
If anyone tries PryCarePackage let me know if it works for you. :)
<havenwood>
The recent irb changes are just great.
<cadbury_>
havenwood: yeah making things a bit more difficult than they have to be
<cadbury_>
like a .zshrc vs no .zshrc
<cadbury_>
lets face it, its not really a needed file...
chalkmonster has quit [Quit: WeeChat 2.8]
<cadbury_>
ditching it from your setup would result in hundreds if not thousands of saved man hours
Esa__ has joined #ruby
deimos_ has quit [Quit: leaving]
<havenwood>
cadbury_: Ditching my .zshrc would save thousands of hours?
<havenwood>
Huh?
TCZ has joined #ruby
Esa__ has quit [Ping timeout: 272 seconds]
<havenwood>
cadbury_: I help maintain multiple shell projects and have spent thousands of hours on shell, no doubt. My .zshrc file is totally benign though, and is just one of many setups that helps me be effective along with some placeholder tidbits. I'm super confused why you think it wastes thousands of hours.
<havenwood>
Anyways, was hoping to glean some nice .irbrc ideas, if anyone has settings they like.
<havenwood>
Hopefully my .irbrc won't waste thousands of people hours. :P
<cadbury_>
lol
<cadbury_>
you just proved my point havenwood
<havenwood>
cadbury_: I did?
<cadbury_>
You _are_ millions of years ahead of everyone else!
<cadbury_>
As a proponent of Zsh, I'm glad this project has you as a user
<cadbury_>
That being said, I don't believe in the need for a .zsh
<havenwood>
On that note, it's interesting that Enumerator::ArithmeticSequence#clone and #dup are broken.
<cadbury_>
hehe
<havenwood>
&>> 1.step.clone
<rubydoc>
stderr: -e:4:in `clone': allocator undefined for Enumerator::ArithmeticSequence (TypeError)... check link for more (https://carc.in/#/r/90xm)
<cadbury_>
... yeah
<cadbury_>
get back to you in ten years when i've figured it out? :)
<rubydoc>
stderr: -e:4:in `clone': allocator undefined for Enumerator::ArithmeticSequence (TypeError)... check link for more (https://carc.in/#/r/90xo)
<havenwood>
&>> 1.step.dup
<rubydoc>
stderr: -e:4:in `dup': allocator undefined for Enumerator::ArithmeticSequence (TypeError)... check link for more (https://carc.in/#/r/90xp)
<cadbury_>
imagine if bach, vivaldi and mozart were alive today, and were forced to live with computer keyboards instead of piano keyboards
<cadbury_>
would probably sound like havenwood :)
<havenwood>
cadbury_: I'm more like some guy nobody has heard of that make violin bridges. :P
<rubydoc>
stderr: -e:4:in `block in <main>': undefined method `current' for Date:Class (NoMethodError)... check link for more (https://carc.in/#/r/90yl)
<howdoi>
is there a way to dynamically create a variable while iterating through hash?
<howdoi>
binding?
caterfxo has joined #ruby
<howdoi>
instance_variable_set?
davispuh has quit [Ping timeout: 240 seconds]
<phaul>
they are really different things. It's not a question of possible, but a question of which one you want.
<phaul>
local vars care about lexical scope. intance vars care about self.
roadie has joined #ruby
deathwishdave has joined #ruby
gato has joined #ruby
davispuh has joined #ruby
burningserenity has quit [Quit: Leaving.]
Technodrome has joined #ruby
<adam12>
baweaver: wrt proc refining, I'm working in a non-ActiveSupport world but I was looking to recreate it's DSL (kinda) in a block. Something like TimeExpr { 1.day.from_now }. I don't want Integer to always have a #day method so I thought triggering it in the block would work nice.
<adam12>
baweaver: If you hear of a solution I'd love to know.
<howdoi>
phaul: hmm, okies
<howdoi>
x.map { |k,v| [k, foo(v) unless v.nil?]}; is this a right syntax?
romanlevin has quit [Ping timeout: 265 seconds]
<leftylink>
IIRC they needed the parens around the secod list item.
<leftylink>
in which case, it is valid.
<leftylink>
and otherwise, it is not
<howdoi>
ah, thanks
Vashy has quit [Read error: Connection reset by peer]
ericm has joined #ruby
TCZ has joined #ruby
romanlevin has joined #ruby
<howdoi>
can this me made better: h = Hash.new { |h, k| h[k] = Hash.new(&h.default_proc) } ?
<howdoi>
x.map { |k,v| [k, (foo(v) unless v.nil?)]}.th_h; works, but can it be better?
mikecmpbll has quit [Ping timeout: 256 seconds]
<havenwood>
howdoi: Might `v` be false, or it's `nil` or another value?
<howdoi>
safe to think it is always nil, in this case
<havenwood>
howdoi: x.transform_values { |v| foo(v) if v }
ur5us has joined #ruby
<havenwood>
howdoi: For the former question, it can be made more readable, but that's generally how you man an autoselfvivifying Hash.
<giorgian>
xb
<havenwood>
howdoi: Of the new numbered parameters: x.transform_values { foo(_1) if _1 }
<havenwood>
howdoi: Or have foo handle `nil` and: x.transform_values { foo _1 }
<havenwood>
howdoi: There's also a #to_h with block form, but if you're just modifying the key or value, use #transform_values or #tranform_keys instead.
<havenwood>
x.to_h { |k, v| [k, v] }
Vashy has joined #ruby
<havenwood>
x.tranform_keys { |k| k }
<havenwood>
x.transform_values { |v| v }
<howdoi>
oh nice, what if foo fails as in it throws a exception?
<havenwood>
howdoi: Rescue it or let it blow up—but that's your choice.
<howdoi>
I want to rescue inline
<havenwood>
howdoi: rescue what?
<howdoi>
also, h = {:t1=>"mm", :t2=>"kk"}; I need to execute `foo` on `t1` first, if it fails, then `t2`, that can be in a single line?
<havenwood>
howdoi: #find returns `nil` if it doesn't find anything.
schne1der has quit [Ping timeout: 260 seconds]
<howdoi>
m.find {|k,v| foo(v) if v} is returning me [:k,v] and `.first` gives `:k`
<howdoi>
I was expecting m.find {|k,v| foo(v) if v} to return foo(v)
inguz has quit [Quit: ZZZzzz…]
<howdoi>
: break value, I would need a block, like how you did for #p, right?
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
renich has joined #ruby
<howdoi>
havenwood: sorry if I am missing something obvious here
<havenwood>
howdoi: #find just returns the receiver item that matches, unmodified. you'd do: m.find { |_k, v| foo(v) if v }.last.then { |value| foo(value) }
<havenwood>
howdoi: Or, instead of printing the value, set an instance variable.
<havenwood>
howdoi: (Where I used #p.)
yxhuvud has quit [Read error: Connection reset by peer]
yxhuvud has joined #ruby
<howdoi>
md=nil; m.find {|k,v| md = Magnet::Card.parse(v) if v} works, but it is a bad pattern, right?