« Back to channel list

#ruby - 19 September 2017

« Back 1 day Forward 1 day »
[00:00:37] jrabe: has joined #ruby
[00:03:15] gr33n7007h: has joined #ruby
[00:06:21] Algebr`: what does the : mean in if os_type == :unix
[00:06:53] SeepingN: getter read Ruby 101 first
[00:06:57] ledestin: has joined #ruby
[00:07:34] guardianx: has joined #ruby
[00:11:16] Algebr`: yea, looking for a good crash course for existing coders
[00:13:17] xco: on lines 6 and 8 i want to refactor, do i store the “raise ….” in a local variable or make it a method? what’s the best approach?
[00:13:23] xco: https://gist.github.com/xcobar/b5495e36efdfdcb994f68cd329be2efd
[00:18:16] brent__: has joined #ruby
[00:23:22] bronson: has joined #ruby
[00:26:51] havenwood: xco: Rails.logger.info '...' if %w(dv tk).include?(target_lang); raise '...'
[00:28:27] roadt: has joined #ruby
[00:30:21] xco: havenwood: something like this i guess https://gist.github.com/xcobar/b5495e36efdfdcb994f68cd329be2efd
[00:30:24] zautomata: has joined #ruby
[00:30:53] havenwood: xco: 👍🏻
[00:31:13] xco: havenwood: :) danke
[00:31:42] havenwood: xco: You can drop the `begin/end`
[00:31:53] havenwood: xco: You can just `rescue` inside a method.
[00:32:05] havenwood: xco: and you can drop the `self.`, if you'd like
[00:32:18] havenwood: #update_attribute will already be called on self
[00:32:43] xco: thank you :)
[00:32:45] havenwood: consider #warn instead of #info
[00:37:25] Azure: has joined #ruby
[00:37:50] vikas027: has joined #ruby
[00:39:07] vikas027: Hey Guys, I am looking for a whole word (my_vpc) in a string like this vpc.tags.join(',')[/\bmy_vpc\b/] . How can I use a variable instead of my_vpc. I tried using "#{some_var}", but that didn't worked
[00:41:10] GodFather: has joined #ruby
[00:48:58] marcux: has joined #ruby
[00:52:56] Slinky_Pete: has joined #ruby
[00:57:26] xco: has joined #ruby
[01:00:21] marcux: has joined #ruby
[01:01:06] A124: has joined #ruby
[01:07:36] GodFather: has joined #ruby
[01:08:34] d^sh: has joined #ruby
[01:09:04] nicesignal: has joined #ruby
[01:13:12] brent__: has joined #ruby
[01:13:31] enterprisey: has joined #ruby
[01:13:55] brent__: has joined #ruby
[01:14:44] SteenJobs: has joined #ruby
[01:15:01] gizmore|2: has joined #ruby
[01:15:20] vikas027: Found it, I wanted this vpc.tags.join(',')[/\b(?:#{some_var})\b/]
[01:15:36] Algebr`: I am getting a "Could not find X in any of the sources"
[01:15:40] astrobunny: has joined #ruby
[01:15:55] Algebr`: Can I fix this by changing GEM_PATH environment variable?
[01:16:30] Algebr`: because BUNDLE_GEMFILE is also set as an env var
[01:19:13] Algebr`: or what can i do to make ruby dump where it is looking for gems?, hopefully something like ruby -e ',.....'
[01:22:08] nicesignal: has joined #ruby
[01:22:19] duckpupp1: has joined #ruby
[01:25:33] Algebr`: I got this error: C:/Users/Edgar Aroutiounian/R4/hello-1.0.0-win32/lib/ruby/lib/ruby/2.1.0/rubygems/core_ext/kernel require': cannot load such file -- fastlane (LoadError). I am wondering if this means the file doesn't exist or if there was an issue in actually loading things into memory
[01:26:03] havenwood: Algebr`: See: gem environment gemdir
[01:26:21] havenwood: Algebr`: gem environment gempath
[01:26:38] havenwood: Algebr`: you mean to be using Ruby 2.1?
[01:26:49] paradisaeidae: has joined #ruby
[01:26:55] paradisaeidae_: has joined #ruby
[01:27:07] havenwood: Algebr`: Check that bundler is installed on the Ruby you mean to be using.
[01:30:56] harai_: has joined #ruby
[01:31:05] BTRE: has joined #ruby
[01:31:09] cdg: has joined #ruby
[01:31:11] charliesome: has joined #ruby
[01:37:57] s2013: has joined #ruby
[01:42:43] jdawgaz: has joined #ruby
[01:43:12] mim1k: has joined #ruby
[01:49:08] xco: has joined #ruby
[01:57:19] jinie: has joined #ruby
[02:04:30] paradisaeidae: has joined #ruby
[02:04:41] paradisaeidae_: has joined #ruby
[02:13:18] ForeignBiscuit: has joined #ruby
[02:13:42] ForeignBiscuit: has joined #ruby
[02:18:29] mkali: has joined #ruby
[02:23:53] marcux: has joined #ruby
[02:23:56] bronson: has joined #ruby
[02:38:17] ur5us: has joined #ruby
[02:43:26] A124: has joined #ruby
[02:45:42] BTRE: has joined #ruby
[02:57:30] xco: has joined #ruby
[02:57:56] A124: has joined #ruby
[03:00:08] cadillac_: has joined #ruby
[03:02:30] s3nd1v0g1us: has joined #ruby
[03:02:39] brent__: has joined #ruby
[03:03:48] marcux: has joined #ruby
[03:11:54] belmoussaoui: has joined #ruby
[03:17:51] uneeb: has joined #ruby
[03:20:36] s2013: has joined #ruby
[03:25:58] orbyt_: has joined #ruby
[03:29:40] sarbs: has joined #ruby
[03:33:47] harfangk: has joined #ruby
[03:35:27] Slinky_Pete: has joined #ruby
[03:37:28] Moosashi: has joined #ruby
[03:38:59] howdoi: has joined #ruby
[03:43:48] mim1k: has joined #ruby
[03:45:07] gix: has joined #ruby
[03:49:10] jdawgaz: has joined #ruby
[03:51:01] uZiel: has joined #ruby
[03:59:46] gothicsouth: has joined #ruby
[04:07:15] eckhardt: has joined #ruby
[04:21:45] krz: has joined #ruby
[04:21:54] marcux: has joined #ruby
[04:25:23] bronson: has joined #ruby
[04:28:14] cadillac_: has joined #ruby
[04:29:36] cagomez: has joined #ruby
[04:31:46] ShekharReddy: has joined #ruby
[04:32:58] Algebr`: has joined #ruby
[04:32:59] kies: has joined #ruby
[04:35:12] eckhardt: has joined #ruby
[04:35:54] cdg: has joined #ruby
[04:36:22] tuelz: has joined #ruby
[04:36:28] JD2020: has joined #ruby
[04:37:12] govg: has joined #ruby
[04:41:35] hahuang65: has joined #ruby
[04:42:04] mim1k: has joined #ruby
[04:54:17] jdawgaz: has joined #ruby
[04:55:07] jdawgaz: has joined #ruby
[04:55:52] jdawgaz: has joined #ruby
[04:56:13] elcontrastador: has joined #ruby
[04:56:34] xco: has joined #ruby
[04:56:41] jdawgaz: has joined #ruby
[04:57:32] jdawgaz: has joined #ruby
[04:58:16] jdawgaz: has joined #ruby
[04:59:04] jdawgaz: has joined #ruby
[04:59:29] hahuang65: has joined #ruby
[04:59:49] xco: has left #ruby: ()
[04:59:54] jdawgaz: has joined #ruby
[05:00:05] moei: has joined #ruby
[05:00:44] jdawgaz: has joined #ruby
[05:01:32] jdawgaz: has joined #ruby
[05:02:16] jdawgaz: has joined #ruby
[05:03:07] jdawgaz: has joined #ruby
[05:03:52] jdawgaz: has joined #ruby
[05:04:47] jdawgaz: has joined #ruby
[05:12:52] Retronoodle: has joined #ruby
[05:16:13] rabajaj: has joined #ruby
[05:17:01] Bock: has joined #ruby
[05:23:19] eckhardt: has joined #ruby
[05:25:10] zautomata: has joined #ruby
[05:41:10] aupadhye: has joined #ruby
[05:43:35] DipoleHourglass: has joined #ruby
[05:46:41] planigan: has joined #ruby
[05:49:26] rabajaj: has joined #ruby
[05:57:58] ur5us: has joined #ruby
[06:03:37] jenrzzz: has joined #ruby
[06:03:37] jenrzzz: has joined #ruby
[06:04:30] harai_: has joined #ruby
[06:05:33] tekacs: has joined #ruby
[06:05:34] epochwolf: has joined #ruby
[06:05:34] universa1: has joined #ruby
[06:05:35] jsrn: has joined #ruby
[06:05:37] j0bk: has joined #ruby
[06:05:37] j0bk: has joined #ruby
[06:05:39] quuxman: has joined #ruby
[06:05:41] matthewd: has joined #ruby
[06:05:41] SHyx0rmZ: has joined #ruby
[06:05:42] [spoiler]: has joined #ruby
[06:05:42] rideh: has joined #ruby
[06:05:42] nchambers: has joined #ruby
[06:05:49] JStoker: has joined #ruby
[06:05:49] EvilJStoker: has joined #ruby
[06:05:51] imode: has joined #ruby
[06:05:51] nickjj: has joined #ruby
[06:05:54] aspiers: has joined #ruby
[06:05:56] al2o3-cr: has joined #ruby
[06:06:00] thejoecarroll: has joined #ruby
[06:06:04] Olipro: has joined #ruby
[06:06:07] zapata: has joined #ruby
[06:06:09] dmnd: has joined #ruby
[06:06:14] Hobbyboy: has joined #ruby
[06:06:17] ckrailo: has joined #ruby
[06:06:23] ewilliam_____: has joined #ruby
[06:06:31] rfv: has joined #ruby
[06:06:33] zipkid: has joined #ruby
[06:06:36] knowtheory: has joined #ruby
[06:06:38] deimos: has joined #ruby
[06:06:39] howdoi: has joined #ruby
[06:06:49] charles81_: has joined #ruby
[06:06:55] jnix: has joined #ruby
[06:07:02] HalcyonicStorm: has joined #ruby
[06:07:09] Apocalypse: has joined #ruby
[06:07:12] Meow-J: has joined #ruby
[06:07:33] voiceftp: has joined #ruby
[06:07:35] Travis-42: has joined #ruby
[06:07:59] Nahra: has joined #ruby
[06:08:22] Dimik: has joined #ruby
[06:10:27] selim: has joined #ruby
[06:10:28] jinie: has joined #ruby
[06:10:32] Papierkorb: has joined #ruby
[06:10:50] A124: has joined #ruby
[06:10:52] sagax: has joined #ruby
[06:10:52] mjolnird: has joined #ruby
[06:10:52] mikeiniowa: has joined #ruby
[06:10:52] m4rCsi: has joined #ruby
[06:10:53] tw1sted: has joined #ruby
[06:10:53] Xiti: has joined #ruby
[06:10:53] lele: has joined #ruby
[06:10:53] cout: has joined #ruby
[06:10:53] mbr: has joined #ruby
[06:10:53] Bish: has joined #ruby
[06:10:53] [dmp]: has joined #ruby
[06:10:53] kapowaz: has joined #ruby
[06:10:53] ohcibi: has joined #ruby
[06:10:53] A124: has joined #ruby
[06:11:19] voice_ftp: has joined #ruby
[06:11:35] Xiti: has joined #ruby
[06:11:40] spt0: has joined #ruby
[06:11:52] dhollinger: has joined #ruby
[06:13:01] anisha: has joined #ruby
[06:13:21] sniffer: has joined #ruby
[06:13:27] krasnus: has joined #ruby
[06:13:51] cadillac_: has joined #ruby
[06:14:07] brent__: has joined #ruby
[06:14:25] voice_ftp_: has joined #ruby
[06:15:31] Jameser: has joined #ruby
[06:16:19] swills: has joined #ruby
[06:20:17] Mortomes|Work: has joined #ruby
[06:26:11] bronson: has joined #ruby
[06:31:16] swills: has joined #ruby
[06:31:16] swills: has joined #ruby
[06:32:59] VladGh: has joined #ruby
[06:34:51] andrzejku: has joined #ruby
[06:37:35] phaul: has joined #ruby
[06:37:36] harai_: has joined #ruby
[06:38:33] andrzejku: has joined #ruby
[06:40:19] eckhardt_: has joined #ruby
[06:45:39] conta: has joined #ruby
[06:48:54] Jameser: has joined #ruby
[06:53:58] r7c: has joined #ruby
[06:59:50] alazred: has joined #ruby
[06:59:51] alazred: has joined #ruby
[07:00:14] tAn: has joined #ruby
[07:01:53] elsevero: has joined #ruby
[07:04:04] Silthias: has joined #ruby
[07:06:02] dionysus69: has joined #ruby
[07:06:16] harfangk: has joined #ruby
[07:08:46] hs366: has joined #ruby
[07:11:19] Mortomes|Work: has joined #ruby
[07:11:20] spooky_d: has joined #ruby
[07:11:43] spooky_d: Hi there - I'm trying to build ruby and it takes a lot of time. How do I tell it to use multiple threads while building?
[07:12:05] spooky_d: make -j4 doesn't have the effect for most of the build - only for a very small part.
[07:17:13] swills: has joined #ruby
[07:17:13] swills: has joined #ruby
[07:17:15] biberu: has joined #ruby
[07:19:02] Tagami[m]: has joined #ruby
[07:21:29] jenrzzz: has joined #ruby
[07:21:29] jenrzzz: has joined #ruby
[07:24:55] modin: has joined #ruby
[07:26:52] mark_66: has joined #ruby
[07:28:38] claudiuinberlin: has joined #ruby
[07:31:17] swills: has joined #ruby
[07:31:17] swills: has joined #ruby
[07:32:13] alex``: has joined #ruby
[07:36:10] cdg: has joined #ruby
[07:37:54] aidalgol: has joined #ruby
[07:37:54] Hanma[m]: has joined #ruby
[07:37:55] yana[m]: has joined #ruby
[07:37:55] jonjits[m]: has joined #ruby
[07:37:55] dtcristo: has joined #ruby
[07:37:55] watzon: has joined #ruby
[07:37:55] aviraldg: has joined #ruby
[07:37:55] M107262[m]: has joined #ruby
[07:37:55] Orbixx[m]: has joined #ruby
[07:37:55] lasenna[m]: has joined #ruby
[07:37:55] torarne: has joined #ruby
[07:37:56] dman[m]: has joined #ruby
[07:37:56] Giphy[m]: has joined #ruby
[07:37:56] haylon: has joined #ruby
[07:37:56] turt2live: has joined #ruby
[07:37:56] velu_aon[m]: has joined #ruby
[07:37:56] KevinMGranger: has joined #ruby
[07:38:02] aagdbl[m]: has joined #ruby
[07:38:03] gokul_mr[m]: has joined #ruby
[07:38:03] itmerc[m]: has joined #ruby
[07:38:03] Matt[m]2: has joined #ruby
[07:38:04] kua[m]: has joined #ruby
[07:46:18] swills: has joined #ruby
[07:46:18] swills: has joined #ruby
[07:48:54] burgestrand: has joined #ruby
[07:50:38] Silthias: has joined #ruby
[07:51:24] hs366: has joined #ruby
[07:54:11] mikecmpbll: has joined #ruby
[07:56:03] claudiuinberlin: has joined #ruby
[07:57:19] Silthias1: has joined #ruby
[08:15:23] claudiuinberlin: has joined #ruby
[08:15:31] mim1k: has joined #ruby
[08:16:26] swills: has joined #ruby
[08:18:03] ahrs: has joined #ruby
[08:21:24] aufi: has joined #ruby
[08:24:27] mnemon: spooky_d: there are parts that won't parallelize well
[08:26:22] jaruga: has joined #ruby
[08:27:00] mnemon: also specifically, -j will make make multiple recipes of the makefile, if the makefile is written in one it will have no effect
[08:27:08] bronson: has joined #ruby
[08:27:48] Beams: has joined #ruby
[08:28:45] spooky_d: And there's no way to speed things up?
[08:29:22] spooky_d: It takes 25 minutes to build my toolchain and an hour to build ruby.
[08:29:27] spooky_d: It kind of bothers me.
[08:30:02] brent__: has joined #ruby
[08:31:03] yeticry: has joined #ruby
[08:31:17] swills: has joined #ruby
[08:31:17] swills: has joined #ruby
[08:37:25] mnemon: faster hardware/system or possibly disabling unused bits ... might have somethign ruby specific but it's a long time since I've built the intepreter itself so don't remember if there's anything relevant already in the make/config
[08:38:45] mnemon: or if you're happy with bad performance from ruby itself disable gcc optimizations :)
[08:38:59] harfangk: has joined #ruby
[08:39:15] ur5us: has joined #ruby
[08:43:00] TomyWork: has joined #ruby
[08:43:23] Silthias: has joined #ruby
[08:44:47] mnemon: spooky_d: you could try to get better performance out of the compiler itself ... what system are you building on/for?
[08:45:17] bruno-: has joined #ruby
[08:45:55] lxsameer: has joined #ruby
[08:46:17] Silthias1: has joined #ruby
[08:46:31] spooky_d: x86_64 for x86_64
[08:46:40] spooky_d: and also using lto.
[08:49:07] Silthias: has joined #ruby
[08:53:20] cagomez: has joined #ruby
[08:58:07] Algebr`: has joined #ruby
[08:59:28] claudiuinberlin: has joined #ruby
[08:59:44] mnemon: march=native for the things you don't need to ship to other systems and using tmpfs etc?
[09:00:18] Slinky_Pete: has joined #ruby
[09:00:35] jdawgaz: has joined #ruby
[09:00:50] marr: has joined #ruby
[09:01:47] anisha_: has joined #ruby
[09:04:18] vondruch: has joined #ruby
[09:04:52] phinxy: has joined #ruby
[09:06:13] phinxy: has left #ruby: ()
[09:08:53] vondruch: has joined #ruby
[09:13:26] cagomez: has joined #ruby
[09:15:25] _aeris_: has joined #ruby
[09:18:19] mkali: has joined #ruby
[09:18:30] sleetdrop: has joined #ruby
[09:29:27] claudiuinberlin: has joined #ruby
[09:34:19] wnd: has joined #ruby
[09:39:31] ferr: has joined #ruby
[09:41:08] wald0: has joined #ruby
[09:42:03] Silthias: has joined #ruby
[09:43:58] cdg: has joined #ruby
[09:45:24] cdg_: has joined #ruby
[09:46:15] swills: has joined #ruby
[09:46:15] swills: has joined #ruby
[09:46:28] cdg__: has joined #ruby
[09:48:03] PaulCapestany: has joined #ruby
[09:52:39] Algebr`: has joined #ruby
[09:53:53] Serpent7776: has joined #ruby
[09:54:25] Slinky_Pete: has joined #ruby
[09:57:25] cdg: has joined #ruby
[09:59:13] rabajaj: has joined #ruby
[09:59:55] Beams_: has joined #ruby
[09:59:57] cdg_: has joined #ruby
[10:00:05] claudiuinberlin: has joined #ruby
[10:01:02] Pisuke: has joined #ruby
[10:01:20] cdg__: has joined #ruby
[10:21:03] GodFather: has joined #ruby
[10:27:08] anisha: has joined #ruby
[10:30:07] S007: has joined #ruby
[10:34:47] Beams: has joined #ruby
[10:35:29] Siyfion: has joined #ruby
[10:38:28] InfinityFye: has joined #ruby
[10:39:45] ur5us_: has joined #ruby
[10:41:39] ur5us: has joined #ruby
[10:42:45] Silthias: has joined #ruby
[10:46:21] Algebr`: has joined #ruby
[10:55:52] uZiel: has joined #ruby
[11:05:21] DTZUZO: has joined #ruby
[11:06:23] hfp_work: has joined #ruby
[11:11:09] darix: spooky_d: on what os/arch are you?
[11:16:25] bruce_lee: has joined #ruby
[11:26:21] Jameser: has joined #ruby
[11:27:05] konsolebox: has joined #ruby
[11:28:27] charliesome: has joined #ruby
[11:32:34] aufi: has joined #ruby
[11:33:34] Silthias: has joined #ruby
[11:35:59] ldnunes: has joined #ruby
[11:36:59] nowhereman: has joined #ruby
[11:37:41] claudiuinberlin: has joined #ruby
[11:40:28] Algebr`: has joined #ruby
[11:41:11] mim1k: has joined #ruby
[11:41:34] soahccc: Any idea what could cause multiple threads to never run again after getting stopped? e.g. Thread.stop and then later thr.run or wakeup and it will stay on stop forever
[11:42:32] spooky_d: darix: on x86_64
[11:42:38] spooky_d: same target
[11:42:43] Slinky_Pete: has joined #ruby
[11:46:20] soahccc: I had no problem when not stopping the threads but I need the fiber variables to be set before the thread runs and need it available outside the thread immediately. So I stopped it, set the variables outside the thread and start it again. It has the variables and methods I defined but it wont start (rarely I get one to run). I assume a locking issue but there is no locking going on at this point. Dunno how to debug this
[11:50:35] claudiuinberlin: has joined #ruby
[11:50:37] tcopeland: has joined #ruby
[11:52:14] ShalokShalom_: has joined #ruby
[11:56:10] venomoustoad: has joined #ruby
[11:56:39] burgestrand: soahccc Got a minimal example?
[11:57:00] venomoustoad: is anybody here
[11:57:42] ski7777: has joined #ruby
[11:57:59] aufi: has joined #ruby
[11:58:03] soahccc: Burgestrand: I can show you the method I use to create the threads, the app itself is rather complex and it's some timing issue (when I sleep (line 27) or block another way the problem goes away). Also if a thread decides to run, it's not always the same one... https://gist.github.com/2called-chaos/9865817178b1dd208885b9441fae3243
[11:59:47] soahccc: Burgestrand: I switched from not-stopping and defining the fiber variables inside the Thread.new{} to stopping it and define those variables in the creating thread (as I had issues with the thread not being run yet, hence variables not being there
[11:59:51] burgestrand: soahccc Your thread has most likely not executed the sleep yet, which causes your `thr.run` to be a no-op
[12:00:23] soahccc: Burgestrand: it does #run all of the threads though, that I figured
[12:00:36] soahccc: also tried wakeup since I don't get the difference really
[12:00:47] venomoustoad: has left #ruby: ()
[12:01:02] jdawgaz: has joined #ruby
[12:01:04] synthroid: has joined #ruby
[12:01:17] burgestrand: soahccc thread = Thread.new { Thread.stop }; thread.run — this is racy, since Thread.stop might be called before or *after* `thread.run`
[12:02:50] soahccc: Burgestrand: hmm :/ didn't see the wood for the trees I guess
[12:04:00] soahccc: It seems that I can't get around a sleep in that case, even the example sleep(0.1) until thr.status == "sleep"
[12:04:08] burgestrand: soahccc You can use a semaphore to allow you to do your out-of-thread setup
[12:04:39] burgestrand: soahccc Make it start at a count of 0, your new thread does `semaphore.decrement` (or whatever), and once your setup is done outside of the thread you can do `semaphore.increment` which allows it to continue
[12:04:54] charliesome: has joined #ruby
[12:05:40] burgestrand: soahccc I don't really know if Ruby has a regular semaphore, but a Queue works just as well and is what I tend to use :)
[12:07:04] burgestrand: soahccc e.g. https://eval.in/864264
[12:07:07] soahccc: Burgestrand: yeah I was just looking at Mutex (which I personally don't like as much since Monitor is "reentrant"?) but do you mean a 2-way handshake? Like spawning thread waits for new thread to reach the wait, then do setup and ping back?
[12:07:57] burgestrand: Yeah, a monitor is reentrant, I tend to use it for that reason too, a lot of the times a Queue is more than enough for my cases
[12:08:28] VladGh: has joined #ruby
[12:09:12] modin: has joined #ruby
[12:10:46] burgestrand: soahccc Frankly, I'm not sure why you do your setup in the spawning thread, and not in the thread you just spawned
[12:10:55] herbmillerjr: has joined #ruby
[12:11:31] soahccc: Burgestrand: 1st: thank you :) that works and is quite neat (I just thought about mutex but queue is just what I need)
[12:12:38] jaruga: has joined #ruby
[12:12:40] sniffer: has joined #ruby
[12:12:58] soahccc: 2nd: It might not be the cleanest architecture but I have a few status displays which obviously sleep for a while between redrawing/calculating. I had the idea of using conditional variables instead so that they behave like a sleep but can be interupted by a signal from elsewhere. Now if the thread hasn't run yet and I try to use it's fiber variable monitor => boom
[12:13:50] soahccc: So I wanted the thread to be "fully ready" before it runs and before the spawning method returns
[12:14:54] burgestrand: Fair enough, I guess you kind of need to wait for your setup somehow/somewhere, doesn't matter if your main thread blocks and wait or if your new thread blocks and wait
[12:15:00] soahccc: But from what I gathered you work with threads and stuff from time to time? I bet you get a stroke when looking at my app then =)
[12:15:47] burgestrand: You could possibly get around the blocking/waiting by creating your communication channel before you spawn the thread, and pass it in when you spawn the thread, e.g. `Thread.new(channel) { |channel| … }`, and then define your convenience methods outside of it at your own leisure :)
[12:16:23] swills: has joined #ruby
[12:16:23] swills: has joined #ruby
[12:16:29] Silthias: has joined #ruby
[12:16:40] venomoustoad: has joined #ruby
[12:16:51] claudiuinberlin: has joined #ruby
[12:17:09] burgestrand: soahccc a bit of a mix :) it's both an interest (for fun), I've written a few concurrent/parallel systems in ruby and working with mobile development which forces you to use them even more
[12:17:26] venomoustoad: has left #ruby: ()
[12:17:31] soahccc: So GUI stuff on mobile?
[12:17:32] burgestrand: (for clarity's sake I'm doing not doing mobile development _in ruby_)
[12:17:54] soahccc: hehe gotcha :)
[12:18:48] Silthias1: has joined #ruby
[12:19:13] burgestrand: soahccc and no, no stroke, code is just code :)
[12:19:19] tvw: has joined #ruby
[12:19:27] burgestrand: (well, frankly, code is a liability so the less the better I guess)
[12:19:40] soahccc: My first major app that heavily used threads was a process wrapper (for a game) to provide IRC-bot like features, now I'm creating a tool from hell to selectively pull production DB data to dev/staging systems, hence db_sucker :D
[12:20:29] claudiuinberlin: has joined #ruby
[12:20:36] InfinityFye: has joined #ruby
[12:21:07] soahccc: It's totally unnecessary but I have my fun with it (reworked it with a curses display)
[12:23:00] mson: has joined #ruby
[12:23:04] burgestrand: Well, if everything had to be necessary then there would be way less fun around ;)
[12:23:05] soahccc: Oh and I created poor-mans IDS with ruby once... hell this is running forever now, almost forgot about it... https://i.imgur.com/com5eRZ.jpg
[12:23:18] soahccc: longest running ruby app of my life :D
[12:23:25] voiceftp: has joined #ruby
[12:24:16] burgestrand: soahccc That's sweet, feels like a great use-case :)
[12:24:59] burgestrand: soahccc Oh, just so you're aware, you might want to check out https://github.com/ruby-concurrency/concurrent-ruby
[12:25:11] soahccc: well I used it to heuristically (captcha)ban malicious hosts and I guess there are better solutions for this but where's the fun in that :D
[12:26:23] Jameser`: has joined #ruby
[12:27:26] soahccc: yeah thanks I know about it but never used it so far, maybe for my next project :) has some nice stuff in it but my current tool has technically no dependencies (net-ssh/sftp and since it was removed from ruby curses)
[12:29:23] bronson: has joined #ruby
[12:30:28] brent__: has joined #ruby
[12:31:33] voiceftp: has joined #ruby
[12:32:22] depesz: has joined #ruby
[12:33:10] Jameser: has joined #ruby
[12:33:12] depesz: hi. what is the sanest library/gem for writing web spider? i'd like something that behaves like simple web browser, handles cookies, and then something that will allow me to easily extract data from fetched html
[12:34:43] Algebr`: has joined #ruby
[12:35:46] mtkd: has joined #ruby
[12:36:09] soahccc: depesz: depends on how sophisticated the target page is, you can just get away with httparty (though it handles cookies, I'm not so sure about more complex stuff) or you could go full try-hard and use a selenium integration with capybara (ususally for testing) or something
[12:36:30] soahccc: the latter can do JS and everything depending on the adapter
[12:36:58] depesz: no, no. i just need it to get some webpages, and keep track of cookies/redirects on subsequent calls.
[12:37:34] depesz: in perl i was using WWW::Mechanize and am looking for something similar for Ruby ( I know it doesn't help most of the people, but perhaps you know something about perl)
[12:37:38] depesz: looking at httparty
[12:37:39] soahccc: depesz: keep track as in keep track or rather "should just be handled for me"
[12:37:52] depesz: should just handle it transparently for me.
[12:38:35] soahccc: then I guess httparty should be your friend, it handles things like session cookies and keeps them on redirects but if you want to login or something it can become a little bit harder
[12:38:48] t-recx: has joined #ruby
[12:38:50] depesz: nah, i don't need login. at least for now
[12:38:55] depesz: thanks, will check it.
[12:39:23] soahccc: depesz: but looking at mechanize this is more something like capbara (things like "go to that form", "enter this there", "click on this and that")
[12:39:30] depesz: ok. one more question. please note that I'm very very new when it comes to ruby
[12:40:02] depesz: i saw something that a person had in a directory with his ruby program, that when he/she ran some command, it automatically installed all required gems. any pointers on what it could be / how to use it?
[12:40:36] soahccc: depesz: http://bundler.io/
[12:41:21] soahccc: This is basically so "core" I wonder why it's still not shipped with ruby :D
[12:44:57] jinie: has joined #ruby
[12:45:03] mnemon: depesz: there's many webdrivers for ruby and there's also mechanize port to ruby :)
[12:45:30] phaul: has joined #ruby
[12:45:35] Ishido: has joined #ruby
[12:45:39] mnemon: selenium bindings comes to mind ...
[12:47:21] nopolitica: has joined #ruby
[12:51:02] depesz: soahccc: thanks.
[12:51:11] Jameser: has joined #ruby
[12:51:38] MarkBilk: has joined #ruby
[12:54:22] claudiuinberlin: has joined #ruby
[12:59:58] duckpupp1: has joined #ruby
[13:00:30] EminenceHC: has joined #ruby
[13:01:36] Jameser: has joined #ruby
[13:02:05] mim1k: has joined #ruby
[13:04:35] nobitanobi: has joined #ruby
[13:04:58] nobitanobi: Why when accessing a class method from within an instace method I need to do `self.class.method`, instead of `class.method`?
[13:05:01] leah2: hm, is pack M* in violation of rfc 2045?
[13:05:25] soahccc: nobitanobi: It's annoying I know but just "class" is a keyword
[13:05:38] nobitanobi: k thanks soahccc
[13:05:43] leah2: > It follows that an octet with decimal value 9 or 32 appearing at the end of an encoded line must be represented according to Rule #1.
[13:06:04] leah2: >> ["foo \n"].pack("M*")
[13:06:05] ruby[bot]: leah2: # => "foo =\n\n" (https://eval.in/864330)
[13:06:14] leah2: but rule 1 says =20
[13:06:14] soahccc: nobitanobi: you _could_ (but it's not a convention I guess) define a little helper method like def klass; self.class; end
[13:06:28] nobitanobi: yep, I have seen that :) Thanks!
[13:07:53] cdg: has joined #ruby
[13:08:02] giraffe: has joined #ruby
[13:08:33] cdg: has joined #ruby
[13:08:49] tpendragon: has joined #ruby
[13:09:30] swills: has joined #ruby
[13:09:30] swills: has joined #ruby
[13:09:50] swills_: has joined #ruby
[13:11:08] cdg_: has joined #ruby
[13:13:05] FahmeF: has joined #ruby
[13:20:15] maryo_: has joined #ruby
[13:21:47] haylon: has joined #ruby
[13:23:07] chouhoulis: has joined #ruby
[13:24:48] claudiuinberlin: has joined #ruby
[13:28:47] Algebr`: has joined #ruby
[13:28:48] tcopeland: has joined #ruby
[13:29:17] FrostCandy: has joined #ruby
[13:30:44] Slinky_Pete: has joined #ruby
[13:33:09] DLSteve: has joined #ruby
[13:34:59] Jameser: has joined #ruby
[13:40:18] Silthias: has joined #ruby
[13:41:14] Silthias1: has joined #ruby
[13:43:58] marcux: has joined #ruby
[13:45:28] jobewan: has joined #ruby
[13:46:15] jdawgaz: has joined #ruby
[13:47:00] jdawgaz: has joined #ruby
[13:47:50] jdawgaz: has joined #ruby
[13:47:55] jottr: has joined #ruby
[13:48:35] jdawgaz: has joined #ruby
[13:51:54] Emmanuel_Chanel: has joined #ruby
[13:53:18] LastWhisper____: has joined #ruby
[13:55:20] jdawgaz: has joined #ruby
[13:59:21] jphase: has joined #ruby
[14:02:09] Jameser`: has joined #ruby
[14:04:07] apparition: has joined #ruby
[14:05:41] invalidusrname: has joined #ruby
[14:06:28] invalidusrname: has joined #ruby
[14:15:25] claudiuinberlin: has joined #ruby
[14:16:49] Sylario: has joined #ruby
[14:19:08] jphase: has joined #ruby
[14:20:18] jphase: has joined #ruby
[14:22:55] Algebr`: has joined #ruby
[14:23:25] jdawgaz: has joined #ruby
[14:25:10] ecuanaso: has joined #ruby
[14:29:51] laphoraig77: has joined #ruby
[14:30:51] bronson: has joined #ruby
[14:31:48] polishdub: has joined #ruby
[14:31:49] oncall-pokemon: has joined #ruby
[14:33:02] JD2020X: has joined #ruby
[14:33:53] jnix: has joined #ruby
[14:34:06] p0p0pr37_: has joined #ruby
[14:34:06] p0p0pr37_: has joined #ruby
[14:36:39] Rapture: has joined #ruby
[14:45:02] bruno-: has joined #ruby
[14:52:57] tAn: has joined #ruby
[14:58:35] synthroid: has joined #ruby
[15:04:10] gusrub: has joined #ruby
[15:04:43] claudiuinberlin: has joined #ruby
[15:10:45] TomyLobo: has joined #ruby
[15:11:29] conta: has joined #ruby
[15:11:46] rippa: has joined #ruby
[15:12:00] cschneid: has joined #ruby
[15:17:03] kculpis: has joined #ruby
[15:17:29] mikecmpbll: has joined #ruby
[15:20:16] ams__: has joined #ruby
[15:20:23] Hien: has joined #ruby
[15:21:25] kapil___: has joined #ruby
[15:24:05] FahmeF: has joined #ruby
[15:25:44] GodFather: has joined #ruby
[15:32:04] s2013: has joined #ruby
[15:33:39] s2013: has joined #ruby
[15:35:13] polishdub: has joined #ruby
[15:35:58] ArMedic: has joined #ruby
[15:37:29] dupondje_: has joined #ruby
[15:37:48] dupondje_: has left #ruby: ()
[15:39:39] Ouchy: has joined #ruby
[15:43:20] brent__: has joined #ruby
[15:43:50] brent__: has joined #ruby
[15:47:03] dionysus69: has joined #ruby
[15:53:51] gusrub: has joined #ruby
[15:55:44] cagomez: has joined #ruby
[15:56:25] dviola: has joined #ruby
[15:58:31] jphase: has joined #ruby
[15:58:44] claudiuinberlin: has joined #ruby
[15:58:56] mwdeez: has joined #ruby
[15:59:09] DTZUZO: has joined #ruby
[15:59:14] gregf_: has joined #ruby
[15:59:46] joelroa: has joined #ruby
[16:02:14] mwdeez: Hey gang, I've got something that is hopefully an easy-ish fix for someone more experienced than me :) I've got a rails app running that I'd like to add a JSON API to. I'm writing the API in Sinatra and have the Sinatra app mounted in my Rails routes.rb and routing works properly except for the lack of auto-reloading. When I make changes to any of my Sinatra files the new files aren't served until restarting the Rails app (which takes
[16:02:43] mwdeez: Is there a canonical solution to fixing autoreloading of Sinatra apps mounted inside a Rails project? I know the no auto-reload is expected with Sinatra, but I'm not sure which autoreload method would work best inside a rails app
[16:03:53] charliesome: has joined #ruby
[16:04:15] jphase: has joined #ruby
[16:06:07] [Butch]: has joined #ruby
[16:06:20] orbyt_: has joined #ruby
[16:06:47] gheegh: has joined #ruby
[16:07:31] sagax: has joined #ruby
[16:11:17] FastJack: has joined #ruby
[16:15:40] jphase: has joined #ruby
[16:15:43] t-recx: has joined #ruby
[16:15:47] cjohnson: If I've got an array of hashes whose keys are symbols, is there some way to use .map(&:id) like you might if the symbols weren't strings?
[16:16:08] cjohnson: Oh I see the issue, I need it to use the second arg to map
[16:16:26] cjohnson: Here's what I've got: foo.map do |k,v| v[:id] end
[16:16:33] cjohnson: Is there a way to use & here to shorten the map?
[16:18:39] InfinityFye: has joined #ruby
[16:19:48] SteenJobs: has joined #ruby
[16:19:54] elomatreb: cjohnson: You can, by using transform_values instead of map (at least if foo is a Hash)
[16:21:18] cjohnson: {"criteria_attributes"=>{"0"=>{"id"=>"538", "value"=>"b"}, "1"=>{"id"=>"539", "value"=>"c"}, "2"=>{"id"=>"", "value"=>"d"}}}
[16:21:36] fChanX: has joined #ruby
[16:21:52] gheegh: has joined #ruby
[16:22:04] cjohnson: I'm doing params[:criteria_attributes].map do |k,v| and v contians what I need
[16:22:30] cjohnson: k is {"0"=>{...}} and v is {"id"=>"538"...}
[16:22:36] cjohnson: So I just want to pull out the ids
[16:23:11] baweaver: If you give me about 1-2 weeks I'm OSS'ing something which does very close to that
[16:24:17] baweaver: WrapperName(hash).query('>id').end_values
[16:24:54] baweaver: >id being a deep dive until it finds something that matches 'id'
[16:25:01] cjohnson: baweaver: :P
[16:25:03] baweaver: Buuuuut until then...
[16:25:18] baweaver: Not much on shorthand, basically a lot of map/flat_map/reduce
[16:25:26] cjohnson: Yeah then I'll just stick with what I got
[16:25:50] Rodya_: has joined #ruby
[16:26:53] baweaver: What's nice is I can basically do this to Swagger: hash.query('requests.*.GET.params.created_at')
[16:26:56] baweaver: Any request type of get with a param of created_at
[16:26:57] SeepingN: has joined #ruby
[16:28:15] baweaver: (note it has nodes like requests.people.method, requests.places.method, etc.)
[16:30:22] cjohnson: I like those sorts of query things but also it would be overkill here
[16:30:30] cadillac_: has joined #ruby
[16:30:39] baweaver: but what's really nice is I support regex keys / values in there too :D - hash.query('/criteria/./\n+/.id=/^1/)
[16:30:47] cjohnson: baweaver: Not sure if you saw my post in #ROR but I'm trying to implement mark_for_destruction on missing children when saving a parent+child records
[16:30:53] cjohnson: In a way that doesn't suck lol
[16:31:11] cjohnson: baweaver: https://gist.github.com/chrisjohnson/faa000f248e8957de6bd55bdf656ca44
[16:31:13] baweaver: That's always an annoying one, need to find a good way to do it
[16:31:19] cjohnson: Yeah ok good to know I'm not alone
[16:31:30] cjohnson: I was worried there was a magic way that I was missing
[16:31:33] baweaver: Been busy on some pretty dense projects at work so not around as much
[16:31:45] cjohnson: My work is suffering!
[16:31:49] baweaver: There may still be, and matthewd or Radar would know it
[16:31:55] oleo: has joined #ruby
[16:31:55] bronson: has joined #ruby
[16:33:14] rapha: has left #ruby: ("WeeChat 2.0-dev")
[16:35:25] fChanX: What does this project do? It seems cool. :D
[16:39:49] imode: has joined #ruby
[16:41:20] ben_: has joined #ruby
[16:41:51] cagomez: has joined #ruby
[16:43:08] herbmillerjr: has joined #ruby
[16:44:40] bruno-_: has joined #ruby
[16:48:27] cagomez: has joined #ruby
[16:56:26] jdawgaz: has joined #ruby
[16:57:55] _sfiguser: has joined #ruby
[16:58:04] teatime: has joined #ruby
[17:03:19] nofxx: has joined #ruby
[17:05:46] SeepingN: has joined #ruby
[17:06:30] SteenJobs: has joined #ruby
[17:07:28] fChanX: has left #ruby: ("Leaving")
[17:10:46] gusrub_: has joined #ruby
[17:12:10] Rapture: has joined #ruby
[17:14:04] chouhoulis: has joined #ruby
[17:14:39] chouhoulis: has joined #ruby
[17:17:36] jphase: has joined #ruby
[17:18:48] jdawgaz: has joined #ruby
[17:19:47] jdawgaz: has joined #ruby
[17:20:32] jolamb: has joined #ruby
[17:30:34] claudiuinberlin: has joined #ruby
[17:32:32] gnufied: has joined #ruby
[17:33:45] jdawgaz: has joined #ruby
[17:40:41] [Butch]: has joined #ruby
[17:43:00] alex``: has joined #ruby
[17:43:06] claudiuinberlin: has joined #ruby
[17:43:39] AndBobsYourUncle: has joined #ruby
[17:45:45] jdawgaz: has joined #ruby
[17:46:38] uZiel: has joined #ruby
[17:46:41] gusrub: has joined #ruby
[17:48:47] jottr: has joined #ruby
[17:50:32] tax: has joined #ruby
[17:53:28] perniciouscaffei: has joined #ruby
[17:54:50] biberu: has joined #ruby
[18:00:32] yokel: has joined #ruby
[18:02:57] jphase: has joined #ruby
[18:03:56] marxarelli: has joined #ruby
[18:07:11] GodFather_: has joined #ruby
[18:10:26] gusrub: has joined #ruby
[18:10:48] Rodya_: has joined #ruby
[18:23:21] belmoussaoui: has joined #ruby
[18:25:43] Azure: has joined #ruby
[18:31:28] conta: has joined #ruby
[18:32:28] jphase: has joined #ruby
[18:32:31] cdg: has joined #ruby
[18:32:54] bronson: has joined #ruby
[18:34:48] jphase: has joined #ruby
[18:37:53] kus_ubuntui686: has joined #ruby
[18:39:03] Mighty_Warthog: has joined #ruby
[18:40:28] spt0: has joined #ruby
[18:41:28] Mighty_Warthog: has joined #ruby
[18:42:24] hahuang65: has joined #ruby
[18:42:48] hahuang65: what would be the best way to filter out a set of words (case insensitive) from a string
[18:44:01] havenwood: hahuang65: What do you want to have in place of the words?
[18:44:18] elomatreb: >> "lorem ipsum dolor sit amet".gsub /dolor|amet/i, ""
[18:44:18] hahuang65: for example
[18:44:19] ruby[bot]: elomatreb: # => "lorem ipsum sit " (https://eval.in/864579)
[18:44:30] elomatreb: Well, plus something for the trailing/leading space
[18:44:43] hahuang65: what if I have the set of words to filter out in a Set
[18:46:14] havenwood: >> 'hi there sekret words'.gsub Regexp.union(%w[filter these sekret]), ''
[18:46:15] ruby[bot]: havenwood: # => "hi there words" (https://eval.in/864581)
[18:46:27] havenwood: hahuang65: You presumably want to remove the extra space as well?
[18:46:35] havenwood: you're welcome
[18:46:36] hahuang65: yeah, possibly
[18:46:47] hahuang65: but I think all my cases are at the end, so I can simply strip maybe
[18:47:02] havenwood: hahuang65: also anchor to the end
[18:48:00] havenwood: >> 'hi there sekret'.gsub /\s#{Regexp.union(%w[filter these sekret])}\z/, ''
[18:48:03] ruby[bot]: havenwood: # => "hi there" (https://eval.in/864582)
[18:48:26] havenwood: hahuang65: But if it's at the end, you can also just #chomp
[18:48:58] hahuang65: havenwood: how would I make that gsub case insensitive
[18:49:15] havenwood: hahuang65: gsub //i, ''
[18:49:26] Guest987: has joined #ruby
[18:49:30] havenwood: hahuang65: (A trailing `i` after the Regexp literal.)
[18:49:41] hahuang65: there's no literal if you do `Regexp.union`
[18:49:49] elbuki: has joined #ruby
[18:50:09] russt: has joined #ruby
[18:50:35] elbuki: Hey guys, what do you use to log errors from your applications?
[18:51:58] jenrzzz: has joined #ruby
[18:51:58] jenrzzz: has joined #ruby
[18:53:48] gheegh: has joined #ruby
[18:54:00] havenwood: hahuang65: one option is to interpolate it inside of a Regexp literal like i showed above
[18:54:38] lxsameer: has joined #ruby
[18:54:44] hahuang65: dammit, there are actually a lot of caveats here
[18:54:55] Dimik: has joined #ruby
[18:55:05] hahuang65: I'm basically trying to remove corporate words like `inc` or `llc` or `co`
[18:55:13] hahuang65: and we have those words in a set
[18:55:28] hahuang65: but I cannot purely gsub since there's no non-word delimiters necessarily around them
[18:55:44] havenwood: just a space in front of each, no?
[18:56:05] hahuang65: Pincus Corp would become Pus (since inc and corp) would both be removed
[18:56:06] havenwood: might it be something other than a space?
[18:56:18] hahuang65: could be Acme, Inc. or Acme,Inc
[18:56:39] elomatreb: Anchor at end, and have a \.? ?
[18:56:49] AmericanistTimes: has joined #ruby
[18:56:54] hahuang65: not necessarily. I guess I think need to change the set to a regex huh?
[18:57:06] hahuang65: I cannot easily change a set into a set of regexs
[18:57:20] elomatreb: That's what havenwoods line did, with the Regexp.union just being a convenience
[18:57:24] havenwood: In Ruby 2.5 you can use #delete_suffix with a glob.
[18:57:25] conta: has joined #ruby
[18:58:03] hahuang65: elomatreb: right, but I cannot insist that there be any delimiters around any of those words if I use Regexp.union
[18:58:10] hahuang65: not easily at least.
[18:58:30] elomatreb: You can, by interpolating the resulting regex, like in the example
[18:58:37] hahuang65: /\W(inc|corp|co)\W/i is what I would want
[18:58:52] hahuang65: elomatreb: I'mnot really understanding what you mean
[18:59:36] Rodya_: has joined #ruby
[19:00:02] elomatreb: >> /\W(#{Regexp.union %w[inc corp co]})\W/
[19:00:03] ruby[bot]: elomatreb: # => /\W((?-mix:inc|corp|co))\W/ (https://eval.in/864589)
[19:00:17] hahuang65: i'm a derp.
[19:01:49] gnufied: has joined #ruby
[19:02:04] havenwood: >> 'ermagerd,LLC'.gsub /[,\s]?\s?(?i-mx:llc|inc|corp)\z/, ''
[19:02:05] ruby[bot]: havenwood: # => "ermagerd" (https://eval.in/864590)
[19:02:38] ule: Which method can I use to "inject" a new value to each element inside a hash?
[19:02:52] havenwood: ule: Say more about what you mean.
[19:03:03] havenwood: ule: You want to modify existing values?
[19:03:19] ule: havenwood: I want to add an extra column
[19:03:21] ule: on each element
[19:03:23] havenwood: ule: Give an example.
[19:03:30] ule: so.. let me exmplain better
[19:03:38] havenwood: ule: Explain with an example.
[19:03:38] DrCode: has joined #ruby
[19:03:41] elomatreb: Example input/expected output is usually a good way
[19:03:49] ule: ok hold on.. I'm gonna write a snippet
[19:04:35] jottr: has joined #ruby
[19:04:48] havenwood: "it's easier to understand complex data than complex logic" ~ paraphrase of unix philosophy rule of representation
[19:07:10] hahuang65: havenwood: lol
[19:07:12] ule: havenwood: {"Manager1"=>"America/Toronto", "Manager2"=>"America/Toronto", "User4"=>"America/Toronto", "User3"=>"America/New_York", "User2"=>"Europe/Paris", "User1"=>"America/Vancouver"}
[19:07:14] hahuang65: elomatreb: thanks
[19:07:32] ule: This is what I have. I want to group by timezone_offset
[19:07:45] ule: so I want this final output:
[19:08:08] claudiuinberlin: has joined #ruby
[19:08:16] gothicsouth: has joined #ruby
[19:09:16] ule: {"-18000" => ["Manager1", "Manager2"], "43000" => ["User2"]}
[19:09:19] ule: Something like this
[19:09:43] DrCode: has joined #ruby
[19:10:00] ule: so I'm converting "America/New_York" to timezone successfuly with: ActiveSupport::TimeZone.new('America/New_York').utc_offset
[19:10:35] hahuang65: what the hell is `/\W((?-mix:co|corp|corporation|company|llc|ltd|limited|inc|incorporated|dba|fka))\W/i` this ?-mix: thing?
[19:10:38] havenwood: >> {"Manager1"=>"America/Toronto", "Manager2"=>"America/Toronto", "User4"=>"America/Toronto", "User3"=>"America/New_York", "User2"=>"Europe/Paris", "User1"=>"America/Vancouver"}.each_with_object(Hash.new { |h, k| h[k] = []}) { |(user, tz), result| result[tz] << user } # ule
[19:10:39] ule: I messed up.
[19:10:40] ruby[bot]: havenwood: # => {"America/Toronto"=>["Manager1", "Manager2", "User4"], "America/New_York"=>["User3"], "Europe/Paris" ...check link for more (https://eval.in/864595)
[19:11:06] ule: havenwood: "each_with_object"
[19:11:25] ule: awesome
[19:11:25] havenwood: hahuang65: the `i` is insensitive, and it's after the `-` so it's not insensitive, etc
[19:11:29] ule: lemme try here
[19:11:40] ule: havenwood: thank you very much!!
[19:12:00] havenwood: hahuang65: like this one is case insensitive: 'ermagerd,LLC'.gsub /[,\s]?\s?(?i-mx:llc|inc|corp)\z/, ''
[19:12:01] havenwood: hahuang65: (The `i` is before the `-`.)
[19:12:06] havenwood: ule: you're welcome!
[19:12:34] havenwood: ule: You can alternatively up front define: result = Hash.new { |h, k| h[k] = [] }
[19:12:41] havenwood: ule: then return `result` at the end
[19:13:01] havenwood: ule: or each_with_object works too
[19:13:34] ule: havenwood: I'm still digesting all the informating you sent to me
[19:13:44] conta1: has joined #ruby
[19:13:52] ule: those enumerables always freeze my brain
[19:14:02] havenwood: ule: they're worth learning! handy things
[19:14:41] ule: havenwood: what's your recommendation to learn these stuff? going method by method and replicating what the doc says?
[19:14:55] havenwood: ule: yes, I'd recommend learning every Enumerable method
[19:15:17] ule: I really need to this.. gonna set a persinal goal.. one method per day
[19:15:17] jdawgaz: has joined #ruby
[19:15:44] ule: awesome, but first let me learn really well what you sent me. thanks again!
[19:17:07] zachk: has joined #ruby
[19:17:36] ule: havenwood: now I'm gonna merge some of those results. Since America/Toronto == America/New_York
[19:18:13] havenwood: ACTION plots to liberate Toronto.
[19:18:41] havenwood: Oh, right, timezones.
[19:19:01] hahuang65: havenwood: any thoughts on why that would be generated with Regexp.union?
[19:19:26] havenwood: hahuang65: generated regexp include their flags, so you can add them together and not lose flags
[19:20:07] Slinky_Pete: has joined #ruby
[19:20:14] hahuang65: havenwood: https://gist.github.com/hahuang65/c3b656de27f08e217c9879b2552b6cce no flags though
[19:20:27] havenwood: that's preserving the absence of those flags
[19:20:35] havenwood: not m, i or x
[19:21:17] hahuang65: damn, how might I add those flags back in?
[19:24:26] mtkd: has joined #ruby
[19:25:09] hahuang65: oh I can use Regexp.union().source
[19:25:26] dionysus69: has joined #ruby
[19:25:30] uZiel: has joined #ruby
[19:26:05] hahuang65: really helpful
[19:28:47] ledestin: has joined #ruby
[19:29:55] herbmillerjr: has joined #ruby
[19:29:56] cagomez: has joined #ruby
[19:31:36] orbyt_: has joined #ruby
[19:32:09] jphase: has joined #ruby
[19:34:48] enterprisey: has joined #ruby
[19:35:07] bronson: has joined #ruby
[19:35:08] synthroid: has joined #ruby
[19:36:19] oleo: has joined #ruby
[19:39:22] Cohedrin_: has joined #ruby
[19:39:23] synthroid: has joined #ruby
[19:46:15] jphase: has joined #ruby
[19:49:03] elbuki: is there a free error reporting software? like rollbar or honeybadger?
[19:53:06] BTRE: has joined #ruby
[19:54:28] gusrub_: has joined #ruby
[19:56:15] Cohedrin_: has joined #ruby
[20:01:20] _sfiguser: has joined #ruby
[20:04:06] Algebr`: has joined #ruby
[20:05:00] cagomez: has joined #ruby
[20:06:59] Algebr`: havenwood: yea, i mean to be using 2.1 I am trying to use the traveling-ruby library to package ruby & 1 gem, 'fastlane' for windows.
[20:07:09] brw: has joined #ruby
[20:07:22] claudiuinberlin: has joined #ruby
[20:10:29] Rodya_: has joined #ruby
[20:10:42] marxarelli: has joined #ruby
[20:11:00] cdg: has joined #ruby
[20:11:18] havenwood: elbuki: Don't those offer a free tier?
[20:11:23] havenwood: elbuki: https://timber.io
[20:11:34] goyox86_: has joined #ruby
[20:13:04] uneeb: has joined #ruby
[20:13:04] elbuki: Yeah, but they're free trials...
[20:13:38] havenwood: Rollbar seems to offer $0 for 5,000 events with 30-days retention.
[20:13:55] elbuki: It has a 13 days free trial.
[20:14:15] elbuki: I'm not sure if I can use it after the trial expiration
[20:14:30] havenwood: Isn't that on any tier?
[20:14:30] havenwood: The free one you can. Look at the annual, still $0.
[20:15:07] havenwood: You can do premium for 13 days, then switch to free and it's still free.
[20:15:23] havenwood: Or just start at free and stay at free.
[20:15:47] elbuki: Ok, I hope I can stay at free.
[20:15:51] havenwood: They mean for it to be free until you need 100k+ log lines or more than 6mo retention.
[20:15:58] goyox86_: has joined #ruby
[20:15:59] havenwood: Or, 5k, 30day
[20:16:16] elbuki: It has to be a very buggy app...
[20:16:21] cdg_: has joined #ruby
[20:16:29] havenwood: elbuki: You can stay at free.
[20:16:30] havenwood: elbuki: It'll just email you when the limit is reached.
[20:16:49] havenwood: You can limit the lines it logs too. It just counts those you let through.
[20:17:08] havenwood: It lets you use regexp to blacklist lines.
[20:17:31] lxsameer: has joined #ruby
[20:19:04] elbuki: All right.
[20:19:09] elbuki: That's awesome/
[20:19:26] Cohedrin_: has joined #ruby
[20:19:26] elbuki: I hope I can have it free forever.
[20:19:46] workmad3: has joined #ruby
[20:20:08] elbuki: Looking forward to implement error log saving without implementing a local database just for that...
[20:20:12] perniciouscaffei: has joined #ruby
[20:24:12] elbuki: By the way, is there any way to change the RACK_ENV variable?
[20:24:18] Azure|dc: has joined #ruby
[20:24:39] elbuki: I want to switch production/development environment via rake tasks.
[20:24:49] gusrub: has joined #ruby
[20:26:00] havenwood: elbuki: ENV['RACK_ENV'] = 'elbuki'
[20:27:38] AndBobsYourUncle: has joined #ruby
[20:32:19] jottr: has joined #ruby
[20:34:27] s2013: has joined #ruby
[20:35:40] gothicsouth: has joined #ruby
[20:37:12] tvw: has joined #ruby
[20:37:31] selim: has joined #ruby
[20:39:20] nobitanobi: has joined #ruby
[20:39:55] Yzguy: has joined #ruby
[20:45:48] cagomez: has joined #ruby
[20:47:41] jenrzzz: has joined #ruby
[20:51:16] jdawgaz: has joined #ruby
[20:52:06] jdawgaz: has joined #ruby
[20:52:56] jdawgaz: has joined #ruby
[20:53:05] hyperreal: has joined #ruby
[20:53:41] jdawgaz: has joined #ruby
[20:54:31] jdawgaz: has joined #ruby
[20:55:16] jdawgaz: has joined #ruby
[20:56:06] jdawgaz: has joined #ruby
[20:56:51] jdawgaz: has joined #ruby
[20:57:41] jdawgaz: has joined #ruby
[20:58:35] enterprisey: has joined #ruby
[21:02:31] phinxy: has joined #ruby
[21:02:45] mikecmpbll: has joined #ruby
[21:03:22] phinxy: has left #ruby: ()
[21:04:47] jdawgaz: has joined #ruby
[21:04:47] Rodya_: has joined #ruby
[21:04:53] ur5us: has joined #ruby
[21:04:59] ur5us_: has joined #ruby
[21:05:24] GodFather_: has joined #ruby
[21:11:02] Algebr`: is `:f => false` a function? What is this
[21:12:12] elomatreb: Algebr`: It's inside a Hash literal, a `key => value` pair
[21:13:04] Algebr`: is that something that can stand on its own or it must be in side a hashtable
[21:13:24] elomatreb: You can omit the braces in certain situations, but it only occurs in a Hash
[21:14:03] Papierkorb: You could just tell us you saw it inside a method call as argument.
[21:15:32] milardovich: has joined #ruby
[21:16:19] teatime: He's asking a reasonable question. In e.g. Perl6, => is the literal Pair constructor, and then the Hash constructor takes a list of Pair's, but you are free to use Pair's for other things unrelated to hashes. It's general-purpose. It's fair to ask if Ruby's => works similarly. But, I think it does not, it's pretty much special-cased in the interpreter, only available in specific limited cirumstances.
[21:17:29] Cohedrin_: has joined #ruby
[21:17:31] jackjackdripper: has joined #ruby
[21:20:11] Cohedrin_: has joined #ruby
[21:20:11] orbyt_: has joined #ruby
[21:20:36] Algebr`: so you can ombit parens on functions only when that function doesn't take any arguments? Or just 1?
[21:24:52] elomatreb: Algebr`: You can omit the parens no matter how many arguments it takes, but it can be confusing when an argument is another method call (since you need to know the precedence to know which arguments now belong to which call)
[21:25:33] elomatreb: Or did you mean the curly braces for Hash literals? Those can only be omitted if they're the last argument in a call
[21:25:55] bruno-: has joined #ruby
[21:25:56] Algebr`: yea, first one
[21:26:09] Algebr`: and .collect is map everywhere else right
[21:26:37] havenwood: Algebr`: #collect is typically an alias for #map, and #map won
[21:26:48] havenwood: We use map, since that's what modern languages use.
[21:28:11] havenwood: Ruby has some alias for folk coming from Lisp or Smalltalk, and the Lisp terms have proliferated.
[21:28:22] elbuki: has joined #ruby
[21:28:39] brent__: has joined #ruby
[21:29:03] havenwood: We use `reduce` instead of `inject` and `map` instead of `collect`, etc.
[21:29:33] jw: has joined #ruby
[21:29:37] havenwood: Soon we'll have filter. ;-)
[21:29:40] teatime: same ^^. having the aliases adds a bit of cognitive load / stuff to learn, but ultimately I like having the choice.
[21:30:23] Cohedrin_: has joined #ruby
[21:30:26] mson: has joined #ruby
[21:30:29] havenwood: https://bugs.ruby-lang.org/issues/13784
[21:30:32] teatime: not so much with map/reduce, but with some others sometimes I use different aliases in different places depending on the context / topic / to make the code read more like English.
[21:31:38] elomatreb: So, when do we get a #fold instead of inject/reduce? :P
[21:31:52] teatime: hrm, thought that already existed
[21:32:42] mim1k: has joined #ruby
[21:32:45] teatime: doesn't look like it though.
[21:35:26] roonsauce: has joined #ruby
[21:36:12] ben_: has joined #ruby
[21:37:53] imode: has joined #ruby
[21:41:44] gothicsouth: has joined #ruby
[21:45:16] troys: has joined #ruby
[21:54:36] orbyt_: has joined #ruby
[22:00:10] elbuki: has joined #ruby
[22:04:17] pilne: has joined #ruby
[22:04:32] ule: [{-18000=>["Manager1", "Manager2", "User4"]}, {-18000=>["User3"]}, {3600=>["User2"]}, {-28800=>["User1"]}]
[22:05:03] ule: how would you group by those keys? I want to merge -18000 so that its contents be: manager1, manager2, user4, user3
[22:05:57] elomatreb: Can one of the hashes only have a single key?
[22:06:34] ule: elomatreb: yes
[22:06:53] ule: [{-18000=>["Manager1", "Manager2", "User4", "User3"]}, {3600=>["User2"]}, {-28800=>["User1"]}]
[22:06:55] Kanibal: I guess .reduce works for this
[22:06:57] ule: I want this ^
[22:07:05] ule: reduce? let me check
[22:08:27] elomatreb: Are you sure you don't want a solution that has one big hash with multiple keys as a result?
[22:08:56] ule: elomatreb: I mean, as long as it keeps a kind of key/value
[22:09:14] ule: because after I need to pass that number and retrieve the value
[22:09:33] jphase: has joined #ruby
[22:09:37] ule: puts foo[3600] ----> [
[22:11:02] havenwood: ule: We can show you how to merge but might be nice to unify your timestamps up front so you don't have to regroup them.
[22:11:13] jphase: has joined #ruby
[22:11:43] charliesome: has joined #ruby
[22:12:06] cagomez: has joined #ruby
[22:12:09] havenwood: ule: Are you using Rails or tzinfo at all?
[22:12:20] elomatreb: ule: It won't be winning any beauty prices, but: https://eval.in/864658
[22:12:45] iszak: has joined #ruby
[22:13:25] orbyt_: has joined #ruby
[22:13:56] havenwood: ule: {"Manager1"=>"America/Toronto", "Manager2"=>"America/Toronto", "User4"=>"America/Toronto", "User3"=>"America/New_York", "User2"=>"Europe/Paris", "User1"=>"America/Vancouver"}.each_with_object(Hash.new { |h, k| h[k] = []}) { |(user, tz), result| result[TZInfo::Timezone.get(tz).current_period.utc_offset] << user } #=> {-18000=>["Manager1", "Manager2", "User4", "User3"], 3600=>["User2"], -28800=>["User1"]}
[22:14:12] Kanibal: is there a eval-bot here?
[22:14:20] havenwood: >> true # Kanibal
[22:14:21] ruby[bot]: havenwood: # => true (https://eval.in/864659)
[22:14:37] milardovich: has joined #ruby
[22:14:38] Kanibal: >> [{-18000=>["Manager1", "Manager2", "User4"]}, {-18000=>["User3"]}, {3600=>["User2"]}, {-28800=>["User1"]}].inject { |acc, e| acc.merge(e) {|key, oldval, newval| newval.concat(oldval) } }
[22:14:39] ruby[bot]: Kanibal: # => {-18000=>["User3", "Manager1", "Manager2", "User4"], 3600=>["User2"], -28800=>["User1"]} (https://eval.in/864660)
[22:15:02] havenwood: Kanibal: That's a nice way
[22:15:22] Kanibal: I'm really becoming friends with inject
[22:15:40] havenwood: It reduces things, do doubt.
[22:17:28] AndBobsYourUncle: has joined #ruby
[22:18:31] jphase: has joined #ruby
[22:21:05] gusrub: has joined #ruby
[22:22:27] jphase: has joined #ruby
[22:32:02] ben_: has joined #ruby
[22:33:05] spt0: has joined #ruby
[22:33:25] GodFather: has joined #ruby
[22:34:38] ule: you guys are awesome
[22:34:43] ule: thank you very much
[22:34:51] elbuki: has joined #ruby
[22:38:47] orbyt_: has joined #ruby
[22:39:23] jphase: has joined #ruby
[22:39:53] jphase: has joined #ruby
[22:41:22] goyox86_: has joined #ruby
[22:41:43] gr33n7007h: has joined #ruby
[22:41:57] chouhoul_: has joined #ruby
[22:45:24] goyox86_: has joined #ruby
[22:46:02] s3nd1v0g1us: has joined #ruby
[22:46:25] s3nd1v0g1us: has joined #ruby
[22:48:36] Kanibal: >> [{-18000=>["Manager1", "Manager2", "User4"]}, {-18000=>["User3"]}, {3600=>["User2"]}, {-28800=>["User1"]}].inject { |acc, e| acc.merge(e) {|key, oldval, newval| oldval.concat newval } }.map {|k,v| {k => v}}
[22:48:37] ruby[bot]: Kanibal: # => [{-18000=>["Manager1", "Manager2", "User4", "User3"]}, {3600=>["User2"]}, {-28800=>["User1"]}] (https://eval.in/864665)
[22:48:56] Kanibal: ule: That is according to your exact specification
[22:49:20] elbuki: >> puts "#{ENV}"
[22:49:40] gbailey: has joined #ruby
[22:49:48] JD2020X: has joined #ruby
[22:49:56] elbuki: >> puts "#{ENV.inspect}"
[22:50:06] elbuki: Nice bot...
[22:50:40] elbuki: Is that hardcode validated?
[22:50:57] ruby[bot]: Kanibal: # => {"LIBC_FATAL_STDERR_"=>"1", "LANG"=>"en_US.UTF-8", "HOME"=>"/tmp/execpad-eec11920684e"} (https://eval.in/864666)
[22:51:30] elbuki: >> "hello"
[22:52:39] Kanibal: Maybe you need to be registered?
[22:56:35] jenrzzz: has joined #ruby
[22:56:35] jenrzzz: has joined #ruby
[22:59:46] elbuki: has joined #ruby
[23:00:43] tcopeland: has joined #ruby
[23:06:25] cagomez: has joined #ruby
[23:08:50] ruby[bot]: gr33n7007h: # => main (https://eval.in/864667)
[23:09:16] gr33n7007h: >> singleton_class
[23:09:17] ruby[bot]: gr33n7007h: # => #<Class:#<Object:0x413c9344>> (https://eval.in/864668)
[23:09:29] GodFather_: has joined #ruby
[23:10:51] milardovich: has joined #ruby
[23:10:57] yuppie: hello can someone help me out with mechanize?
[23:11:09] yuppie: im scraping a page but the tables dont seem to be expanding
[23:11:12] yuppie: the tr/td stuff
[23:11:19] cschneid: has joined #ruby
[23:11:20] yuppie: i can see it when i do to_yaml though
[23:11:24] gheegh: has joined #ruby
[23:12:49] SteenJobs: has joined #ruby
[23:13:36] naquad: has joined #ruby
[23:14:44] naquad: i've got [[1, [1,2,3,4,5]], [2, [2,3,4,5]]] can i somehow quickly make from it [[1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [2, 2], [2, 3], ...]? (that is produce pairs like <key> <value from array>)
[23:17:07] jphase: has joined #ruby
[23:20:58] naquad: i've got to that: x.map {|k ,v| v.zip([k].cycle)}.flatten(1)
[23:21:08] naquad: but it doesn't look very elegant :/
[23:22:50] enterprisey: has joined #ruby
[23:23:59] gheegh: has joined #ruby
[23:24:06] teatime: naquad: what you're looking for is a cartesian product (which takes [a, b, c...] X [1, 2, 3...] and produces [a1, a2, a3, b1, ...])
[23:24:36] teatime: naquad: I'm looking for it in Ruby. but what you have isn't *that* bad compared to my initial thoughts.
[23:25:53] teatime: yours may even be a little clearer than what I came up with, since your first element is never a list, always a scalar :)
[23:26:45] teatime: I was thinking of, e.g., x.map{|a| [a[0]] X a[1]}.flatten(1)
[23:27:00] elomatreb: naquad: x.flat_map {|a, b| [a].product b }
[23:27:44] teatime: there it is, .product. elomatreb++
[23:28:24] naquad: awezome! thank you :)
[23:30:45] jenrzzz: has joined #ruby
[23:33:14] mim1k: has joined #ruby
[23:34:31] gr33n7007h: elomatreb: +1
[23:35:27] enterprisey: has joined #ruby
[23:39:21] montyboy: has joined #ruby
[23:40:32] harfangk: has joined #ruby
[23:44:31] gheegh: has joined #ruby
[23:44:54] naquad: elomatreb++
[23:48:49] halt: has joined #ruby
[23:48:53] cdg: has joined #ruby
[23:55:34] Algebr`: has joined #ruby
[23:59:54] raynold: has joined #ruby