havenwood changed the topic of #ruby to: Rules: https://ruby-community.com | Ruby 2.7.2, 2.6.6, 3.0.0-preview1: https://www.ruby-lang.org | Paste 4+ lines of text to https://dpaste.org | Books: https://goo.gl/wpGhoQ | Logs: https://irclog.whitequark.org/ruby | BLM <3 | Can't talk? Register/identify with NickServ
<cloud69> Shouldn't `"//lala".gsub(/\/\//, "")` output `lala`?
<cloud69> trying to clean this url that starts with just // and not http://
<apotheon> Yes, that's what that code should do.
<apotheon> s/output/return/
adu has joined #ruby
<cloud69> ah. my irb wasn't outputting anything due to a prior failed command
<apotheon> ah
<cloud69> apotheon: cool. i get the same result with gsub(/\//, "") as gsub(/\/\//, "") though
<apotheon> By the way, a way to make a regex less confusing to read is to do something like:
<apotheon> Regexp.new('//')
<apotheon> (depending on context, sometimes that's less painful)
<cloud69> nice, didn't know that
<cloud69> oh and one more thing:
<apotheon> The difference between gsub(/\/\//, "") and gsub(/\//, "") is that the latter will also remove all slashes, even if there's only one of them.
<apotheon> Thus, if you have //lala/titi/dodo/ the result will be lala/titi/dodo for the first gsub and lalatitidodo for the second gsub.
<apotheon> do re mi fa sol la ti do
chouhoulis has joined #ruby
<ruby[bot]> cloud69: as I told you already, please use https://gist.github.com
<cloud69> assuming they all share the same regex, is there a way to shorten this? https://pastebin.com/hwStcTrn
<apotheon> Many people don't like pastebin.com for pastes.
<cloud69> i'll make the change asap :)
<cloud69> gsub(/\/\//, "") it is then, thx
<apotheon> In fact, today pastebin.com has decided that I'm not allowed to view your paste and gave me a broken captcha.
<apotheon> Oh, the captcha worked on the second try.
<cloud69> :/ apologize for the inconvenience
<cloud69> i wonder if rails has a helper to turn strings into valid urls
<cloud69> like .strip or .parameterize
<apotheon> You could turn product.css('#content').css('.foo').text.gsub(...) into a method thta takes '.foo', '.bar', and '.baz' as an argument and returns a result for assignment to each variable.
chouhoulis has quit [Ping timeout: 264 seconds]
<cloud69> apotheon: maybe thats a bit overboard. im ok repeating myself in this case
<cloud69> cheers!
adu has quit [Quit: adu]
glimpse[m] has joined #ruby
<apotheon> You could also create a hash, thing = {name: 'foo', price: 'bar', description: 'baz'}, then operate on it with thing.keys.each {|k| thing[k] = product.css("#content").css(".#{think[k]}").text.gsub(...) }
<apotheon> . . . which would give you those results, but instead of variables name, price, and description, you'd have think[:name], thing[:price], and thing[:description].
<apotheon> note: The code was correct in my head, but may not have arrived in IRC true to form, and I did not test it.
<apotheon> better written:
<apotheon> fields = { name: '.foo', price: '.bar', description: '.baz }
<apotheon> fields.keys.each {|k| fields[k] = product.css('#content').css(fields[k]).text.gsub(...) }
<apotheon> Doing it with each_pair might result in a race condition. I'm not sure.
<apotheon> . . . and, alas, there's no #pairs method.
<cloud69> hehe true to form :)
<cloud69> seems a bit overboard to be honest but looks like a nice exercise though!
<cloud69> last thing, I'm getting `undefined method `gsub' for #<Nokogiri::XML>` when trying to either `main_image_url = product.css("#content").css("a").attr("href").gsub(...)`
<cloud69> Or when creating a new variable and using URI.escape like `main_image_url2 = URI.escape(main_image_url.gsub(/\/\//, ""))` anybody know?
<cloud69> i reckon nokogiri doesn't support gsub, but shouldn't the uri escape thing mitigate that?
roshanavand has quit [Ping timeout: 260 seconds]
orbyt_ has joined #ruby
lucasb has quit [Quit: Connection closed for inactivity]
<cloud69> nevermind i got it
DaRock has joined #ruby
<cloud69> added a new line `main_image_url = main_image_url.attribute("href").value.gsub(/\/\//, "")`
Azure has quit [Ping timeout: 260 seconds]
Azure has joined #ruby
KindOne has left #ruby [#ruby]
<cloud69> Anybody know why I'm getting `Errno::ENOENT: No such file or directory @ rb_sysopen - cdn.shopify.com/s/files/1/1752/6725/products/foobar.jpg` for `main_image = URI.open(main_image_url)` in the following snippet? https://pastebin.com/iKSKKcmD
<cloud69> Yes, I'm working on setting up a GitHub account as we speak :)
<ruby[bot]> cloud69: as I told you already, please use https://gist.github.com
bmurt has joined #ruby
phenom_ has joined #ruby
phenom has quit [Disconnected by services]
phenom_ is now known as phenom
TCZ has quit [Quit: Diabe? tkwi w szczegó?ach]
helpa has quit [Remote host closed the connection]
helpa has joined #ruby
factormystic has quit [Ping timeout: 256 seconds]
<apotheon> cloud69: I tend to want to deduplicate any time I see something like three lines in a row of code like `product.css('#content').css(one_thing_that_changes).text.gsub(...)` because if it ever turns out that code needs to change I'd need to change it in three places, which means there are three opportunities for me to get it wrong without noticing.
<apotheon> cloud69: . . . so I'm not sure it's overboard.
<apotheon> cloud69: I don't think you need a GitHub account for gists, but maybe I'm mistaken.
<apotheon> cloud69: You could also use something like sprunge for pastes if you don't want to use gists.
<apotheon> cloud69: There's no signing in, and it's about as simple as can be. You can use a simple script to submit code from the command line for it.
<apotheon> cloud69: My personal preference is just for people's pastes to not require JavaScript in the browser.
<cloud69> yeah i can understand that. http://sprunge.us/ looks awesome, im gonna use that from now on
mozzarella has quit [Remote host closed the connection]
adu has joined #ruby
mozzarella has joined #ruby
chouhoulis has joined #ruby
<apotheon> cloud69: This is the script I use for pasting to sprunge. http://sprunge.us/3azB3j
<apotheon> cloud69: With that, I can pipe output of some command to it, like `command | sprunge`; I can just give it a filename, like `sprunge filename.rb`; and I can just use `sprunge` and type or paste code to it directly (and hit Ctrl-D on a blank line at the end to make it paste to the website).
<cloud69> apotheon: neat, thanks for sharing
carbone5 has joined #ruby
adu has quit [Quit: adu]
carbone5 has quit [Quit: carbone5]
adu has joined #ruby
davispuh has quit [Quit: http://quassel-irc.org - Chat comfortably. Anywhere.]
factormystic has joined #ruby
PSchlesinger has joined #ruby
<PSchlesinger> Anybody here developing on MacOS? I'm going nuts trying to get syslogger to log debug to system.log (or to a particular log file after editing asl.conf). Best I can get is warn or better in the Console.app. Help?
AnomalyXII has joined #ruby
SanguineAnomaly has quit [Ping timeout: 260 seconds]
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
powerhouse has quit [Quit: Leaving]
powerhouse has joined #ruby
ChmEarl has quit [Quit: Leaving]
gix has joined #ruby
gix- has quit [Ping timeout: 265 seconds]
ur5us_ has quit [Ping timeout: 260 seconds]
gix has quit [Ping timeout: 260 seconds]
baojg_ has joined #ruby
<PSchlesinger> Anybody here developing on MacOS? I'm going nuts trying to get syslogger to log debug to system.log (or to a particular log file after editing asl.conf). Best I can get is warn or better in the Console.app. Help?
baojg has quit [Ping timeout: 264 seconds]
ScotchBonnet has joined #ruby
<ScotchBonnet> Hello. Could anybody give me some advice on how to achieve the same functionality as https://quillbot.com/ in Ruby?
<ScotchBonnet> I see most language processors on GitHub are made in Python :/
NightMonkey has quit [Quit: ZNC - http://znc.in]
NightMonkey has joined #ruby
cd has quit [Quit: cd]
donofrio has quit [Remote host closed the connection]
adu has quit [Quit: adu]
cer0 has quit [Quit: leaving]
donofrio has joined #ruby
chouhoulis has quit [Remote host closed the connection]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
podman has quit [Read error: Connection reset by peer]
podman has joined #ruby
iNs has quit [Remote host closed the connection]
iNs has joined #ruby
iNs has quit [Remote host closed the connection]
iNs has joined #ruby
evdubs_ has joined #ruby
evdubs has quit [Ping timeout: 264 seconds]
<PSchlesinger> Anybody here developing on MacOS? I'm going nuts trying to get syslogger to log debug to system.log (or to a particular log file after editing asl.conf). Best I can get is warn or better in the Console.app. Help?
baojg_ has quit [Remote host closed the connection]
baojg has joined #ruby
hagabaka has quit [Quit: No Ping reply in 180 seconds.]
hagabaka has joined #ruby
akem has quit [Ping timeout: 256 seconds]
dviola has quit [Ping timeout: 272 seconds]
dviola has joined #ruby
s2013 has joined #ruby
chouhoulis has joined #ruby
chouhoulis has quit [Ping timeout: 272 seconds]
vondruch has joined #ruby
ur5us_ has joined #ruby
Glumetu has joined #ruby
Lyubo1 has joined #ruby
evdubs_ is now known as evdubs
Fire-Dragon-DoL has quit [Ping timeout: 260 seconds]
s2013 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
dviola has left #ruby ["WeeChat 2.9"]
dviola has joined #ruby
Fire-Dragon-DoL has joined #ruby
TomyWork has joined #ruby
davispuh has joined #ruby
titanbiscuit has joined #ruby
gdonald has quit [Ping timeout: 246 seconds]
ur5us_ has quit [Ping timeout: 264 seconds]
ur5us_ has joined #ruby
bitstalker has quit [Ping timeout: 246 seconds]
bitstalker has joined #ruby
IceDragon has quit [Quit: ZNC - http://znc.in]
jacksop has joined #ruby
Caerus has quit [Ping timeout: 260 seconds]
Caerus has joined #ruby
_aeris_ has quit [Remote host closed the connection]
_aeris_ has joined #ruby
BenDover has joined #ruby
Jonopoly has joined #ruby
ellcs has joined #ruby
dfucci has joined #ruby
braincrash has joined #ruby
_aeris_ has quit [Remote host closed the connection]
_aeris_ has joined #ruby
XV8 has joined #ruby
ur5us_ has quit [Ping timeout: 264 seconds]
foxxx0 is now known as foxxx-1
ellcs has quit [Ping timeout: 260 seconds]
foxxx-1 is now known as foxxx0
charrit69 has joined #ruby
fippy has quit [Remote host closed the connection]
fippy has joined #ruby
vondruch has quit [Ping timeout: 272 seconds]
impermanence has quit [Ping timeout: 256 seconds]
bamdad has quit [Ping timeout: 240 seconds]
baojg has quit [Remote host closed the connection]
baojg has joined #ruby
TCZ has joined #ruby
queip has quit [Ping timeout: 264 seconds]
ropeney has quit [Quit: ZNC 1.7.4 - https://znc.in]
ropeney has joined #ruby
beholders_eye has joined #ruby
queip has joined #ruby
bamdad has joined #ruby
Jonopoly has quit [Quit: WeeChat 2.9]
Rudd0 has quit [Ping timeout: 260 seconds]
pwnd_sfw has quit [Ping timeout: 256 seconds]
brendan- has joined #ruby
roshanavand has joined #ruby
akem has joined #ruby
charrit69 has quit [Ping timeout: 260 seconds]
greypack has quit [Ping timeout: 256 seconds]
impermanence has joined #ruby
ellcs has joined #ruby
pothibo has joined #ruby
budonyc has joined #ruby
akem has quit [Ping timeout: 240 seconds]
ellcs has quit [Ping timeout: 260 seconds]
chouhoulis has joined #ruby
vondruch has joined #ruby
donofrio has quit [Remote host closed the connection]
donofrio has joined #ruby
pothibo has quit [Quit: Connection closed]
bmurt has joined #ruby
braincrash has quit [Ping timeout: 260 seconds]
charrit69 has joined #ruby
ChmEarl has joined #ruby
code_zombie has joined #ruby
charrit69 has quit [Ping timeout: 260 seconds]
<adam12> ScotchBonnet: Most of them are probably bindings to OpenNLP I'd bet. Were you able to find anything on https://github.com/diasks2/ruby-nlp ?
ruurd has joined #ruby
dhollinger has quit [*.net *.split]
dka has quit [*.net *.split]
dhollinger has joined #ruby
dka has joined #ruby
wallace_mu has joined #ruby
impermanence has quit [Quit: Connection closed]
akem has joined #ruby
s2013 has joined #ruby
lucasb has joined #ruby
TCZ has quit [Remote host closed the connection]
Hien has quit [Ping timeout: 272 seconds]
Hien has joined #ruby
GGMethos has quit [Ping timeout: 272 seconds]
GGMethos has joined #ruby
TCZ has joined #ruby
akem has quit [Ping timeout: 264 seconds]
ruurd has quit [Quit: bye folks]
ruurd has joined #ruby
DaRock has quit [Ping timeout: 260 seconds]
Rudd0 has joined #ruby
Glumetu has quit [Quit: Glumetu]
pwnd_sfw has joined #ruby
sleetdrop has joined #ruby
PSchlesinger has quit [Ping timeout: 240 seconds]
duckpuppy has quit [Quit: ZNC 1.8.2 - https://znc.in]
duckpuppy has joined #ruby
rippa has joined #ruby
bmurt has quit [Ping timeout: 256 seconds]
<ScotchBonnet> adam12: that is sooooo awesome!=) thx for sharing!
jacksop has quit []
sleetdrop has quit [Quit: Computer has gone to sleep.]
cthulchu_ has joined #ruby
<isene> Better RTFM screencast (view in HD on Youtube): https://youtu.be/ANUOlDryUng
orbyt_ has joined #ruby
dfucci has quit [Ping timeout: 272 seconds]
braincrash has joined #ruby
ua has quit [Ping timeout: 272 seconds]
cd has joined #ruby
TomyWork has quit [Remote host closed the connection]
ua has joined #ruby
philCryo has joined #ruby
kenichi_ is now known as kenichi
dfucci has joined #ruby
hiroaki has quit [Remote host closed the connection]
hiroaki has joined #ruby
dfucci has quit [Ping timeout: 264 seconds]
dostoyevsky has quit [Ping timeout: 260 seconds]
braincrash has quit [Ping timeout: 272 seconds]
vondruch has quit [Read error: Connection reset by peer]
TCZ has quit [Quit: Diabe? tkwi w szczegó?ach]
helpa has quit [Remote host closed the connection]
helpa has joined #ruby
dfucci has joined #ruby
andremedeiros has quit [Read error: Connection reset by peer]
andremedeiros has joined #ruby
dostoyevsky has joined #ruby
beholders_eye has quit [Quit: WeeChat 2.8]
gix has joined #ruby
howdoi has joined #ruby
ruurd has quit [Quit: ZZZzzz…]
ruurd has joined #ruby
dfucci has quit [Ping timeout: 256 seconds]
ruurd has quit [Client Quit]
ruurd has joined #ruby
bmurt has joined #ruby
ruurd has quit [Quit: ZZZzzz…]
braincrash has joined #ruby
dfucci has joined #ruby
baojg has quit [Remote host closed the connection]
booboy has quit [Quit: ZNC - https://znc.in]
booboy has joined #ruby
ellcs has joined #ruby
ruurd has joined #ruby
dfucci has quit [Ping timeout: 260 seconds]
FastJack has quit [Ping timeout: 246 seconds]
FastJack has joined #ruby
bocaneri has quit [Ping timeout: 272 seconds]
bocaneri has joined #ruby
dfucci has joined #ruby
bocaneri has quit [Max SendQ exceeded]
bocaneri has joined #ruby
dfucci has quit [Ping timeout: 272 seconds]
Eiam has joined #ruby
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
al2o3-cr has joined #ruby
andornaut has joined #ruby
MeVegan[m] has joined #ruby
fippy has quit [Ping timeout: 256 seconds]
chouhoulis has quit [Remote host closed the connection]
ur5us_ has joined #ruby
philCryo has quit [Read error: Connection reset by peer]
philCryo has joined #ruby
philCryo has quit [Ping timeout: 246 seconds]
cow[moo] has joined #ruby
chouhoulis has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Emmanuel_Chanel has quit [Quit: Leaving]
Emmanuel_Chanel has joined #ruby
gavlee has quit [Ping timeout: 260 seconds]
gavlee has joined #ruby
orbyt_ has joined #ruby
grvgr has quit [Read error: Connection reset by peer]
william1_ has joined #ruby
ReinH__ has quit [Read error: Connection reset by peer]
grvgr has joined #ruby
d0liver has quit [Read error: Connection reset by peer]
proc has quit [Read error: Connection reset by peer]
proc has joined #ruby
d0liver has joined #ruby
ReinH__ has joined #ruby
cloud69 has quit [Quit: Connection closed for inactivity]
Xiti has quit [Quit: Leaving]
bambanx has joined #ruby
Xiti has joined #ruby
TCZ has joined #ruby
dfucci has joined #ruby
dfucci has quit [Ping timeout: 260 seconds]
Inoperable has quit [Excess Flood]
bmurt has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Inoperable has joined #ruby
bdnelson has joined #ruby
bdnelson has quit [Client Quit]
DTZUZU has quit [Remote host closed the connection]
DTZUZU has joined #ruby
SeepingN has joined #ruby
orbyt_ has joined #ruby
extrowerk has quit [Ping timeout: 260 seconds]
wildtrees has joined #ruby
extrowerk has joined #ruby
moldorcoder7 has quit [Ping timeout: 256 seconds]
bdnelson has joined #ruby
akem has joined #ruby
philCryo has joined #ruby
philCryo has quit [Ping timeout: 246 seconds]
william1_ has quit [Ping timeout: 256 seconds]
philCryo has joined #ruby
braincrash has quit [Ping timeout: 246 seconds]
philCryo has quit [Ping timeout: 264 seconds]
kaleido has quit [Quit: peas]
kaleido has joined #ruby
kaleido has quit [Changing host]
kaleido has joined #ruby
MuffinPimp has quit [Quit: Goodbye.]
MuffinPimp has joined #ruby
meimeix has quit [Ping timeout: 240 seconds]
meimeix has joined #ruby
TCZ has quit [Quit: Diabe? tkwi w szczegó?ach]
helpa has quit [Remote host closed the connection]
helpa has joined #ruby
duderonomy has quit [Ping timeout: 240 seconds]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
BenDover has quit [Remote host closed the connection]
duderonomy has joined #ruby
ivz_hh has quit [Ping timeout: 240 seconds]
ivz_hh has joined #ruby
moldorcoder7 has joined #ruby
cloud69 has joined #ruby
bamdad has quit [Ping timeout: 240 seconds]
lipoqil has quit [Quit: ZNC 1.6.5+deb1+deb9u2 - http://znc.in]
stdedos has joined #ruby
ellcs has quit [Ping timeout: 260 seconds]
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
philCryo has joined #ruby
TCZ has joined #ruby
davispuh has quit [Quit: http://quassel-irc.org - Chat comfortably. Anywhere.]
philCryo has quit [Ping timeout: 256 seconds]
stdedos has quit [Quit: Connection closed]
s2013 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
dfucci has joined #ruby
banisterfiend has joined #ruby
hiroaki has quit [Ping timeout: 272 seconds]
s2013 has joined #ruby
dfucci has quit [Ping timeout: 272 seconds]
cer0 has joined #ruby
sh7d has quit [Quit: meh]
sh7d has joined #ruby
johnny56 has quit [Ping timeout: 240 seconds]
dfucci has joined #ruby
code_zombie has quit [Quit: Leaving]
fippy has joined #ruby
ur5us_ has quit [Ping timeout: 260 seconds]