« Back to channel list

#ruby - 22 May 2017

« Back 1 day Forward 1 day »
[00:10:12] foul_owl: How can I run RAILS_ENV=production bundle exec rake redmine:load_default_data passing in the language I want via terminal?
[00:10:21] foul_owl: ie, non interactively
[00:10:42] havenwood: MarkBilk: It seems you're looking for the src attribute of each image?: page.css('img').map { |img| img.attr 'src' }
[00:11:14] havenwood: foul_owl: you want to run it as a background process? or?
[00:11:23] foul_owl: I'm automating via ansible
[00:11:32] foul_owl: So user input cannot happen
[00:11:42] Lord_of_Life: has joined #ruby
[00:12:01] foul_owl: Is there a way to ask rake what it will prompt me for? and then provide it with env vars or other params perhaps?
[00:12:02] DeeJayh: has joined #ruby
[00:12:25] foul_owl: Maybe something like: AILS_ENV=production bundle exec rake redmine:load_default_data --language=en ?
[00:12:44] havenwood: foul_owl: You want to pass an argument to the rake task?
[00:13:14] havenwood: foul_owl: Are you writing the rake task? I don't quite get what you're asking.
[00:13:56] foul_owl: I am not writing a rake task, I'm just an end user
[00:14:02] havenwood: foul_owl: I'm not familiar with redmine rake tasks. Is that one that is provided for you? Ah, okay.
[00:14:17] havenwood: foul_owl: And that Redmine rake task is prompting you for input?
[00:14:29] foul_owl: I am wondering how I can provide answers non-interactively
[00:14:35] foul_owl: Not just for this particular rake task
[00:14:37] foul_owl: But in general :)
[00:14:42] foul_owl: Thank you!!
[00:14:48] havenwood: foul_owl: Don't make rake tasks interactive.
[00:15:01] foul_owl: Sure, but I'm just the end user :P
[00:15:07] foul_owl: There must be some way to avoid it
[00:15:14] havenwood: If you're using them, check the docs. You might need to make your own.
[00:15:16] havenwood: Check the redmine rake task you're using.
[00:15:39] enterprisey: has joined #ruby
[00:16:00] havenwood: foul_owl: https://github.com/redmine/redmine/blob/master/lib/tasks/load_default_data.rake
[00:16:20] havenwood: foul_owl: Note: https://github.com/redmine/redmine/blob/master/lib/tasks/load_default_data.rake#L9
[00:16:24] bheesham: has joined #ruby
[00:16:37] foul_owl: Ok so I can just use an env var
[00:16:39] havenwood: export REDMINE_LANG=whatev
[00:16:46] havenwood: or prefix it like your other env var
[00:16:50] foul_owl: Thanks again!
[00:16:54] havenwood: You're welcome.
[00:17:50] Rodya_: has joined #ruby
[00:25:19] bronson: has joined #ruby
[00:31:17] b0mbnet: has joined #ruby
[00:32:37] romank: has joined #ruby
[00:32:51] bkxd: has joined #ruby
[00:32:54] charliesome: has joined #ruby
[00:37:30] ornerymoose: has joined #ruby
[00:43:23] d^sh: has joined #ruby
[00:48:53] cschneid_: has joined #ruby
[00:52:23] jenrzzz: has joined #ruby
[00:52:23] jenrzzz: has joined #ruby
[00:55:41] NightMonkey: has joined #ruby
[00:56:08] BSAlb: has joined #ruby
[01:01:23] DeeJayh: has joined #ruby
[01:01:49] drudrud555: has joined #ruby
[01:02:29] drudrud555: has left #ruby: ()
[01:02:57] SenpaiSilver: has joined #ruby
[01:07:20] romank: has joined #ruby
[01:08:13] MarkBilk: havenwood: Thanks! It works! Now I just have to figure out why. Don't know the map {} business. Presumably that's standard Ruby. I'll look it up.
[01:08:20] gizmore|2: has joined #ruby
[01:08:33] blackwind_123: has joined #ruby
[01:13:22] tristanp: has joined #ruby
[01:18:04] ecuanaso: has joined #ruby
[01:23:37] al2o3-cr: has joined #ruby
[01:30:16] romank: has joined #ruby
[01:32:48] bkxd: has joined #ruby
[01:32:59] romank: has joined #ruby
[01:36:00] romank: has joined #ruby
[01:38:30] Vile`: has joined #ruby
[01:46:47] romank: has joined #ruby
[01:49:37] romank: has joined #ruby
[01:50:27] d^sh: has joined #ruby
[01:51:35] charliesome: has joined #ruby
[01:57:24] apparition: has joined #ruby
[02:01:21] nofxx: has joined #ruby
[02:02:24] b0mbnet: has joined #ruby
[02:03:29] raul782: has joined #ruby
[02:04:09] b0mbnet: has joined #ruby
[02:05:25] oborot: has joined #ruby
[02:06:32] romank: has joined #ruby
[02:06:59] bronson: has joined #ruby
[02:11:03] MarkBilk_: has joined #ruby
[02:11:21] romank: has joined #ruby
[02:14:08] romank: has joined #ruby
[02:16:07] Jameser: has joined #ruby
[02:16:56] romank: has joined #ruby
[02:18:38] DeeJayh: has joined #ruby
[02:20:26] genpaku: has joined #ruby
[02:24:27] b0mbnet: has joined #ruby
[02:25:56] jrafanie: has joined #ruby
[02:28:41] houhoulis: has joined #ruby
[02:29:45] b0mbnet: has joined #ruby
[02:36:03] KeyJoo: has joined #ruby
[02:37:29] stupidsenpai: has joined #ruby
[02:37:33] dtzuzu: has joined #ruby
[02:39:31] eckhardt: has joined #ruby
[02:39:46] minimalism: has joined #ruby
[02:43:24] cschneid_: has joined #ruby
[02:45:57] romank: has joined #ruby
[02:52:26] rdavila: has joined #ruby
[02:54:56] cschneid_: has joined #ruby
[02:56:18] jphase: has joined #ruby
[02:59:50] mim1k: has joined #ruby
[03:03:29] hndk: has joined #ruby
[03:05:02] Paradox: has joined #ruby
[03:05:03] Puppet`: has joined #ruby
[03:06:38] cschneid_: has joined #ruby
[03:09:44] jrafanie: has joined #ruby
[03:09:46] Silthias1: has joined #ruby
[03:10:05] hahuang65: has joined #ruby
[03:10:44] romank: has joined #ruby
[03:11:15] cschneid_: has joined #ruby
[03:15:06] b0mbnet: has joined #ruby
[03:22:59] Krebsgewehr: has joined #ruby
[03:26:12] jeffreylevesque: has joined #ruby
[03:30:08] b0mbnet: has joined #ruby
[03:37:09] bronson: has joined #ruby
[03:37:30] romank: has joined #ruby
[03:44:24] raul782: has joined #ruby
[03:46:25] gix: has joined #ruby
[03:47:35] pb122: has joined #ruby
[03:48:58] pb122: has joined #ruby
[03:49:14] enterprisey: has joined #ruby
[03:49:46] DeeJayh: has joined #ruby
[03:52:06] Axy: has joined #ruby
[03:52:06] Axy: has joined #ruby
[03:54:39] nadir: has joined #ruby
[03:57:51] claw: has joined #ruby
[03:59:56] Mia: has joined #ruby
[03:59:56] Mia: has joined #ruby
[04:00:36] romank: has joined #ruby
[04:02:01] eightlimbed: has joined #ruby
[04:06:03] ur5us: has joined #ruby
[04:06:36] Paradox: has joined #ruby
[04:06:37] ur5us_: has joined #ruby
[04:07:30] claw: has joined #ruby
[04:09:21] romank: has joined #ruby
[04:10:48] hahuang65: has joined #ruby
[04:12:26] tristanp: has joined #ruby
[04:14:20] romank: has joined #ruby
[04:15:05] donske: has joined #ruby
[04:15:37] jane_booty_doe: has joined #ruby
[04:19:00] romank: has joined #ruby
[04:24:06] zapata: has joined #ruby
[04:29:58] romank: has joined #ruby
[04:30:16] nebiros: has joined #ruby
[04:34:43] romank: has joined #ruby
[04:35:07] renchan: has joined #ruby
[04:39:31] romank: has joined #ruby
[04:42:24] romank: has joined #ruby
[04:47:02] eckhardt: has joined #ruby
[04:48:13] ndrei: has joined #ruby
[04:52:20] sneakerhax: has joined #ruby
[05:00:23] mim1k: has joined #ruby
[05:00:39] cyclonis: has joined #ruby
[05:01:58] apparition: has joined #ruby
[05:02:18] benlieb: has joined #ruby
[05:03:39] b0mbnet: has joined #ruby
[05:03:56] pankaj_: has joined #ruby
[05:05:03] romank: has joined #ruby
[05:07:10] ndrei: has joined #ruby
[05:07:55] xall: has joined #ruby
[05:10:05] boringcp1: has joined #ruby
[05:11:30] hahuang65: has joined #ruby
[05:15:54] romank: has joined #ruby
[05:16:16] yirabbit: has joined #ruby
[05:18:51] romank: has joined #ruby
[05:25:56] cschneid_: has joined #ruby
[05:25:59] jamesaxl: has joined #ruby
[05:26:50] stormbytes: has joined #ruby
[05:27:31] bkxd: has joined #ruby
[05:28:21] nofxxx: has joined #ruby
[05:31:42] jaruga: has joined #ruby
[05:32:53] bkxd: has joined #ruby
[05:35:57] tildes: has joined #ruby
[05:38:08] bronson: has joined #ruby
[05:40:37] biberu: has joined #ruby
[05:41:48] romank: has joined #ruby
[05:42:41] jusa: has joined #ruby
[05:47:53] anisha: has joined #ruby
[05:48:06] Tomthetom: has joined #ruby
[05:48:31] minimalism: has joined #ruby
[05:50:44] uZiel: has joined #ruby
[05:51:02] alazred: has joined #ruby
[05:51:02] alazred: has joined #ruby
[05:55:21] aufi: has joined #ruby
[05:56:14] b0mbnet: has joined #ruby
[06:02:08] ledestin: has joined #ruby
[06:03:50] __Yiota: has joined #ruby
[06:09:27] nowhere_man: has joined #ruby
[06:12:15] hahuang65: has joined #ruby
[06:16:34] cyclonis: has joined #ruby
[06:22:13] Mortomes|Work: has joined #ruby
[06:24:42] blackwind_123: has joined #ruby
[06:28:13] cfec0b8d: has joined #ruby
[06:29:09] FastJack_: has joined #ruby
[06:36:31] romank: has joined #ruby
[06:42:33] benlieb: has joined #ruby
[06:42:36] ndrei: has joined #ruby
[06:46:29] conta: has joined #ruby
[06:47:02] yogg-saron: has joined #ruby
[06:47:08] pandaant: has joined #ruby
[06:48:46] xall: has joined #ruby
[06:49:58] conta: has joined #ruby
[06:50:32] romank: has joined #ruby
[06:53:52] b0mbnet: has joined #ruby
[06:54:42] DoubleMalt: has joined #ruby
[06:54:57] dionysus69: has joined #ruby
[06:54:59] b0mbnet: has joined #ruby
[06:56:19] charliesome: has joined #ruby
[06:59:44] dionysus69: has joined #ruby
[07:01:02] dionysus69: has anyone worked with google api? I have an error with `require 'google/api_client/client_secrets'` after installing gem `google-api-client`
[07:01:54] dionysus69: i am just trying to make a hello world connection. I was successful with a public file but no luck with google authentication system
[07:08:29] pankaj_: has joined #ruby
[07:08:31] jackrandom: has joined #ruby
[07:10:14] robotmay: has joined #ruby
[07:10:32] jgnagy: has joined #ruby
[07:12:50] SaschaVoid: has joined #ruby
[07:13:17] hahuang65: has joined #ruby
[07:16:55] romank: has joined #ruby
[07:17:40] cyclonis: has joined #ruby
[07:17:54] FastJack: has joined #ruby
[07:21:12] ecuanaso: has joined #ruby
[07:22:26] Kug3lis: has joined #ruby
[07:25:09] vondruch: has joined #ruby
[07:25:56] oborot: has joined #ruby
[07:26:18] antgel_: has joined #ruby
[07:28:18] P4f73k: has joined #ruby
[07:28:39] b0mbnet: has joined #ruby
[07:29:08] mark_66: has joined #ruby
[07:29:31] romank: has joined #ruby
[07:33:00] jenrzzz: has joined #ruby
[07:33:00] jenrzzz: has joined #ruby
[07:34:27] andikr: has joined #ruby
[07:37:24] anvor: has joined #ruby
[07:39:18] bronson: has joined #ruby
[07:42:01] zacts: has joined #ruby
[07:45:01] kmhn: has joined #ruby
[07:45:36] marr: has joined #ruby
[07:50:18] blackmesa: has joined #ruby
[07:52:33] User458764: has joined #ruby
[07:52:36] kmhn: has joined #ruby
[07:54:19] romank: has joined #ruby
[07:55:57] yogg-saron: has joined #ruby
[07:59:57] b0mbnet: has joined #ruby
[08:02:10] ddffg: has joined #ruby
[08:02:30] Stan: has joined #ruby
[08:04:08] burgestrand: has joined #ruby
[08:06:50] kmhn: has joined #ruby
[08:07:10] Silthias: has joined #ruby
[08:08:00] kmhn: has joined #ruby
[08:08:11] moei: has joined #ruby
[08:09:30] kmhn: has joined #ruby
[08:11:02] romank: has joined #ruby
[08:13:10] kmhn: has joined #ruby
[08:13:12] mim1k: has joined #ruby
[08:14:01] hahuang65: has joined #ruby
[08:14:08] Hanmac: has joined #ruby
[08:17:27] mdw: has joined #ruby
[08:18:25] cyclonis: has joined #ruby
[08:19:51] Silox|: has joined #ruby
[08:21:18] ur5us: has joined #ruby
[08:21:41] Beams: has joined #ruby
[08:22:29] Doow: has joined #ruby
[08:22:56] djbkd: has joined #ruby
[08:23:18] morfin: has joined #ruby
[08:23:29] morfin: hello again
[08:23:39] morfin: did anybody build Ruby with OpenSSL 1.1?
[08:24:26] Doow: Hi! What's the fastest way of doing simple string matching? I.e. I want to find all lines in a log containing a specific substring. It's a fixed string, not a regular expression.
[08:25:30] SpComb: /bin/grep
[08:27:22] b0mbnet: has joined #ruby
[08:27:32] Doow: SpComb, I'd prefer not relying on external dependencies, I also want to do things with the lines I find in a convenient way. =)
[08:31:48] canton7: Doow, String#include?
[08:32:02] Doow: canton7, I'll try that
[08:33:55] SpComb: depending on the substring, something optimized like grep is presumably going to be significantly faster than `lines.each do line.include? ... end`. How much that matters depends on how big your logfiles are
[08:34:28] Doow: SpComb, they're around 1GB
[08:34:31] canton7: yeah, grep pulls some very clever tricks
[08:36:30] morfin: like what?
[08:36:58] canton7: this is a good read: http://ridiculousfish.com/blog/posts/old-age-and-treachery.html
[08:37:35] morfin: ah i started remembering
[08:37:47] jameswatling: has joined #ruby
[08:37:53] SpComb: http://blog.burntsushi.net/ripgrep/#mechanics also this blog post about benchmarking grep implementations
[08:38:17] jameswatling: has left #ruby: ()
[08:38:19] b0mbnet: has joined #ruby
[08:39:28] djbkd: has joined #ruby
[08:45:59] blackwind_123: has joined #ruby
[08:50:12] SpComb: for a 35MB logfile with 300k lines, grepping for 'foo' with 12 matches, ruby -e `STDIN.read.split("\n").each do |line| puts line if line.include? "foo" end` is ~1100ms real 600ms user, ruby -e `'STDIN.each do ... end` is ~600ms real 460ms user, and `grep -F` is ~130ms real 50ms user
[08:50:27] SpComb: so an ~order of magnitude difference for grep vs ruby loop with String#include?
[08:52:08] SpComb: you might already start noticing that difference with 1GB logfiles :)
[08:52:10] Doow: SpComb, that's quite significant, thanks for input
[08:53:10] Doow: SpComb, yeah, especially as I search for several different items, so it can easily match each line 20 times or more.
[08:53:53] Doow: SpComb, I'll do the naive implementation first as I don't really that quick response time, but it's good to have some options if it gets too slow
[08:54:01] DrCode: has joined #ruby
[08:56:51] lxsameer: has joined #ruby
[09:00:31] belmoussaoui: has joined #ruby
[09:03:39] futilegames: has joined #ruby
[09:08:02] mim1k: has joined #ruby
[09:08:48] romank: has joined #ruby
[09:10:48] volty: has joined #ruby
[09:14:49] hahuang65: has joined #ruby
[09:17:09] sonicm: has joined #ruby
[09:19:37] cyclonis: has joined #ruby
[09:20:51] jenrzzz: has joined #ruby
[09:20:51] jenrzzz: has joined #ruby
[09:24:08] b0mbnet: has joined #ruby
[09:29:32] pankaj_: has joined #ruby
[09:32:08] bigkevmcd: has joined #ruby
[09:32:42] anisha: has joined #ruby
[09:33:16] psmmr: has joined #ruby
[09:36:27] dminuoso: SpComb: Why do folks still use grep?
[09:36:30] dminuoso: It's awful, its slow
[09:36:37] dminuoso: Use ack or better yet silversearcher.
[09:37:22] ljarvis: or now ripgrep, which is considerably faster than them all
[09:40:21] bronson: has joined #ruby
[09:40:30] b0mbnet: has joined #ruby
[09:42:10] uZiel: has joined #ruby
[09:42:10] dminuoso: ljarvis: "ripgrep combines the usability of The Silver Searcher with the raw speed of grep."
[09:42:14] dminuoso: Is that meant to be a joke?
[09:42:25] morfin: i will try use that paches for OpenSSL hmm
[09:44:10] ljarvis: dminuoso: heh, i don't know
[09:45:17] manveru: i use ag in term and fzy for vim
[09:45:49] kassav_: has joined #ruby
[09:46:13] ljarvis: is fzy something different?
[09:46:17] manveru: https://github.com/jhawthorn/fzy#why-use-this-over-fzf-pick-selecta-ctrlp- :)
[09:46:37] konsolebox: has joined #ruby
[09:47:34] ljarvis: keeping up with this stuff is a tad boring :)
[09:51:53] bheesham: has joined #ruby
[09:55:33] tvw: has joined #ruby
[09:56:25] romank: has joined #ruby
[09:58:11] belmoussaoui: has joined #ruby
[09:59:13] dionysus70: has joined #ruby
[10:01:16] nowhere_man: has joined #ruby
[10:02:22] mtkd: has joined #ruby
[10:02:37] nowhere_man: has joined #ruby
[10:05:54] Silthias: has joined #ruby
[10:10:41] xall: has joined #ruby
[10:11:51] dminuoso: I wonder whether zsh has something like that bolted in already
[10:12:29] yirabbit_: has joined #ruby
[10:12:56] belmoussaoui_: has joined #ruby
[10:13:57] mim1k: has joined #ruby
[10:15:36] hahuang65: has joined #ruby
[10:19:22] nobitanobi: has joined #ruby
[10:20:20] cyclonis: has joined #ruby
[10:23:16] cschneid_: has joined #ruby
[10:24:59] belmoussaoui_: has joined #ruby
[10:25:13] kassav__: has joined #ruby
[10:25:34] im0nde: has joined #ruby
[10:26:16] oborot_: has joined #ruby
[10:28:21] yirabbit_: has joined #ruby
[10:29:21] Bish: how do i chunk into pairs?
[10:29:35] Bish: [a,b,c,d] => [[a,b],[c,d]] ?
[10:30:02] ljarvis: >> [:a,:b,:c,:d].each_slice(2).to_a
[10:30:03] ruby[bot]: ljarvis: # => [[:a, :b], [:c, :d]] (https://eval.in/802560)
[10:30:05] dminuoso: Bish: each_slice
[10:30:10] dminuoso: Beat me it.
[10:30:52] dminuoso: Actually I transmitted this information with faster-than-light speed, and ljarvis just copied his answer based on mine.
[10:31:04] ljarvis: it's true, im a fraud
[10:31:20] dminuoso: Also you violated causality.
[10:31:23] dminuoso: You should be hanged.
[10:31:29] ljarvis: *blows pistol and whips it back into holster*
[10:32:16] Bish: okay, how do i get this?
[10:32:27] Bish: [a,b,c] => [a..b,b..a,b..c] ?
[10:32:51] canton7: >> [:a, :b, :c].each_cons(2).to_a
[10:32:52] ruby[bot]: canton7: # => [[:a, :b], [:b, :c]] (https://eval.in/802564)
[10:33:04] dminuoso: you also want b..a?
[10:33:06] canton7: oh, missed b..a. What's that doing in there? Why isn't there a c..b?
[10:33:29] Bish: [a,b,c] => [a..b,b..c] ?
[10:33:40] canton7: what I said, then
[10:34:06] Bish: what does cons stand for?
[10:34:13] canton7: consecutive, probably
[10:34:13] ljarvis: consecutive
[10:34:25] aspiers: has joined #ruby
[10:34:40] ljarvis: also, .. is for ranges
[10:34:44] ljarvis: do you want ranges?
[10:35:12] Bish: yes, i just mapped it
[10:35:52] belmoussaoui: has joined #ruby
[10:37:59] Bish: first_day = Date.new(Date.today.year,1,1);first_mon = first_day+(first_day.wday+1%7);(first_mon..first_datum+52*7).step(7).each_cons(2).map { |x| x.first..x.last }
[10:38:05] Bish: any mistake in here? or something stupid?
[10:38:16] Bish: ( i want all calendar weeks of the current year )
[10:38:36] Bish: first_day = Date.new(Date.today.year,1,1);first_mon = first_day+(first_day.wday+1%7);(first_mon..first_mon+52*7).step(7).each_cons(2).map { |x| x.first..x.last } < rather
[10:41:22] canton7: Bish, 'first_day.wday+1%7' <-- watch your precedence
[10:41:41] ljarvis: tbh im a bit confused about what you want even reading that
[10:42:07] Bish: a year has 52 weeks, i want an array of beginning and end of each
[10:42:29] ljarvis: array of dates? for the monday and sunday of every week?
[10:43:00] Bish: what's so funny about that :(
[10:43:02] burgestrand: has joined #ruby
[10:43:03] canton7: heh, that's useless. Now we know that ljarvis was almost right, but not what's wrong or right about it...
[10:43:36] canton7: "You don't know quite know what my problem is. Now help me fix it!"
[10:43:51] Bish: i don't follow :(
[10:43:57] tobiasvl: Bish: what do you mean by "kinda"
[10:44:05] Bish: i mean yes
[10:44:13] tobiasvl: you want "kinda" what ljarvis said, what's different from what ljarvis said?
[10:44:14] Bish: but the 1.1.YYYY doesn't need to be a monday
[10:44:16] canton7: what are you trying to do? you said that "array of dates? for the monday and sunday of every week?" was "kinda" right. So, in what way is it right, and in what was is it wrong?
[10:44:20] Bish: so it's not just monday to sunday
[10:44:37] Bish: it might be the first week of the year starts friday
[10:45:00] ljarvis: So this year starts on Sunday, what are the first 3 values of your array?
[10:46:09] Bish: >> first_day = Date.new(Date.today.year,1,1);first_mon = first_day+(first_day.wday+1%7);(first_mon..first_mon+52*7).step(7).each_cons(2).map { |x| x.first..x.last }[1..3]
[10:46:15] ljarvis: that doesn't help
[10:46:25] ljarvis: So this year starts on Sunday, what are the first 3 values of your array?
[10:46:40] canton7: "here's my incorrect code: this answers your question!"
[10:46:42] Bish: the first should be the first week.. meaning sunday to sunday
[10:46:48] manveru: did the bot die?
[10:46:51] ljarvis: so it's *every day*?
[10:47:04] canton7: Bish, what are the *actual* first 3 values of the array?
[10:47:08] canton7: as actual numbers?
[10:47:27] Bish: no it's [Sunday..Sunday,Monday..Sunday,Monday..Sunday]
[10:47:36] Bish: 52 times, until the last week of the year
[10:47:46] DrCode: has joined #ruby
[10:48:32] canton7: ok, so the first partial week appears as the first element, and the last partial week appears as the last element?
[10:49:01] canton7: and are those first two 'Sunday's the same value? Or are they the 1st and 7th?
[10:50:34] manveru: (Date.new(Date.today.year,1,1)..Date.new(Date.today.year,12,31)).group_by{|d| d.cweek }.map{|k,v| (v.first..v.last) }
[10:51:07] canton7: so is it [yyyy-01-01..yyyy-01-01, yyyy-01-02..yyyy-01-08] or [yyyy-01-01..yyyy-01-08, yyyyy-08-09..yyyy-01-15] ?
[10:53:01] manveru: hmm, got a bug somwhere
[10:53:43] manveru: 01.01 counts as calendar week 52 :P
[10:54:02] tvw: has joined #ruby
[10:54:21] manveru: oh well, was worth a try
[11:02:20] belmoussaoui_: has joined #ruby
[11:10:43] alazred: has joined #ruby
[11:10:59] alazred: has joined #ruby
[11:13:01] anisha: has joined #ruby
[11:16:21] hahuang65: has joined #ruby
[11:17:19] yirabbit_: has joined #ruby
[11:17:59] charliesome: has joined #ruby
[11:18:53] Fernando-Basso: has joined #ruby
[11:19:41] yirabbit_: has joined #ruby
[11:20:30] jameswatling: has joined #ruby
[11:21:08] cyclonis: has joined #ruby
[11:21:09] qguv: has joined #ruby
[11:22:06] yirabbit_: has joined #ruby
[11:23:55] DeeJayh-L: has joined #ruby
[11:24:20] DeeJayh: has joined #ruby
[11:24:37] anisha: has joined #ruby
[11:26:04] Jameser: has joined #ruby
[11:30:02] belmoussaoui: has joined #ruby
[11:30:08] anisha_: has joined #ruby
[11:33:26] kassav_: has joined #ruby
[11:34:35] FastJack: has joined #ruby
[11:40:56] nhhc: has joined #ruby
[11:41:15] HoierM: has joined #ruby
[11:41:35] User458764: has joined #ruby
[11:41:50] anisha_: has joined #ruby
[11:41:59] bronson: has joined #ruby
[11:42:12] DeeJayh-L_: has joined #ruby
[11:44:18] dionysus69: I have stylistic question
[11:44:42] dionysus69: let's say I have this method and it has 17 lines https://gist.github.com/anonymous/a8b54f851d7dfcf1700f63973787a4e6 rubocop complains with its default set to 10 line length per method
[11:44:56] dionysus69: how would you make this shorter? I just want to see what can be done in general.
[11:47:35] sonOfRa: has joined #ruby
[11:48:01] nowhere_man: has joined #ruby
[11:48:26] jameswatling: has joined #ruby
[11:50:05] dminuoso: dionysus69: you wouldn't.
[11:50:08] dminuoso: dionysus69: The issue is you.
[11:50:16] dminuoso: dionysus69: You think that if rubocop tells you something you have to fix it.
[11:50:38] catbusters: has joined #ruby
[11:50:47] dminuoso: dionysus69: Disable the cop using # rubocop:disable ThatStupidRule
[11:50:47] dionysus69: I haven't written that method :P google did, I just wanted to know how I would refactor it if I wanted to
[11:51:01] dminuoso: dionysus69: Rules are meant to find code smells.
[11:51:04] dminuoso: Some code smells are not issues.
[11:51:06] dminuoso: They just smell.
[11:51:24] dminuoso: But sometimes engine oil smells, that's not proof of it being bad.
[11:51:36] dionysus69: ok ok, I know how to disable it, I just wanted to know if it was possible to make it shorter :P :) I guess it is but I didnt want to do it an uglier way than it is
[11:52:10] dminuoso: dionysus69: I would do only one thing. restructure the if block to say:
[11:52:16] bheesham: has joined #ruby
[11:52:33] dminuoso: if !credentials.nil?; return credentials; end;
[11:53:23] dionysus69: the idea is that the rest wouldnt have to be parsed by the interpreter?
[11:53:24] dminuoso: or I guess you could go straight if credentials (depending on whether `true' is a possibility)
[11:53:43] anisha_: has joined #ruby
[11:53:49] dminuoso: dionysus69: I just dislike unnecessary indention. It reduces readability in general.
[11:53:53] workmad3: dionysus69: I'd also explore extracting the fallback OOB auth into a separate method, which would allow you to do `credentials ||= oob_authentication(...)` rather than a big chunk of code in the `if`
[11:54:18] workmad3: dionysus69: and I suspect you'll also a lose a line when you stop hard-coding the user ID
[11:55:58] dionysus69: oh well ye, that user id is irrelevant since i am just building a single user script, won't be part of an app
[11:56:01] dminuoso: dionysus69: And you could create a method that obtains the authorizer which might actually be a good idea.
[11:56:16] workmad3: dionysus69: oh, if it's a script, I wouldn't even bother running rubocop on it
[11:57:06] dminuoso: dionysus69: The other problem is again that particular rule. I think it's the most problematic of them all.
[11:57:22] workmad3: code-style for one-off or isolated scripts is pretty different from code-style for application code...
[11:57:28] dminuoso: dionysus69: If a method is long it's usually an indicator of bad code design, but often you can't "make it shorter" because the problem is a design problem, not a code problem
[11:57:36] DeeJayh: has joined #ruby
[11:58:36] ldnunes: has joined #ruby
[11:58:42] workmad3: dminuoso: hmm... you can normally extract stuff out into helper methods, and then move them around to places where they fit better, which improves the code design... so the warning can be an indicator that you should take a look at it IMO ):
[11:58:56] dionysus69: ok ok thanks allot guys, I learned something new xD
[11:59:15] bkxd: has joined #ruby
[11:59:15] dminuoso: workmad3: Yeah, but as you put it: its just an indicator that something _may_ be off.
[11:59:16] workmad3: so I wouldn't just turn off the rule... I'd consider setting it to a threshold where I'd want to take a look at a method though
[11:59:50] dionysus69: by the end of the day you could just create a module and include it, that will cut down any size method into needed size
[11:59:51] workmad3: dminuoso: heh :) that's true of all rubocop rules
[12:00:24] dminuoso: workmad3: I lint my code to enforce strict conventions and catch bugs. ==/=== in JS for example :P
[12:00:26] workmad3: dionysus69: I prefer to leave the method as is rather than do a crappy hack-job like that to quiet a rubocop warning though
[12:00:29] Jameser: has joined #ruby
[12:00:47] dionysus69: ye I wouldn't bother in this case
[12:00:51] dminuoso: which brings us back to my initial:
[12:00:54] dminuoso: dminuoso | dionysus69: Disable the cop using # rubocop:disable ThatStupidRule
[12:00:57] dionysus69: i just asked out of curiousity
[12:01:05] workmad3: dminuoso: heh :) I wouldn't even disable the rule
[12:01:11] dminuoso: workmad3: For the file
[12:01:16] synthroid: has joined #ruby
[12:01:25] workmad3: dminuoso: because I'd want it to pop up again for that method next time I looked at it, as a reminder to take a look once I know more
[12:01:42] dminuoso: workmad3: If I did that, my eslint would emit thousands of warnings..
[12:01:58] blackmesa: has joined #ruby
[12:02:05] workmad3: I leave the odd bit of 'mess' around when I don't know exactly what I want to clean it up to yet :)
[12:02:24] workmad3: rather than disable the warnings or sweep it under the rug with a hacky workaround to the rule
[12:03:02] workmad3: dminuoso: heh :) I've got rubocop on in codeclimate and I only really pay attention to them in PRs... so I only bother looking at warnings for code I've touched rather than every file on every build
[12:03:19] dminuoso: workmad3: Half my react components have a "// eslint-disable-line react/prefer-stateless-function" for example because there are some edge cases where I cant use stateless components for other reasons.
[12:04:03] dminuoso: Or "// eslint-disable-line func-names" because you can't have anonymous generator functions in JavaScript.. :(
[12:04:38] dminuoso: workmad3: Mmmm. Do you have a custom tweaked config?
[12:04:57] jackrandom: has joined #ruby
[12:05:00] dminuoso: *arrow generator functions I meant btw.
[12:05:08] workmad3: dminuoso: I don't do much JS atm tbh
[12:05:41] workmad3: and I've not got much in the way of tweaked config for rubocop or code-climate in general...
[12:06:02] jameswatling: has joined #ruby
[12:06:44] dminuoso: Oh I just talk about eslint because I barely use actual rubocop, figured it didn't make much difference
[12:06:45] workmad3: it's annoying to keep config synced between the dozen or so repos that my team has to keep on top of, so we tend to stick fairly close to normal :)
[12:06:56] dminuoso: workmad3: git submodules?
[12:07:30] workmad3: (also, while it solves that problem, submodules tend to introduce so many other problems that I never bother with them nowadays :) )
[12:07:32] hashrocket: has joined #ruby
[12:08:07] workmad3: dminuoso: and I only brought up that I don't do much JS because it's relevant for tweaked configs, not for the rest of the discussion :)
[12:09:01] dminuoso: workmad3: Fair enough.
[12:09:08] bernd27: has joined #ruby
[12:09:30] matthewd: Rubocop does have an 'inherit_gem' thing to keep configs in sync
[12:09:49] nobitanobi: has joined #ruby
[12:13:52] burgestrand: has joined #ruby
[12:15:34] bkxd: has joined #ruby
[12:15:35] tvw: has joined #ruby
[12:15:37] andrewhl: has joined #ruby
[12:17:06] hahuang65: has joined #ruby
[12:18:42] Mortomes|Train: has joined #ruby
[12:20:42] dachi: has joined #ruby
[12:22:04] kassav__: has joined #ruby
[12:22:08] Jameser: has joined #ruby
[12:23:11] bernd9000: has joined #ruby
[12:23:18] kube: has joined #ruby
[12:23:31] belmoussaoui_: has joined #ruby
[12:26:19] houhoulis: has joined #ruby
[12:26:30] oborot_: has joined #ruby
[12:30:41] DeeJayh: has joined #ruby
[12:32:19] belmoussaoui: has joined #ruby
[12:32:41] DeeJayh-L: has joined #ruby
[12:33:14] charliesome: has joined #ruby
[12:34:36] dionysus69: `get_spreadsheet_values': wrong number of arguments (given 3, expected 2) (ArgumentError)
[12:34:41] dionysus69: http://www.rubydoc.info/github/google/google-api-ruby-client/Google%2FApis%2FSheetsV4%2FSheetsService%3Aget_spreadsheet_values
[12:35:16] dionysus69: I am passing majorDimension as "ROWS" but it says it cant expect 3 params
[12:35:38] dionysus69: whereas documentation clearly supports the param I am passing
[12:38:19] sonicm_: has joined #ruby
[12:39:17] ResidentBiscuit: has joined #ruby
[12:39:18] t-recx: has joined #ruby
[12:41:17] universa1: dionysus69: your code?
[12:44:49] dionysus69: trying one more thing
[12:45:37] ResidentBiscuit: has joined #ruby
[12:46:00] zepy_aq: has joined #ruby
[12:46:57] ResidentBiscuit: has joined #ruby
[12:49:14] universa1: dionysus69: and?
[12:49:29] dminuoso: Yes please do share.
[12:50:39] xall: has joined #ruby
[12:51:27] ornerymoose: has joined #ruby
[12:55:30] ornerymoose_: has joined #ruby
[12:56:54] yqt: has joined #ruby
[12:57:05] jeffreylevesque: has joined #ruby
[12:58:17] gnufied: has joined #ruby
[13:01:22] yirabbit_: has joined #ruby
[13:05:37] DeeJayh: has joined #ruby
[13:07:24] dionysus69: universa1, dminuoso: sheets_service.get_spreadsheet_values(spreadsheet_id, range, major_dimension: "ROWS")
[13:07:52] dionysus69: I tried once like this majorDimension: "ROWS"
[13:07:52] dminuoso: dionysus69: Which gem version?
[13:08:02] dionysus69: the line i posted works
[13:08:07] dminuoso: dionysus69: Also, you didn't read the documentation clearly :=P
[13:08:21] dionysus69: google-api-client (0.11.2)
[13:08:30] dminuoso: this is so bizarre
[13:08:56] dionysus69: i tried all combinations and finally this worked (spreadsheet_id, range, major_dimension: "ROWS")
[13:09:01] dionysus69: or COLUMNS instead of rows
[13:09:52] matthewd: dionysus69: So the above is code that's working?
[13:10:51] dionysus69: range = "Sheet1!A2:B5"
[13:11:00] dionysus69: status2_response = sheets_service.get_spreadsheet_values(spreadsheet_id, range, major_dimension: "ROWS")
[13:11:31] dionysus69: sheets_service = Google::Apis::SheetsV4::SheetsService.new, also sheets_service needs authorization if it is not public
[13:11:48] dionysus69: sheets_service.authorization = authorize is the method i posted in gist before
[13:12:01] dionysus69: google has great api for ruby too ! enjoy :D
[13:12:58] Bhootrk_: has joined #ruby
[13:13:23] dionysus69: i spent hours to get started since there's no straightforward one place to get started on Oauth authentication, and there are many unknown variables at once when you are starting
[13:13:25] mim1k: has joined #ruby
[13:16:39] insanedreamer: has joined #ruby
[13:18:42] hahuang65: has joined #ruby
[13:25:08] bkxd: has joined #ruby
[13:26:36] DLSteve: has joined #ruby
[13:28:08] Jameser: has joined #ruby
[13:28:27] SteenJobs: has joined #ruby
[13:29:58] dminuoso: dionysus69: Start by understanding how OAuth2 works.
[13:30:01] dminuoso: So you dont have to randomly guess.
[13:30:23] patarr: has joined #ruby
[13:30:31] dminuoso: dionysus69: Which flow are you using?
[13:30:39] dminuoso: (And by "flow" I mean grant type)
[13:31:12] qguv: has joined #ruby
[13:31:36] dminuoso: dionysus69: https://www.digitalocean.com/community/tutorials/an-introduction-to-oauth-2 this is an excellent resource covering the exact terminology, and it talks about all the 4 possible grants.
[13:35:34] Hanna: has joined #ruby
[13:35:44] dionysus69: dminuoso: not sure which one, i think its application
[13:36:17] dionysus69: I am just making a script
[13:36:25] Jameser: has joined #ruby
[13:36:27] dionysus69: for automation
[13:37:23] charliesome: has joined #ruby
[13:38:04] ddffg: has joined #ruby
[13:40:41] insanedreamer: has left #ruby: ()
[13:41:38] dionysus69: i read those 4 grants, I dont really get what those use cases really are anyway xD
[13:42:33] dminuoso: dionysus69: The problem is delegated authorization. How do you have a server A give permission to server B to act on behalf of a user C that owns some data behind server D.
[13:42:53] bronson: has joined #ruby
[13:43:10] dionysus69: ye thats some mind twister
[13:43:47] dionysus69: i have a client pc which needs to read/write to gdoc and google auth needs to authorize that :D thats how I see it :)
[13:43:55] dminuoso: dionysus69: Or from another perspective: A user "dion" wants to give server A permission to access personal information stored on server B, but without giving server "A" a password.
[13:44:17] dminuoso: and OAuth tackles this problem exactly in a way that server A will never receive anything that can be used to cause (much) damage.
[13:44:47] tlaxkit: has joined #ruby
[13:46:32] dminuoso: dionysus69: And OAuth does this by introducing a fourth party, the "OAuth server" which basically hands out some security token that can be used by anyone to gain access to "dions personal information at server B" -> now the grant types describe 4 different ways how that token can be obtained
[13:46:43] dminuoso: With different security perspectives
[13:46:48] dminuoso: Can B be trusted with the password of the user?
[13:47:35] dminuoso: Is the token long lived? Do we need a mechanism to get new tokens without re-doing the whole authentication process?
[13:48:22] dionysus69: I guess oauth is based on RSA architecture, isn't it?
[13:48:28] dminuoso: dionysus69: No.
[13:48:29] DeeJayh: has joined #ruby
[13:48:38] dminuoso: dionysus69: Are you talking about OAuth2 btw?
[13:48:44] dminuoso: Because OAuth2 is significantly different from OAuth1
[13:48:58] dionysus69: I know nothing about either of those
[13:49:09] dminuoso: dionysus69: Then it's probably OAuth2. There's no encryption defined in OAuth2.
[13:49:15] dionysus69: i just know there is secret key and there are access tokens generated acting as passwords :P
[13:49:35] dminuoso: dionysus69: They are just random numbers with no meaning.
[13:50:01] dminuoso: The only thing with meaning is the final "access token", and oauth2 does not define the format of that at all.
[13:50:25] kassav_: has joined #ruby
[13:50:30] dionysus69: for security reasons?
[13:50:35] dminuoso: no, for implementatoin freedom.
[13:50:45] dminuoso: oauth just defines a format and flow *how* tokens are exchanged.
[13:50:49] dminuoso: not what they contain.
[13:51:07] cdg: has joined #ruby
[13:51:13] dminuoso: though for everything except the final access token you just use random numbers
[13:51:19] dionysus69: I ll dive into that sometime I guess, but atm I think just reading google guides is enough for my purposes :D
[13:51:22] dminuoso: the final access token can have various forms, JWT, but random numbers also wor
[13:51:51] dminuoso: dionysus69: And as for encryption, OAuth2 assumes TLS for secrecy for the entire communication.
[13:52:00] dminuoso: Which means OAuth2 has no signature/encryption itself.
[13:52:29] bheesham: has joined #ruby
[13:52:29] dminuoso: And whether your final access token has some (RSA for example) encryption or digital signature is up to you really.
[13:52:46] dionysus69: TLS meaning https right?
[13:53:21] dminuoso: dionysus69: Sure.
[13:53:41] dionysus69: ok, I ll keep that in mind xD for my own deployed apps
[13:54:07] dionysus69: i just started working on some real production project in rails, you ll see me in rails channel allot xD
[13:55:13] dminuoso: dionysus69: the authorization grant is the hardest to grasp. I recommend you wrap your head around the "implicit grant" which is the most natural
[13:55:24] jrafanie: has joined #ruby
[13:55:24] MarkBilk: has joined #ruby
[13:55:42] dionysus69: kk i ll google that thanks ))
[13:56:05] dminuoso: dionysus69: https://alexbilbie.com/images/oauth-grants.svg
[13:56:20] dminuoso: dionysus69: Beyond that, that flow chart describes the choice of which grant to use.
[13:58:01] dviola: has joined #ruby
[13:59:19] dionysus69: I dont know what most of the things mean on that chart :D
[14:00:24] dionysus69: so client credential grant would be used for server to server communication?
[14:02:32] oleo: has joined #ruby
[14:04:47] cdg: has joined #ruby
[14:04:54] griffindy: has joined #ruby
[14:06:47] MarkBilk: has left #ruby: ("Leaving")
[14:06:52] MarkBilk: has joined #ruby
[14:07:08] kristofferR: has joined #ruby
[14:11:28] FastJack: has joined #ruby
[14:14:41] tlaxkit: has joined #ruby
[14:16:13] qguv: has joined #ruby
[14:16:50] User458764: has joined #ruby
[14:19:14] DeeJayh: has joined #ruby
[14:19:26] hahuang65: has joined #ruby
[14:20:02] redaudit: has joined #ruby
[14:20:15] theunraveler: has joined #ruby
[14:21:43] qguv: has joined #ruby
[14:23:12] cdg_: has joined #ruby
[14:24:38] xall: has joined #ruby
[14:26:10] dminuoso: dionysus69: That depends on what you are talking about..
[14:26:22] dminuoso: dionysus69: The right side is server-to-server communication.
[14:26:35] dminuoso: dionysus69: the question is who does the access token belong to? a user? or a machine?
[14:26:41] oborot: has joined #ruby
[14:27:01] dminuoso: And by "user" I mean, is this some interactive scenario with a human person involved?
[14:27:17] dminuoso: if not, then its client credentials grant all the way.
[14:27:40] dionysus69: ye, then i guess i did it the wrong way for my scenario
[14:28:03] dionysus69: i just have a script and I would prefer not to have interactive token granting
[14:28:12] dminuoso: dionysus69: So no user interacts with that script?
[14:28:15] dminuoso: (say through a website)
[14:28:15] dionysus69: but now I am told by the script to go to browser authorize app and get token
[14:28:41] dionysus69: no, this is a standalone one time script to do specific job, will be used by admins only
[14:28:54] dminuoso: That's the main purpose of OAuth2. The client credentials grant doesnt really have anything to do with the concept of delegated authorization, and it's just bolted in for completeness.
[14:29:10] dminuoso: does "by admins" mean each requires a different token?
[14:29:15] dminuoso: or do you have an application-based token?
[14:29:35] dionysus69: no no each copy of the script will be used only by one admin
[14:29:43] dminuoso: right, then client credentials grant.
[14:29:48] dminuoso: or password grant
[14:29:49] dionysus69: other people could use it and they would have to provide their own configuration
[14:29:57] dminuoso: kinda would have to know more to say exactly, but both work
[14:30:18] dionysus69: can you explain to me what happens in those cases?
[14:30:30] dionysus69: atm i have it as I explained, I have to go to browser, authorize and get token
[14:30:43] dionysus69: what happens in client credentials grant case
[14:30:58] dionysus69: does password grant just ask for preset password?
[14:31:31] dminuoso: dionysus69: Right. So basically with client credentials you use clientID + clientSecret
[14:31:45] dionysus69: yep thats what I use too
[14:31:46] dminuoso: dionysus69: And with passwort grant you supply some meaningful username + password. They are kind of the same
[14:32:04] dminuoso: But one is based on identifying a client, the other is based on identifying a person
[14:32:23] dionysus69: https://gist.github.com/anonymous/23fa03621c6999e4f28517d0dda14271
[14:32:55] dionysus69: this is full script, btw i couldnt correctly create body = Google::Apis::SheetsV4::ValueRange.new(values), says wrong number of arguments (given 1, expected 0) (ArgumentError)
[14:33:30] Beams: has joined #ruby
[14:33:41] dionysus69: right now i have client id + client secret but it anyways gives me this interactive browser thing
[14:33:59] dionysus69: I suppose that's not what's supposed to happen in my case
[14:34:10] dionysus69: atm I act as a client and not as a user
[14:34:15] irc4r: has joined #ruby
[14:34:50] centrx: has joined #ruby
[14:35:06] patarr: has joined #ruby
[14:36:40] olivier__: has joined #ruby
[14:38:06] rdavila: has joined #ruby
[14:38:46] banisterfiend: has joined #ruby
[14:39:45] mim1k: has joined #ruby
[14:40:45] tlaxkit: has joined #ruby
[14:42:42] nickman5050: has joined #ruby
[14:42:46] tgragnato: has joined #ruby
[14:43:59] b0mbnet: has joined #ruby
[14:44:57] chouhoulis: has joined #ruby
[14:45:53] slackR: has joined #ruby
[14:49:15] DeeJayh: has joined #ruby
[14:53:07] jackrandom: has joined #ruby
[14:54:01] nickman5050: do anyone knows of any sites teaching people about ruby on msfconsole or meatsploit
[14:54:10] irc4r: has joined #ruby
[14:54:21] nickman5050: like the modules or exploits used in them
[14:54:35] rippa: has joined #ruby
[14:54:41] havenwood: ?metasploit nickman5050
[14:54:41] ruby[bot]: nickman5050: Please join #metasploit for help with it.
[14:55:20] nickman5050: alright thanks
[14:55:28] havenwood: nickman5050: If you'd like to learn Ruby, this is a good place.
[14:58:14] AlexRussia: has joined #ruby
[14:58:45] nickman5050: alright I now I can just type this on google but do u know like a good site to learn ruby from your perspective
[15:00:25] patarr1: has joined #ruby
[15:01:29] cschneid_: has joined #ruby
[15:02:10] havenwood: nickman5050: Here are some links: https://ruby-community.com/pages/links
[15:02:41] havenwood: nickman5050: And some more links: https://www.ruby-lang.org/en/documentation/
[15:03:05] havenwood: nickman5050: Maybe give tryruby.org a try to get started then move onto rubymonk.com and then a book.
[15:03:36] irc4r: has joined #ruby
[15:05:52] SteenJobs: has joined #ruby
[15:08:26] kurajber: has joined #ruby
[15:08:26] kurajber: has joined #ruby
[15:12:17] sepp2k: has joined #ruby
[15:14:03] jgnagy: has joined #ruby
[15:14:34] sds_: has joined #ruby
[15:19:24] DeeJayh: has joined #ruby
[15:20:10] hahuang65: has joined #ruby
[15:21:35] hobodave: has joined #ruby
[15:24:55] uZiel: has joined #ruby
[15:25:20] ResidentBiscuit: has joined #ruby
[15:25:46] ResidentBiscuit: has joined #ruby
[15:26:06] al2o3-cr: has joined #ruby
[15:26:18] rkazak: has joined #ruby
[15:28:10] ascarter: has joined #ruby
[15:29:41] ahrs: has joined #ruby
[15:31:18] psychicist__: has joined #ruby
[15:33:46] bmurt: has joined #ruby
[15:37:26] nadir: has joined #ruby
[15:37:26] mikecmpbll: has joined #ruby
[15:37:31] _joes__: has joined #ruby
[15:41:06] SteenJobs: has joined #ruby
[15:41:40] jrafanie: has joined #ruby
[15:42:15] ResidentBiscuit: has joined #ruby
[15:42:33] blackmesa: has joined #ruby
[15:43:54] bronson: has joined #ruby
[15:44:54] railswebdev: has joined #ruby
[15:49:52] troulouliou_dev2: has joined #ruby
[15:50:57] LightStalker: has joined #ruby
[15:51:19] Lord_of_Life: has joined #ruby
[15:51:19] Lord_of_Life: has joined #ruby
[15:51:31] troulouliou_dev2: hi in ruby the if expression will be always executed in order of declaration ? for intsance => unless myarray.empty? and myarray[0].length > 0 then ... will never fail ?
[15:51:43] [Butch]: has joined #ruby
[15:52:06] Papierkorb: troulouliou_dev2: don't use `and`, use `&&`
[15:52:09] raspado: has joined #ruby
[15:52:45] bheesham: has joined #ruby
[15:53:09] Papierkorb: troulouliou_dev2: And you already ran into a trap with unless, which is why you shouldn't use unless with complex conditions. unless x == if !(x).
[15:53:32] Papierkorb: `if !ary.empty? && ary.first.size > 0` is what you intended.
[15:53:55] troulouliou_dev2: Papierkorb, ok yuo kinf of figured out my issue :) thanks
[15:54:20] kassav__: has joined #ruby
[15:54:43] polishdub: has joined #ruby
[15:56:39] mim1k: has joined #ruby
[15:57:59] nobitanobi: has joined #ruby
[15:58:35] bkxd: has joined #ruby
[16:00:01] synthroid: has joined #ruby
[16:03:41] bkxd: has joined #ruby
[16:06:22] rakm: has joined #ruby
[16:13:17] banisterfiend: has joined #ruby
[16:14:00] shinnya: has joined #ruby
[16:14:01] tgragnato: has joined #ruby
[16:15:45] nitric: has joined #ruby
[16:17:58] uZiel: has joined #ruby
[16:19:39] armyriad: has joined #ruby
[16:20:58] hahuang65: has joined #ruby
[16:21:18] mim1k: has joined #ruby
[16:22:18] brent__: has joined #ruby
[16:24:21] robouk: has joined #ruby
[16:25:13] hobodave: has joined #ruby
[16:26:01] uZiel: has joined #ruby
[16:26:13] blackmesa: has joined #ruby
[16:26:54] oborot_: has joined #ruby
[16:28:08] skweek: has joined #ruby
[16:28:21] haylon: has joined #ruby
[16:31:50] patarr: has joined #ruby
[16:33:49] boringcpg: has joined #ruby
[16:35:20] boombox_: has joined #ruby
[16:36:44] haylon: has joined #ruby
[16:37:18] synstack: has joined #ruby
[16:37:18] synstack: has joined #ruby
[16:37:41] Uranio: has joined #ruby
[16:37:42] centrx: has joined #ruby
[16:37:43] centrx: has joined #ruby
[16:37:52] Uranio: has left #ruby: ()
[16:38:35] uZiel: has joined #ruby
[16:40:14] rgr_: has joined #ruby
[16:40:18] rkazak: has joined #ruby
[16:41:36] TomyLobo: has joined #ruby
[16:49:47] DarkBushido: has joined #ruby
[16:49:48] DarkBushido: has joined #ruby
[16:51:02] Cesariox: has joined #ruby
[16:51:42] nobitanobi: has joined #ruby
[16:51:53] hahuang65: has joined #ruby
[16:52:35] nobitanobi: has joined #ruby
[16:52:51] enterprisey: has joined #ruby
[16:56:07] banisterfiend: has joined #ruby
[17:05:10] patarr: has joined #ruby
[17:06:21] gusrub: has joined #ruby
[17:06:56] jameswatling: has joined #ruby
[17:08:54] eightlimbed: has joined #ruby
[17:11:30] Silthias: has left #ruby: ()
[17:12:34] eckhardt: has joined #ruby
[17:13:15] boringcp1: has joined #ruby
[17:13:19] Kero: has joined #ruby
[17:13:29] pankaj: has joined #ruby
[17:13:49] skweek: has joined #ruby
[17:13:57] jackrandom: has joined #ruby
[17:14:14] eam: is this kind of hack-around still necessary to avoid spawning a shell on exec? https://gist.github.com/eam/b70f2e5ae118808f157c
[17:14:37] Truenigma_Work: has joined #ruby
[17:21:10] havenwood: eam: Hrm, if you don't care about the argv[0] value in the process listings: Kernel.exec *Shellwords.split(cmd_string)
[17:23:08] havenwood: >> Kernel.exec *Shellwords.split('echo hello *') #>> hello *
[17:23:09] ruby[bot]: havenwood: # => uninitialized constant Shellwords (NameError) ...check link for more (https://eval.in/802956)
[17:23:27] havenwood: (Of course that triggers bot, I need coffee.)
[17:24:32] jackrandom: has joined #ruby
[17:24:42] eam: havenwood: ah, what I have is an already-tokenized array and I want to prevent any interpretation of it
[17:25:08] havenwood: eam: ah, gotcha
[17:25:30] eam: that stuff above is necessary to prevent exec from deciding to pass a single arg command, say "/bin/program with whitespace in name" through a shell
[17:26:21] havenwood: are you stripping meta characters, or there just aren't any?
[17:26:39] oborot: has joined #ruby
[17:26:39] eam: there may be some, I don't want them interpreted
[17:26:46] eam: so a file called "/bin/*" should be fine
[17:27:36] eam: I'm currently copying this little method around and I was kinda hoping someone could tell me "nah ruby can call exec without invoking a shell easily now"
[17:27:50] volty: has joined #ruby
[17:28:06] havenwood: even if it's the single argument style it should be no shell if there are no meta chars, shell reserved words or builtins
[17:28:18] eam: yeah, but there might be
[17:28:29] havenwood: i don't think they've added an option flag for forcing no shell ;-(
[17:28:45] eam: and I believe even if a metachar doesn't invoke a shell it will still tokenize
[17:28:50] eam: ruby's pretend-shell thing
[17:29:40] patarr: has joined #ruby
[17:29:57] eam: avoiding unnecessary shells and being explicit about process args is one of the standards I tend to carry
[17:30:19] havenwood: they support a variety of options documented in Kernel#spawn, but just use arg magic afaik for shell use/non-use
[17:30:34] havenwood: it'd sure be a nice option to be abel to enforce
[17:31:08] eam: the above works, it's just a bit clunky and I end up pulling it into everything
[17:31:09] havenwood: shell: false
[17:31:25] eam: and then folks ask me what the hell it is
[17:31:49] eam: and suddenly I'm explaining some magical ruby behaviors to them :)
[17:32:39] swills: has joined #ruby
[17:33:08] havenwood: and then fun with builtins where shell is invoked in OS with the builtin but not in say Windows
[17:33:14] nowhere_man: has joined #ruby
[17:33:20] havenwood: very unpredicatable
[17:33:38] baweaver: FAKE SHELLS
[17:34:51] User458764: has joined #ruby
[17:36:04] havenwood: alias cat="unalias cat && echo \"=^.^=\""
[17:36:47] stormbytes: has joined #ruby
[17:37:01] jrafanie: has joined #ruby
[17:38:18] __Yiota: has joined #ruby
[17:42:03] dmtd: has joined #ruby
[17:44:42] eightlimbed: a = ["albatross", "dog", "horse"] ........... a.max => "horse"
[17:45:02] bronson: has joined #ruby
[17:45:20] eightlimbed: b = ["hoqq", "bbllkw", "oox", "ejjuyyy", "plmiis", "xxxzgpsssa", "xxwwkktt", "znnnnfqknaz", "qqquuhii", "dvvvwz"] ...... b.max => "znnnnnfgknaz"
[17:45:46] eightlimbed: in ruby-doc it says .max returns the object of greatest value
[17:46:07] eightlimbed: in an array of strings, shouldn't it always be the last element in the array?
[17:46:46] havenwood: >> 'z' > 'a'
[17:46:47] ruby[bot]: havenwood: # => true (https://eval.in/802965)
[17:46:51] eightlimbed: just realized it's returning the object with the greatest letter
[17:46:53] baweaver: ding ding ding
[17:47:03] baweaver: lexical sort
[17:47:26] baweaver: >> %w(z bb aaaa).max(&:length)
[17:47:27] ruby[bot]: baweaver: # => wrong number of arguments (given 1, expected 0) (ArgumentError) ...check link for more (https://eval.in/802966)
[17:47:38] baweaver: &ri Enumerable#max
[17:47:38] `derpy: http://ruby-doc.org/core-2.4.1/Enumerable.html#method-i-max
[17:47:47] belmoussaoui: has joined #ruby
[17:47:55] eightlimbed: sorry to bother
[17:47:58] baweaver: >> %w(z bb aaaa).max_by(&:length)
[17:47:59] ruby[bot]: baweaver: # => "aaaa" (https://eval.in/802967)
[17:48:15] eightlimbed: havenwood: hey man! :)
[17:48:42] havenwood: eightlimbed: hi!
[17:49:30] ur5us: has joined #ruby
[17:50:08] belmoussaoui_: has joined #ruby
[17:51:07] rkazak: has joined #ruby
[17:51:09] centrx: has joined #ruby
[17:53:01] bheesham: has joined #ruby
[17:53:18] alazred: has joined #ruby
[17:53:19] alazred: has joined #ruby
[17:55:46] benlieb: has joined #ruby
[17:56:03] robouk: has joined #ruby
[17:57:37] dionysus69: has joined #ruby
[17:59:04] robouk: has joined #ruby
[17:59:11] blackmesa: has joined #ruby
[18:01:44] yogg-saron: has joined #ruby
[18:01:49] SeepingN: has joined #ruby
[18:01:59] hobodave_: has joined #ruby
[18:01:59] robouk: has joined #ruby
[18:03:11] jameswatling: has joined #ruby
[18:04:19] jrafanie_: has joined #ruby
[18:04:28] rkazak: has joined #ruby
[18:06:12] TreyG: has joined #ruby
[18:08:04] robouk: has joined #ruby
[18:08:54] velocity64: has joined #ruby
[18:10:24] belmoussaoui_: has joined #ruby
[18:10:27] mtkd: has joined #ruby
[18:12:19] haylon: has joined #ruby
[18:12:50] NapoleonWils0n: has joined #ruby
[18:13:20] NapoleonWils0n: im having an issue with rack
[18:13:38] NapoleonWils0n: i had this code in my config file for rack 1.9
[18:13:40] NapoleonWils0n: __DIR__ = File.expand_path(File.dirname(__FILE__))
[18:13:49] Kero: has left #ruby: ("bye")
[18:14:07] NapoleonWils0n: but it no longer works with rack 2, keeps complaining about expecting 4 arguments but recieving 2 args
[18:14:20] SeepingN: quote your paths
[18:14:28] SeepingN: wait that won't matter here
[18:14:44] SeepingN: that's very odd... which part is expecting _4_ arguments?
[18:14:57] NapoleonWils0n: i think its the code above
[18:15:04] SeepingN: `basename __FILE__` ? :)
[18:15:10] jphase: has joined #ruby
[18:15:21] NapoleonWils0n: this is my config file
[18:15:23] NapoleonWils0n: https://github.com/NapoleonWils0n/cerberus/blob/master/gollum-wiki/server/config.ru
[18:15:49] NapoleonWils0n: worked fine with ruby 1.9 but not newer ruby
[18:15:58] belmoussaoui: has joined #ruby
[18:16:14] Nahra: has joined #ruby
[18:17:10] centrx: has joined #ruby
[18:18:12] cjohnson: has joined #ruby
[18:18:44] cjohnson: I'm coming from JS and PHP and just started a new job doing ruby, wondering if anybody has any recommended first readings. I've gotten metaprogramming ruby 2 so far
[18:18:54] tgragnato: has joined #ruby
[18:18:56] cjohnson: Also what's the modern way to bootstrap a ruby env? in JS it's nvm to install node/npm
[18:18:58] havenwood: cjohnson: Here's a list of books: https://gist.github.com/baweaver/57a7c8296ca2c03effbd8fac1e7f6b40
[18:18:59] baweaver: you're in my realm now
[18:19:01] cjohnson: hey baweaver
[18:19:04] cjohnson: thanks havenwood
[18:19:04] baweaver: ACTION laughs maniacally
[18:19:36] havenwood: cjohnson: Ruby ships with RubyGems. It provides the `gem` command.
[18:19:40] SeepingN: works here on 2.0.0
[18:19:45] havenwood: cjohnson: gem install blarg
[18:19:55] cjohnson: Is the gem/ruby install that comes on OS X pretty up to date?
[18:20:02] havenwood: cjohnson: Some of the Ruby stdlib ships with Ruby as gems.
[18:20:04] cjohnson: I know using the built in tooling in some linux distros leaves you well behind
[18:20:17] baweaver: http://ryanbigg.com/2015/06/mac-os-x-ruby-ruby-install-chruby-and-you
[18:20:36] baweaver: That'll take you through most of it
[18:20:39] havenwood: cjohnson: While the Ruby that ships with macOS is useable, you're better off with latest stable Ruby from ruby-install ^
[18:20:49] havenwood: Now that's in my realm! :)
[18:20:51] baweaver: including Rails setup
[18:20:52] centrx: has joined #ruby
[18:21:34] cjohnson: cool so chruby is sorta like nvm
[18:21:40] cjohnson: install several versions and switch between them
[18:21:41] NapoleonWils0n: if you use a mac be ready for everything to break with any update
[18:21:57] cjohnson: I intend to ultimately run this stuff in a linux VM but for the time being I'm keeping it on the mac
[18:22:12] NapoleonWils0n: macs where good about 10 years ago
[18:22:15] baweaver: http://ryanbigg.com/2014/10/ubuntu-ruby-ruby-install-chruby-and-you
[18:22:19] haylon: has joined #ruby
[18:22:40] baweaver: Radar keeps them updated
[18:22:44] havenwood: cjohnson: Yup, chruby lets you switch between various versions and implementations of Ruby by setting a few environment variables like RUBY_ROOT, GEM_HOME, GEM_PATH, etc and putting Ruby and gem bins in PATH.
[18:23:04] SeepingN: better than rvm?
[18:23:07] havenwood: It's the simplest thing that can possibly work.
[18:23:08] ruby[bot]: Pry, the better IRB, provides easy object inspection `ls`, `history`, viewing docs `?`, viewing source `$`, syntax highlighting and other features (see `help` for more). Put `binding.pry` in your source code for easy debugging. Install Pry (https://pryrepl.org/): gem install pry pry-doc
[18:23:20] cjohnson: I'm a pretty experienced dev and I've got familiarity with perl, php, js, a little python. Am I ok skipping to the "advanced" section of this list of books?
[18:23:21] baweaver: You'll want to poke around into that one too
[18:23:33] baweaver: Read over Eloquent Ruby
[18:23:42] baweaver: It's basically how to Ruby like a Rubyist
[18:23:45] havenwood: SeepingN: RVM is tens of thousands of lines of shell, while chruby is about a hundred.
[18:23:46] havenwood: SeepingN: They are different scopes of things.
[18:24:06] baweaver: cjohnson: Anything specific you want to learn?
[18:24:10] nicesignal: has joined #ruby
[18:24:49] havenwood: cjohnson: Then most folk use a Gemfile for managing deps. You run `bundle` to create a Gemfile.lock from your Gemfile. The Gemfile.lock gets checked into version control and gets everyone on the exact same versions of gem dependencies and their deps.
[18:25:10] baweaver: It's like an actually useful npm shrinkwrap
[18:25:17] cjohnson: baweaver: I am still doing HR training for 3 days, I'm sure I'll be back with a lot more specific questions
[18:25:38] cjohnson: in fact I'm due for another training meeting ha
[18:25:43] havenwood: cjohnson: It's like how Yarn handles deps.
[18:25:43] cjohnson: Thanks for getting me started everybody
[18:25:50] cjohnson: cool, seems straight forward
[18:25:56] havenwood: cjohnson: (Yarn was written by some of the folk that wrote Bundler.)
[18:26:12] baweaver: off to lunch for me
[18:26:49] patarr1: has joined #ruby
[18:27:11] polishdub: has joined #ruby
[18:29:27] meow: has joined #ruby
[18:29:47] milardovich: has joined #ruby
[18:29:59] belmoussaoui: has joined #ruby
[18:31:08] dionysus69: nokogiri can't get utf-8 text
[18:32:31] dionysus69: ok that was easy
[18:34:06] sonicm: has joined #ruby
[18:34:22] yirabbit_: has joined #ruby
[18:34:56] sonicm: has joined #ruby
[18:39:31] marlinc: has joined #ruby
[18:42:06] sonOfRa: has joined #ruby
[18:43:19] bheesham: has joined #ruby
[18:43:27] dminuoso: There's nothing nokogiri cant do.
[18:43:38] dminuoso: We use nokogiri for big data even.
[18:43:54] dionysus69: :) dminuoso i just got started with it
[18:44:03] dionysus69: it's awesome !
[18:44:18] dminuoso: nokogiri is our go-to solution for activation functions in deep neural networks too.
[18:44:21] dionysus69: I guess it would be used for parsing xml resource api too right?
[18:44:31] dminuoso: Nothing cant not be solved with nokogiri.
[18:44:45] dionysus69: can it be used for json?
[18:45:01] dionysus69: i have project coming up where i might need to consume json with rails
[18:45:11] belmoussaoui: has joined #ruby
[18:45:26] dionysus69: parsing json I mean, I can see it can parse html and xml
[18:46:08] dminuoso: That's because html and xml are very similar.
[18:46:29] dminuoso: To parse json Ruby has this for you
[18:46:32] `derpy: http://ruby-doc.org/stdlib-2.4.1/libdoc/json/rdoc/JSON.html
[18:46:43] dminuoso: Built right into Ruby itself.
[18:47:01] dionysus69: json parsing lib called json
[18:47:07] dminuoso: Who would have guessed.
[18:47:08] dionysus69: that's why i love ruby xD
[18:47:16] dminuoso: dionysus69: It can not only parse json, but it can also generate JSON!
[18:47:26] dionysus69: I think I have done that
[18:47:31] dionysus69: but never realized what i was using
[18:47:32] dminuoso: It mixes into all the common classes..
[18:47:36] dminuoso: >> {a:1}.to_json
[18:47:37] ruby[bot]: dminuoso: # => undefined method `to_json' for {:a=>1}:Hash ...check link for more (https://eval.in/802995)
[18:47:42] dminuoso: >> require 'json'; {a:1}.to_json
[18:47:43] ruby[bot]: dminuoso: # => "{\"a\":1}" (https://eval.in/802996)
[18:47:47] elomatreb: Can nokogori parse JSON though
[18:48:07] dminuoso: elomatreb: Im sure that nokogiri is turing complete!
[18:48:20] dminuoso: Oh regarding that..
[18:48:28] dionysus69: well as i understand nokogiri can handle tag based structures
[18:48:31] dminuoso: elomatreb: Have you seen this? https://www.youtube.com/watch?v=uNjxe8ShM-8
[18:48:41] gnufied: has joined #ruby
[18:48:43] dminuoso: This is not a joke by the way. :-)
[18:48:52] elomatreb: Yeah, that ones good
[18:49:09] elomatreb: There is a similar paper that showed that Java Generics are turing complete
[18:49:33] dminuoso: Same research has been done on C++ templates
[18:49:43] dminuoso: elomatreb: How do Java Generics achieve output? Compiler warnings/errors?
[18:50:35] dionysus69: dminuoso: since you seem to be experienced with nokogiri I ll ask you that too, what about SPA generated html? nokogiri can't see it :S
[18:50:42] elomatreb: Don't remember, at the time I didn't even know Java
[18:51:18] belmoussaoui: has joined #ruby
[18:53:15] nobitanobi: has joined #ruby
[18:54:38] dminuoso: dionysus69: I do not understand your question.
[18:56:09] dionysus69: dminuoso: i meant spa as in single page application
[18:56:14] dionysus69: react for example
[18:56:41] elomatreb: It would need to execute the JS for that
[18:56:56] dionysus69: so what workaround can I use for this?
[18:57:02] dminuoso: I do not understand your question.
[18:57:07] al2o3-cr: any of you tried ox gem
[18:57:08] dionysus69: because I really really need to get text out of that
[18:57:16] dminuoso: dionysus69: Start making sense real fast.
[18:57:17] elomatreb: You want a headless browser probably
[18:57:51] dionysus69: dminuoso: I am on khan academy and it uses react apparently, most of the page html is generated client side
[18:58:02] dminuoso: dionysus69: Yes. So?
[18:58:18] dionysus69: so nokogiri can't parse ungenerated html so i am wondering how do i make it generate and then parse xD
[18:58:34] dminuoso: to draw a picture
[18:58:39] dminuoso: of either an elephant, or your problem
[18:59:07] dminuoso: use crayons or chalk if your street is big enough.
[18:59:17] dionysus69: well client side needs to generate html right, in single page app
[18:59:33] dminuoso: We have established that I understood the SPA part because I didnt make fun of you until then.
[18:59:47] elomatreb: It does this by executing Javascript. Nokogiri is just a parser that looks at HTML, it doesn't know about Javascript
[19:00:02] dminuoso: Where do you want to run this nokogiri and why?
[19:00:16] dminuoso: And crayon picture please!
[19:00:26] dionysus69: yes so there's no workaround it? what if I make it render javascript if it's possible
[19:00:48] dionysus69: it will run from a client computer, part of a larger automation script :P
[19:00:51] dminuoso: Is there any more confusing way in that made any less sense?
[19:00:54] elomatreb: Once you glue executing Javascript on top of a HTML parser you basically built a browser
[19:01:00] dminuoso: elomatreb: How do you make any sense of that..
[19:01:05] dminuoso: This to me is pure gibberish
[19:01:16] elomatreb: I think they want to extract data from a React app page
[19:01:24] dminuoso: dionysus69: plug a template into your recursive algorithm.
[19:01:37] dionysus69: ye come on dminuoso i didnt really ask anything that weird :D
[19:01:43] dminuoso: dionysus69: no you did.
[19:01:53] dminuoso: until the SPA part everything is fine
[19:01:57] dminuoso: then you suddenly talk about nokogiri
[19:02:05] dminuoso: and rendering javascript
[19:02:17] dionysus69: ye, i am trying to parse a page with js rendering html
[19:02:32] dionysus69: by now i get that nokogiri can't do that :D
[19:02:32] dminuoso: dionysus69: Where does the ruby code run?
[19:02:37] dminuoso: client side? server side?
[19:02:39] dionysus69: so I am asking is it even possible ? :D
[19:02:52] dminuoso: sure it's possible.
[19:03:13] dionysus69: oh wait what do you mean?
[19:03:27] dminuoso: Use your mouse towards that thing that says "File" (or whatever that means in Russian), click on "Save Page As..." (or equivalent) ...
[19:03:29] dionysus69: what do you mean by ruby code running on client side?
[19:03:35] dminuoso: What do I mean?
[19:03:47] dionysus69: i am not russian wtf
[19:04:12] eckhardt: has joined #ruby
[19:04:15] dminuoso: Must have confused you with someone else
[19:04:27] dionysus69: dunno where you got that from lol :D...
[19:04:38] eelster: has joined #ruby
[19:04:52] dionysus69: i cant do that for every page of the side right
[19:04:58] dionysus69: meaning, saving page as :D
[19:05:11] dionysus69: so is there no other way?
[19:06:17] eelster: has joined #ruby
[19:06:35] mim1k: has joined #ruby
[19:08:43] ozzy3: has joined #ruby
[19:09:33] eelster: has joined #ruby
[19:10:18] dminuoso: dionysus69: Beyond me how elomatreb made any sense of that..
[19:10:32] dminuoso: elomatreb | You want a headless browser probably
[19:10:40] eckhardt: has joined #ruby
[19:10:42] dminuoso: PhantomJS probably
[19:10:59] elomatreb: Chrome recently got an official headless mode, I haven't tried it though
[19:11:17] dminuoso: elomatreb: hats off.
[19:12:40] ecuanaso: has joined #ruby
[19:13:22] dionysus69: what do you mean
[19:13:37] bheesham: has joined #ruby
[19:13:55] SeepingN: who needs the GUI part of Chrome anyway!
[19:13:59] dionysus69: so from whichever pc I am running this, i make a page call, render the page into headless browser, generate full page and then parse with nokogiri?
[19:14:26] dminuoso: Back to not making sense again.
[19:14:32] dminuoso: Need more elomatreb
[19:14:46] SeepingN: have you missed the existence of things like curl and lynx/links/whatever
[19:14:47] gusrub: has joined #ruby
[19:15:08] dionysus69: what does headless browser let me do, perhaps save a fully generated html of an spa page right?
[19:15:11] govg: has joined #ruby
[19:15:15] dminuoso: SeepingN: Have you missed the existence of things like curl and lynx/links/whatever that are ES5+ compatible and support the full HTML5 API?
[19:15:27] dionysus69: so I would later use nokogiri to parse that html
[19:15:38] dminuoso: dionysus69: A headless browser lets you do anything a normal browser does.
[19:15:49] dminuoso: It's a browser without a head (the visualization/rendering)
[19:16:03] dionysus69: i dont understand implication of that
[19:16:13] dminuoso: Oh, it has an API instead.
[19:16:18] dminuoso: To interact with the browser.
[19:16:25] dionysus69: yes I would assume that
[19:16:39] jenrzzz: has joined #ruby
[19:16:39] jenrzzz: has joined #ruby
[19:16:47] SeepingN: sounds like the page you're interacting with needs an API ;)
[19:16:53] dminuoso: dionysus69: What is your goal?
[19:16:53] dionysus69: so i am guessing, in that case I wouldn't need nokogiri at all?
[19:16:59] ruby[bot]: it seems like you are asking for a specific solution to a problem, instead of asking about your problem. This often leads to bad solutions and increases frustration for you and those trying to help you. More: http://meta.stackexchange.com/a/66378
[19:17:14] ruby[bot]: it seems like you are asking for a specific solution to a problem, instead of asking about your problem. This often leads to bad solutions and increases frustration for you and those trying to help you. More: http://meta.stackexchange.com/a/66378
[19:17:28] dionysus69: i am trying to get a text from specific html tag on a page which is rendered client side
[19:17:32] mim1k: has joined #ruby
[19:17:55] SeepingN: such secrets
[19:17:57] dminuoso: dionysus69: Is this your SPA?
[19:18:20] dionysus69: it is khanacademy
[19:18:29] gizmore: has joined #ruby
[19:18:38] dionysus69: if it were mine i guess the solution would be simpler
[19:19:30] mtkd: has joined #ruby
[19:20:03] dminuoso: 21:16:03 dionysus69 | i dont understand implication of that │ akkad
[19:21:12] gusrub: has joined #ruby
[19:22:10] dionysus69: dminuoso: why didnt you mention curl in a more straightforward way lol
[19:22:17] PatrikasZvaigzde: has joined #ruby
[19:22:36] dminuoso: dionysus69: Talking about headless browsers.
[19:22:44] haylon: has joined #ruby
[19:22:52] dionysus69: well i didnt know curl was one at all
[19:23:06] dminuoso: That chrome thing
[19:23:17] dionysus69: ye fine but curl did the job too
[19:23:26] dionysus69: it just got full html
[19:23:31] dionysus69: including the one that is client side
[19:24:03] al2o3-cr: dionysus69: what curl command did you run?
[19:24:17] haylon: has joined #ruby
[19:24:48] dionysus69: i forgive you all for making fun of me all this time
[19:24:54] dionysus69: curl --get "https://khanacademy.org/math/algebra2/rational-expressions-equations-and-functions/adding-and-subtracting-rational-expressions/v/adding-and-subtracting-rational-expressions-with-like-denominators"
[19:25:18] brent__: has joined #ruby
[19:25:20] belmoussaoui: has joined #ruby
[19:25:25] al2o3-cr: a simple get request?
[19:25:40] olivier__: has joined #ruby
[19:25:53] dionysus69: yep and it got full data back
[19:25:55] SeepingN: curl -o http://some.server.com/page.html | sed 's/<div (.*)>/\1/p`
[19:26:08] olivier__: has joined #ruby
[19:26:13] SeepingN: wtf does "got full data back" mean?
[19:26:42] dionysus69: including data that doesnt show up at ctrl + U in browser
[19:26:44] SeepingN: 301 moved. have to set it to follow forwarders
[19:29:15] yqt: has joined #ruby
[19:29:16] jamesaxl: has joined #ruby
[19:30:05] SeepingN: curl -L "that long url" then have fun parsing raw source
[19:31:53] dionysus69: can you explain to me the regex you used there?
[19:32:49] dionysus69: I need to get text under h1.someClass
[19:34:27] jenrzzz: has joined #ruby
[19:36:13] havenwood: dionysus69: This is an aside, but tools like httpie, jq and pup are nice for quick command line http/json/html queries.
[19:36:22] havenwood: dionysus69: Consider the following: http --follow 'https://khanacademy.org/math/algebra2/rational-expressions-equations-and-functions/adding-and-subtracting-rational-expressions/v/adding-and-subtracting-rational-expressions-with-like-denominators' | pup 'h1 text{}'
[19:36:34] havenwood: #>> Adding &amp; subtracting rational expressions: like denominators
[19:36:38] patarr: has joined #ruby
[19:36:52] ledestin: has joined #ruby
[19:37:10] havenwood: dionysus69: On macOS you can install them with: brew install httpie jq pup
[19:37:46] dionysus69: you sure I can't do same thing with curl?
[19:37:55] ascarter: has joined #ruby
[19:37:58] SeepingN: xmllint seems to be very popular for this too
[19:38:02] dionysus69: curl is available for windows too and I want to use tools that are cross platform
[19:38:23] curti_: has joined #ruby
[19:38:43] SeepingN: it's hard to use things like grep against html since it only searches 1 line at a time
[19:38:53] SeepingN: and nothing says your h1 tag has to fit on 1 line
[19:39:18] havenwood: dionysus69: httpie, jq and pup should all be cross-platform
[19:39:29] jenrzzz_: has joined #ruby
[19:40:09] rkazak: has joined #ruby
[19:40:16] havenwood: dionysus69: (written in Python, C and Go)
[19:40:30] havenwood: Also, WSL! Use eet!
[19:40:37] havenwood: Windows Subsystem for Linux works great. ;-)
[19:41:41] dionysus69: i am building a tool that many people could use
[19:41:51] dionysus69: i should make it as easy to setup as possible
[19:42:00] dionysus69: on as many platforms as possible
[19:42:40] ozzy3: has left #ruby: ()
[19:42:45] dionysus69: with tools that would have higher chances of being backwards compatible
[19:42:55] BTRE: has joined #ruby
[19:42:59] dminuoso: havenwood: Until it doesn't.
[19:43:23] dminuoso: havenwood: From what I hear from the osdev community it's pretty shitty if you want to do kernel development.
[19:43:40] Papierkorb: Someone said osdev?
[19:43:44] havenwood: dminuoso: touche
[19:44:28] ^mtkd: has joined #ruby
[19:44:37] KeyJoo: has joined #ruby
[19:45:03] haylon: has joined #ruby
[19:46:05] bronson: has joined #ruby
[19:47:47] SeepingN: alright, I'll bite. What in the world will this tool-for-the-people do?
[19:48:04] SeepingN: rip off Khan Acadamy?
[19:48:57] dionysus69: auto uploading videos to youtube for those who internationalize khan academy videos
[19:49:29] dionysus69: i am going to be hired by people responsible for georgian language section
[19:49:44] belmoussaoui: has joined #ruby
[19:50:05] dionysus69: it's contributing, instead of ripping off ;)
[19:53:30] kmhn: has joined #ruby
[19:54:57] kmhn: has joined #ruby
[19:55:27] eckhardt: has joined #ruby
[19:59:15] bernd27: has joined #ruby
[19:59:33] gnufied: has joined #ruby
[20:02:45] BTRE: has joined #ruby
[20:03:40] recondite: has joined #ruby
[20:03:56] cdg: has joined #ruby
[20:03:56] jenrzzz: has joined #ruby
[20:04:17] eckhardt: has joined #ruby
[20:05:24] eightlimbed: has joined #ruby
[20:05:33] banisterfiend: has joined #ruby
[20:08:53] kmhn: has joined #ruby
[20:09:06] volty: has joined #ruby
[20:09:29] jrafanie: has joined #ruby
[20:10:10] eckhardt: has joined #ruby
[20:11:04] marr: has joined #ruby
[20:13:10] lxsameer: has joined #ruby
[20:15:31] BTRE: has joined #ruby
[20:16:17] Silox|: has joined #ruby
[20:16:27] potatoe: has joined #ruby
[20:16:29] patarr: has joined #ruby
[20:23:08] qguv: has joined #ruby
[20:23:10] potatoe: has joined #ruby
[20:24:48] ryanong: has joined #ruby
[20:25:06] kmhn: has joined #ruby
[20:27:10] belmoussaoui: has joined #ruby
[20:28:42] jeffreylevesque: has joined #ruby
[20:29:27] ascarter: has joined #ruby
[20:29:37] lacuna: has joined #ruby
[20:32:49] duderonomy: has joined #ruby
[20:34:48] BTRE: has joined #ruby
[20:37:21] cyphase: has joined #ruby
[20:40:01] jrafanie: has joined #ruby
[20:41:32] blackmesa: has joined #ruby
[20:44:28] seraph787: anybody here ever use stackprof with flame graphs? i am getting some weird valleys when io is happening
[20:45:08] jrafanie_: has joined #ruby
[20:45:39] rdavila: has joined #ruby
[20:46:50] skweek: has joined #ruby
[20:51:59] benlieb: has joined #ruby
[20:53:52] milardovich: has joined #ruby
[20:54:16] bernd9000: has joined #ruby
[20:54:51] ruby[bot]: Just ask your question, if anyone has, is or can, they will respond.
[20:54:55] dminuoso: ACTION hits ruby[bot]
[20:55:03] dminuoso: Never does the right (tm) thing.
[20:55:35] blackmesa: has joined #ruby
[20:55:42] dminuoso: seraph787: look at your question and tell me whether someone looking at the channel can provide you with any meaningful insights whatsoever based on what you have given us.
[20:58:51] eckhardt: has joined #ruby
[21:03:19] ur5us: has joined #ruby
[21:03:25] mrconfused: has joined #ruby
[21:04:50] jenrzzz: has joined #ruby
[21:09:05] blackmesa: has joined #ruby
[21:10:57] zachk: has joined #ruby
[21:17:52] sepp2k: has joined #ruby
[21:20:45] jenrzzz: has joined #ruby
[21:20:45] jenrzzz: has joined #ruby
[21:20:53] eckhardt: has joined #ruby
[21:29:49] kumarat9pm: has joined #ruby
[21:30:32] kumarat9pm: has joined #ruby
[21:30:42] havenwood: kumarat9pm: hi
[21:30:54] ascarter: has joined #ruby
[21:31:16] kumarat9pm: I am basically from Python background where if I want to see what methods do a variable have I use dir(var_name) which list all the methods available.
[21:31:35] kumarat9pm: Do ruby have such facility
[21:31:45] postmodern: has joined #ruby
[21:31:48] havenwood: kumarat9pm: In Ruby you can ask an object directly about its methods.
[21:31:57] baweaver: &ri Object#methods
[21:31:57] `derpy: http://ruby-doc.org/core-2.4.1/Object.html#method-i-methods
[21:32:00] Papierkorb: kumarat9pm: `my_variable.methods`
[21:32:08] havenwood: kumarat9pm: It's also popular to use Pry's introspection tools, like: ls
[21:32:11] havenwood: ?pry kumarat9pm
[21:32:11] kumarat9pm: I am curious to know for a variable say var1='xyz', it have var1.class which shows what type of variable it is?
[21:32:14] ruby[bot]: Pry, the better IRB, provides easy object inspection `ls`, `history`, viewing docs `?`, viewing source `$`, syntax highlighting and other features (see `help` for more). Put `binding.pry` in your source code for easy debugging. Install Pry (https://pryrepl.org/): gem install pry pry-doc
[21:32:14] ruby[bot]: kumarat9pm: Pry, the better IRB, provides easy object inspection `ls`, `history`, viewing docs `?`, viewing source `$`, syntax highlighting and other features (see `help` for more). Put `binding.pry` in your source code for easy debugging. Install Pry (https://pryrepl.org/): gem install pry pry-doc
[21:32:33] lucz: has joined #ruby
[21:32:44] kumarat9pm: Papierkorb: Thanks.
[21:32:51] `derpy: http://ruby-doc.org/core-2.4.1/Object.html
[21:32:55] baweaver: Do some reading in there
[21:33:28] havenwood: kumarat9pm: Asking it its class wouldn't tell you what kind of variable. Try using `defined?` like: defined? foo
[21:33:59] havenwood: >> foo = :bar; defined? foo # kumarat9pm
[21:34:00] ruby[bot]: havenwood: # => "local-variable" (https://eval.in/803023)
[21:34:21] al2o3-cr1: has joined #ruby
[21:34:24] havenwood: kumarat9pm: Note that `foo.class` is: Symbol
[21:34:46] havenwood: (`:bar` is a Symbol literal.)
[21:35:20] SeepingN_: has joined #ruby
[21:39:17] fxa: has joined #ruby
[21:39:57] patr0clus: has joined #ruby
[21:40:12] fxa: has joined #ruby
[21:41:48] Vegitto: has joined #ruby
[21:42:47] jrafanie: has joined #ruby
[21:46:13] blackmes1: has joined #ruby
[21:46:59] bronson: has joined #ruby
[21:47:50] ozcanesen: has joined #ruby
[21:47:57] Scriptonaut: has joined #ruby
[21:48:16] Scriptonaut: can someone help me understand this. I can do method(:puts), but why can't I do method(:+) ?
[21:48:46] Scriptonaut: oh, I just realized, I can do 4.method(:+)
[21:49:28] dminuoso: havenwood: There it is again.
[21:49:32] elomatreb: Yep, Object (the default receiver) has no + defined
[21:49:35] dminuoso: That monstreous "defined?"
[21:49:41] dminuoso: It's one of the worst hacks in Ruby..
[21:49:48] dminuoso: How that even works is beyond me,.
[21:50:21] elomatreb: I don't think I've ever seen it in actual code
[21:50:45] elomatreb: Checking for undefined variables feels like PHP
[21:51:00] davidmichaelkarr: has joined #ruby
[21:54:38] kumarat9pm: has joined #ruby
[21:56:13] HoierM: has joined #ruby
[21:56:45] tomphp: has joined #ruby
[21:57:03] ixti: has joined #ruby
[21:57:23] ixti: has joined #ruby
[21:58:57] dminuoso: elomatreb: Do you know how it works?
[21:59:28] elomatreb: No, haven't gotten into Ruby internals yet
[22:00:18] ixti: has joined #ruby
[22:01:16] bronson: has joined #ruby
[22:03:45] ixti: has joined #ruby
[22:06:15] blackmes1: has joined #ruby
[22:13:36] im0nde: has joined #ruby
[22:13:47] kke: has joined #ruby
[22:19:04] jameswatling: has joined #ruby
[22:21:27] robouk: has joined #ruby
[22:22:48] havenwood: whee: https://github.com/ruby/ruby/blob/14a730e91ee6176cc60ba3fc1cd368e47bd2f7b0/iseq.c#L2187-L2225
[22:24:33] Pumukel: has joined #ruby
[22:26:39] mim1k: has joined #ruby
[22:32:54] jusa: has joined #ruby
[22:37:21] brent__: has joined #ruby
[22:39:03] zach_: has joined #ruby
[22:39:24] robouk: has joined #ruby
[22:39:39] ecuanaso: has joined #ruby
[22:41:31] zach_: So there's this nice shortcut where `foos.map { |foo| foo.bar }` can be `foos.map(&:bar)`. But if I want to initialize a Foo object, is there any shorter way to express `foos.map { |foo| Foo.new(foo) }`?
[22:42:34] boringcpg: has joined #ruby
[22:45:02] Scriptonaut: I don't think there's a practical way to pass arguments to that
[22:45:13] Scriptonaut: there is in Crystal, not ruby though
[22:45:32] havenwood: zach_: foos.map &Foo.method(:new)
[22:45:53] baweaver: class Foo; def self.init; -> *args { self.new(args) } end end; foos.map &Foo.init
[22:45:57] havenwood: zach_: no nice way
[22:46:03] baweaver: pretty much
[22:46:43] havenwood: zach_: It's currently best to just use small, straighforward blocks for such cases.
[22:47:10] P4f73k: has joined #ruby
[22:47:19] baweaver: .....havenwood
[22:47:23] baweaver: I just had an evil idea
[22:47:36] Hobbyboy: has joined #ruby
[22:47:38] havenwood: pray telll?
[22:47:41] baweaver: make a gem that monkeypatches object and gives a proc that pipes to new
[22:48:10] Cohedrin: has joined #ruby
[22:48:38] kumarat9pm: has joined #ruby
[22:48:43] kumarat9pm: Hi all, how about getting help on each method of a variable?
[22:48:43] zach_: alright cool, thanks for the sanity!
[22:48:56] baweaver: &ri Enumerable
[22:48:57] `derpy: http://ruby-doc.org/core-2.4.1/Enumerable.html
[22:49:02] baweaver: &ri Array#each
[22:49:03] `derpy: http://ruby-doc.org/core-2.4.1/Array.html#method-i-each
[22:49:15] baweaver: kumarat9pm: might be a good idea to read a basic Ruby book
[22:49:17] havenwood: kumarat9pm: Or Pry will show you the code or docs for a given method with ? or $.
[22:49:22] havenwood: ?pry kumarat9pm
[22:49:22] ruby[bot]: kumarat9pm: Pry, the better IRB, provides easy object inspection `ls`, `history`, viewing docs `?`, viewing source `$`, syntax highlighting and other features (see `help` for more). Put `binding.pry` in your source code for easy debugging. Install Pry (https://pryrepl.org/): gem install pry pry-doc
[22:49:23] kumarat9pm: like pythons help(var1.join())
[22:49:40] havenwood: kumarat9pm: http://pryrepl.org/
[22:49:45] ResidentBiscuit: has joined #ruby
[22:49:55] Scriptonaut: some_var.method(:method_name).methods.sort - methods
[22:50:03] kumarat9pm: Thanks, havenwood.
[22:50:12] Scriptonaut: then you can look at things like arity, etc
[22:50:17] Scriptonaut: find where it's defined
[22:51:28] havenwood: reminds me of: https://bugs.ruby-lang.org/issues/9076
[22:54:51] nobitanobi: has joined #ruby
[22:55:53] ski7777: has joined #ruby
[23:02:01] Dimik: has joined #ruby
[23:14:32] bronson: has joined #ruby
[23:15:38] HoierM: has joined #ruby
[23:18:57] dasher00: has joined #ruby
[23:19:47] ResidentBiscuit: has joined #ruby
[23:26:26] lucz: has joined #ruby
[23:27:35] kies: has joined #ruby
[23:28:49] jackjackdripper: has joined #ruby
[23:29:17] atmosx: has joined #ruby
[23:32:09] railswebdev: has joined #ruby
[23:35:29] gusrub: has joined #ruby
[23:41:13] charliesome: has joined #ruby
[23:45:36] musl: has joined #ruby
[23:47:20] brent__: has joined #ruby
[23:52:21] Hobbyboy: has joined #ruby
[23:59:57] eelster: has joined #ruby