« Back to channel list

#ruby - 23 March 2019

« Back 1 day Forward 1 day »
[00:00:31] themsay: has joined #ruby
[00:11:15] s3nd1v0g1us: has joined #ruby
[00:11:51] Swyper: has joined #ruby
[00:18:59] Swyper: has joined #ruby
[00:19:05] naught-fowl: has joined #ruby
[00:29:49] xco: has joined #ruby
[00:32:58] Fusl: has joined #ruby
[00:40:24] ellcs: has joined #ruby
[00:49:07] AJA4351: has joined #ruby
[01:14:40] postmodern: has joined #ruby
[01:22:47] oncall-pokemon: has joined #ruby
[01:23:41] orbyt_: has joined #ruby
[01:25:36] oncall-pokemon: Hi, let's say I have 2 regex's I want to match against some strings. My goal is to capture the content between the ( ). I've tried both mystring.match(re_union) and mystring.scan(re_union).
[01:25:37] oncall-pokemon: Both can work but one only matches one pattern while the other can get both but puts it in the MathData format and is sometimes in slot 1 and other times slot 2.
[01:25:43] oncall-pokemon: any ideas to make this easy?
[01:39:04] Swyper: has joined #ruby
[01:56:47] AJA4350: has joined #ruby
[02:08:32] jrafanie: has joined #ruby
[02:10:56] bambanx: has joined #ruby
[02:14:10] mangold: has joined #ruby
[02:20:17] darix: oncall-pokemon: dont use the numeric index:
[02:20:26] darix: use named match groups
[02:20:48] darix: /(?<namehere>.*)/.match(string)
[02:20:52] darix: mo=/(?<namehere>.*)/.match(string)
[02:20:57] darix: mo[:namehere]
[02:21:47] griffindy: has joined #ruby
[02:36:35] xco: has joined #ruby
[02:52:09] gigetoo: has joined #ruby
[03:03:09] _whitelogger: has joined #ruby
[03:14:56] orbyt_: has joined #ruby
[03:19:08] orbyt_: has joined #ruby
[03:38:58] r3m: has joined #ruby
[03:39:17] Swyper: has joined #ruby
[03:39:33] Swyper: has joined #ruby
[03:43:18] t0x: has joined #ruby
[03:56:23] sauvin: has joined #ruby
[04:13:07] braincrash: has joined #ruby
[04:20:48] arescorpio: has joined #ruby
[04:26:31] themsay: has joined #ruby
[04:41:07] tdy: has joined #ruby
[04:50:54] rippa: has joined #ruby
[05:20:24] kapil____: has joined #ruby
[05:31:50] orbyt_: has joined #ruby
[05:51:54] mangold: has joined #ruby
[06:07:05] Devalo: has joined #ruby
[06:33:30] reber: has joined #ruby
[06:41:29] Devalo: has joined #ruby
[06:41:55] orbyt_: has joined #ruby
[06:42:22] Devalo: has joined #ruby
[07:05:23] za1b1tsu: has joined #ruby
[07:07:22] laaron: has joined #ruby
[07:11:41] Nicmavr: has joined #ruby
[07:13:26] mangold: has joined #ruby
[07:22:37] nowhere_man: has joined #ruby
[07:24:15] Milos: has joined #ruby
[07:24:23] cnsvc: has joined #ruby
[07:28:14] laaron-: has joined #ruby
[07:34:00] conta: has joined #ruby
[07:47:21] agent_white: has joined #ruby
[07:49:37] Devalo: has joined #ruby
[08:05:21] Wolland: has joined #ruby
[08:06:10] pietia: has joined #ruby
[08:11:28] phaul: has joined #ruby
[08:27:11] _whitelogger: has joined #ruby
[08:32:26] pietia: has joined #ruby
[08:39:11] _whitelogger: has joined #ruby
[08:47:22] Devalo: has joined #ruby
[09:06:27] alem0lars: has joined #ruby
[09:06:40] laaron: has joined #ruby
[09:07:35] alem0lars: has joined #ruby
[09:19:34] Devalo: has joined #ruby
[09:30:03] Dbugger: has joined #ruby
[09:40:20] kyrylo: has joined #ruby
[09:42:15] schleppel: has joined #ruby
[09:46:22] ellcs: has joined #ruby
[09:51:55] conta1: has joined #ruby
[10:03:11] _whitelogger: has joined #ruby
[10:17:54] zapata: has joined #ruby
[10:21:11] apparition: has joined #ruby
[10:21:49] Hanmac: has joined #ruby
[10:22:30] dionysus69: has joined #ruby
[10:30:12] _whitelogger: has joined #ruby
[10:32:37] yxhuvud: has joined #ruby
[10:39:23] alexeev: has joined #ruby
[10:41:00] gix: has joined #ruby
[10:41:58] agent_white: has joined #ruby
[10:49:36] nucc: has joined #ruby
[10:52:29] nucc_: has joined #ruby
[11:07:58] pietia: has joined #ruby
[11:12:07] c0mrade: has joined #ruby
[11:12:11] c0mrade: I've made an IRC bot that prints to a serial impact printer connected to a server of mine and put it on live stream on youtube at https://youtu.be/QT2hCBBP99Y if you join ##robot and send whatever text on the main channel it prints hehe
[11:12:39] rippa: has joined #ruby
[11:13:21] phaul: and in what way is that ruby related
[11:16:25] gigetoo: has joined #ruby
[11:16:45] Mike11: has joined #ruby
[11:30:11] _whitelogger: has joined #ruby
[11:34:19] Devalo: has joined #ruby
[11:37:04] Fernando-Basso: has joined #ruby
[11:37:08] gigetoo: has joined #ruby
[11:47:45] jrafanie: has joined #ruby
[11:53:32] tdy: has joined #ruby
[11:59:07] mikecmpbll: has joined #ruby
[12:13:45] pietia: has joined #ruby
[12:38:16] AJA4350: has joined #ruby
[12:51:21] Ai9zO5AP: has joined #ruby
[12:55:02] mikecmpbll: has joined #ruby
[13:00:49] suukim: has joined #ruby
[13:12:05] xco: has joined #ruby
[13:43:12] gheegh: has joined #ruby
[13:48:16] AJA4350: has joined #ruby
[13:59:41] dionysus70: has joined #ruby
[14:05:14] lucasb: has joined #ruby
[14:12:03] kyrylo: has joined #ruby
[14:18:49] jrafanie: has joined #ruby
[14:25:07] mangold: has joined #ruby
[14:26:54] Devalo: has joined #ruby
[14:35:39] vondruch: has joined #ruby
[14:41:35] dionysus69: has joined #ruby
[14:43:40] orbyt_: has joined #ruby
[14:46:16] gheegh: has joined #ruby
[14:52:59] wald0: has joined #ruby
[14:56:32] AJA4351: has joined #ruby
[14:57:15] jrafanie: has joined #ruby
[14:58:56] nowhere_man: has joined #ruby
[14:58:58] alem0lars: has joined #ruby
[14:59:10] Devalo: has joined #ruby
[15:00:39] houhoulis: has joined #ruby
[15:01:16] za1b1tsu: has joined #ruby
[15:01:53] jrafanie: has joined #ruby
[15:02:28] lele: has joined #ruby
[15:26:31] moei: has joined #ruby
[15:30:01] gheegh: has joined #ruby
[15:33:14] DTZUZO: has joined #ruby
[15:39:44] Swyper: has joined #ruby
[15:43:10] themsay: has joined #ruby
[16:02:45] AJA4351: has joined #ruby
[16:04:08] s3nd1v0g1us: has joined #ruby
[16:30:14] Swyper: has joined #ruby
[16:33:31] xco: has joined #ruby
[16:38:35] naught-fowl: has joined #ruby
[16:42:55] s3nd1v0g1us: has joined #ruby
[16:47:19] Swyper: has joined #ruby
[16:52:20] xco: i have an array that looks like this [[“sd”, “sdfa”], [“sdf”, afsa]]
[16:52:25] xco: how do i get just [“sd”, “sdfa”], [“sdf”, afsa]
[16:52:36] xco: in other words i want to remove the surrounding []
[16:52:42] Tau: has joined #ruby
[16:52:50] xco: i feel i should use #join but not sure what to join by
[16:53:19] xco: or maybe there’s a better method to “unarray” stuff
[16:54:50] al2o3-cr: [“sd”, “sdfa”], [“sdf”, afsa] is two separate arrays, do you want to store them in two variables?
[16:55:51] xco: let’s say variable = [[“sd”, “sdfa”], [“sdf”, afsa]]
[16:56:05] xco: what do i do to “variable” to get [“sd”, “sdfa”], [“sdf”, afsa]
[16:56:14] xco: will i need to store them in different arrays?
[16:57:44] al2o3-cr: you're not making sense. [“sd”, “sdfa”], [“sdf”, afsa] is two arrays
[16:59:17] xco: shoot came to my senses
[17:01:24] xco: i’ll just access that array with #first and #last
[17:01:50] xco: i wanted to dispaly [“sd”, “sdfa”], [“sdf”, afsa] like it is
[17:02:30] al2o3-cr: xco: as in stdout?
[17:02:38] xco: something like that
[17:02:39] themsay: has joined #ruby
[17:03:39] xco: awesome! :)
[17:03:43] al2o3-cr: that's if you want them on separate lines.
[17:03:52] xco: and if i don’t want them on separate lines?
[17:04:19] xco: #print ?
[17:04:46] al2o3-cr: p a, but that will give you back [ and ]
[17:05:34] al2o3-cr: you understand why don't you
[17:05:47] xco: yes i do
[17:05:58] xco: thanks ;)
[17:12:51] al2o3-cr: xco: with all these array questions, i'm curious, what are you doing?
[17:13:09] xco: i’ll show you when i’m done :D :D
[17:13:16] xco: maybe i’ll ask for a review
[17:13:26] al2o3-cr: xco: ok ;) i'll look forward to it!
[17:13:35] xco: which i think i’ll need beause i’m complicating stuff here haha
[17:14:13] al2o3-cr: xco: you can only try your best :P
[17:14:18] duderonomy: has joined #ruby
[17:17:54] t0xik: has joined #ruby
[17:23:57] reber: has joined #ruby
[17:24:38] Devalo: has joined #ruby
[17:26:53] themsay: has joined #ruby
[17:27:29] tdy: has joined #ruby
[17:28:58] Swyper: has joined #ruby
[17:30:14] Swyper: has joined #ruby
[17:35:52] old_relik: has joined #ruby
[17:36:24] old_relik: rspec question: how do I test the side-effect caused in a rescue block that re-raises a different exception
[17:37:28] phaul: what is the side effect?
[17:39:02] old_relik: https://dpaste.de/kUN5
[17:39:42] Devalo: has joined #ruby
[17:39:50] old_relik: the report_error function makes another 3rd party call that I would like to mock out
[17:40:11] Devalo: has joined #ruby
[17:40:48] old_relik: phaul: so one could just do https://dpaste.de/Ea7M
[17:41:09] old_relik: but then I don't know how to test whether the work in report_error was done as well
[17:42:02] old_relik: the work isn't a simple database change, if that were the case I could've done a compound assertion with "change"
[17:42:26] old_relik: the work requires me mocking Raven (a sentry client)
[17:42:49] old_relik: so something like this: "expect(Raven).to receive(:capture_message).and_return(true)"
[17:44:17] phaul: can you have two examples, one testing for exception, one testing for the mock? (you might need to stub in the case of the exception)
[17:45:28] phaul: context 'when bad things happen' { it 'is supposed to raise' ... and it 'is supposed to call' ... }
[17:51:51] Nicmavr: has joined #ruby
[17:54:25] phaul: old_relik: https://gist.github.com/phaul/cbb2a0e6cd53c7659fedcea7588a47eb
[17:58:23] phaul: old_relik: did that help?
[18:10:42] old_relik: phaul: thanks
[18:10:45] old_relik: that's what I had tried
[18:10:45] cd: has joined #ruby
[18:10:52] old_relik: but I think I'm doing something wrong in my code
[18:10:56] old_relik: the expect isn't working
[18:15:05] Devalo: has joined #ruby
[18:15:38] conta: has joined #ruby
[18:16:32] Renich: has joined #ruby
[18:21:32] nowhere_man: has joined #ruby
[18:22:01] orbyt_: has joined #ruby
[18:36:48] xco_: has joined #ruby
[18:41:44] orbyt_: has joined #ruby
[18:44:55] hiroaki: has joined #ruby
[18:46:45] orbyt_: has joined #ruby
[18:59:38] zachk: has joined #ruby
[19:03:25] kyrylo: has joined #ruby
[19:12:35] nucc: has joined #ruby
[19:17:34] rwb: has joined #ruby
[19:26:55] pietia: has joined #ruby
[19:27:02] jrafanie: has joined #ruby
[19:34:10] zachk: has joined #ruby
[19:40:16] cnsvc: has joined #ruby
[19:40:49] Renich: has joined #ruby
[19:42:27] dionysus69: has joined #ruby
[19:42:51] danguita: has joined #ruby
[19:47:59] themsay: has joined #ruby
[19:49:54] Swyper: has joined #ruby
[19:56:11] Emmanuel_Chanel: has joined #ruby
[20:04:43] s3nd1v0g1us: has joined #ruby
[20:06:54] pabs: has joined #ruby
[20:06:59] s3nd1v0g1us: has joined #ruby
[20:08:10] danguita: has joined #ruby
[20:08:51] Inline: has joined #ruby
[20:25:35] ur5us: has joined #ruby
[20:42:14] zachk: has joined #ruby
[20:47:44] mojtaba1: has joined #ruby
[20:48:55] mojtaba1: Hello, I am new to RoR. I would like to deploy my app to Heroku, but I am not going to host my static assets in Amazon S3. I have a shared host with Bluehost. Do you know how can I use that to host my images and other static files?
[20:49:58] ruby[bot]: Please join #RubyOnRails for Rails questions. You need to be identified with NickServ, see /msg NickServ HELP
[20:51:37] uplime: repeating it isn't going to change the message
[20:51:43] troulouliou_dev: has joined #ruby
[20:51:49] phaul: well it kind of did :)
[20:52:19] mojtaba1: Zarthus: uplime: I just wanted to connect to the channel and /msg NickServ HELP didn't help.
[20:52:52] Zarthus: you're specifically looking for /msg nickserv help register
[20:53:01] Zarthus: but i suppose that is fair feedback
[20:53:02] uplime: phaul: haha, the spirit of the message then
[20:53:42] mojtaba1: Zarthus: I am using pidgin, when I type msg nickserv help register, there is just a notification sound and nothing happens!
[20:54:12] Zarthus: the dick in me will reply with "pidgin is not a good irc client"
[20:54:56] Zarthus: yeah, I'm content with that message, I suppose.
[20:54:57] mojtaba1: Zarthus: mine is asking what is better?!
[20:55:19] Zarthus: literally even telnet would be better than telnet, but hexchat is often a decent starter
[20:55:32] Zarthus: s/telnet,/pidgin/
[21:02:30] zachk: has joined #ruby
[21:04:21] orbyt_: has joined #ruby
[21:05:15] xco: is it possible to sort an array of hash like this? [{"0"=>200}, {"1"=>150}, {"2"=>190}] since the keys are not named?
[21:06:26] baweaver: Depends on what you mean by sort.
[21:06:49] baweaver: Anything is sortable if you have a criteria to sort on
[21:07:24] symm-: has joined #ruby
[21:07:45] xco: by sort i mean i should get an array back that looks like [{"1"=>150},{"2"=>190}, {"0"=>200} ]
[21:08:07] xco: if the keys were named i could use #sort_by, here they are not
[21:08:17] symm-: any IDEs you using for ruby? primarily interested in "jump to definition" and optionally code completion
[21:08:49] xco: symm-: RubyMine
[21:09:13] symm-: "30-day trial"...
[21:09:20] xco: well :/
[21:09:30] symm-: you paid for it? :)
[21:09:40] xco: i used me school email, it’s free for students
[21:09:44] baweaver: xco: You can sort by more than keys
[21:10:36] baweaver: It looks like you're trying to sort by the value, but the problem is if there's more than one value in there
[21:10:43] baweaver: Why does the data look like that?
[21:10:52] baweaver: essentially it's mimicking array indexes
[21:11:05] mojtaba: has joined #ruby
[21:11:06] xco: baweaver: i made it like that because those values where from an array that i needed to keep track of the index
[21:11:14] xco: yes i know
[21:11:16] xco: i made it like that
[21:11:28] baweaver: What does the original look like, and what problem are you trying to solve?
[21:11:56] xco: ok so here’s the problem
[21:11:59] xco: i have an array like this
[21:12:04] xco: [1, 4, 5]
[21:12:29] xco: ok bad example that’s sorted already :P
[21:12:33] xco: say that array is this
[21:12:39] xco: []4, 1, 5]
[21:12:48] xco: [4, 1, 5]
[21:12:49] Swyper: has joined #ruby
[21:12:58] xco: i know the indexes and what to keep track of it
[21:13:35] xco: but would like to have that sorted (with the indexes) so i can use the index for something else
[21:13:56] xco: in short to tell someone that index “X” has the least value or max value for example
[21:13:59] baweaver: &ri Enumerable#each_with_index
[21:13:59] rubydoc: https://ruby-doc.org/core-2.6/Enumerable.html#method-i-each_with_index
[21:14:06] xco: instead of telling the value itself
[21:14:48] xco: i used #each_with_index to make the array look like this [{"0"=>200}, {"1"=>150}, {"2"=>190}] in the first place
[21:14:52] baweaver: >> [4, 1, 5].each_with_index.max_by(&:last)
[21:14:53] ruby[bot]: baweaver: # => [5, 2] (https://eval.in/1086876)
[21:15:04] baweaver: >> [4, 1, 5].each_with_index.minmax_by(&:last)
[21:15:05] ruby[bot]: baweaver: # => [[4, 0], [5, 2]] (https://eval.in/1086878)
[21:15:15] baweaver: >> [4, 1, 5].each_with_index.sort_by(&:last)
[21:15:16] ruby[bot]: baweaver: # => [[4, 0], [1, 1], [5, 2]] (https://eval.in/1086879)
[21:15:29] baweaver: ack, by first rather
[21:16:56] xco: hmm that’s workign on an array of integers
[21:18:15] xco: symm-: btw Sublime Text is not an IDE but i think it can do what you want
[21:19:22] baweaver: You're still working with the first element in any case
[21:19:28] baweaver: Just do something with the block
[21:19:29] symm-: sublime can do jump to definition?
[21:20:25] xco: symm-: i think so, yes. i’ve seen that before. not sure if it was with a plugin but rather not. maybe try googling it to find out or check the manual
[21:21:14] planigan: has joined #ruby
[21:21:22] symm-: but I was just wondering what you guys actually use irl
[21:21:52] symm-: my ruby programming so far has been using a text editor whose only programming feature had been syntax coloring...
[21:22:26] baweaver: Mostly Sublime.
[21:22:54] xco: I use Sublime too nothing more
[21:23:03] baweaver: Been trending towards VS Code because of some React work
[21:23:16] symm-: so sublime can jump to definition? sorry for belaboring the point but it's essential to me
[21:23:29] Inline: has joined #ruby
[21:25:18] symm-: I have some brief experience using VS code on linux for C# and all I can tell is it has been terrible
[21:25:36] al2o3-cr: xco: [{"0"=>200}, {"1"=>150}, {"2"=>190}].sort_by &:values (if you want to sort by values)
[21:27:12] al2o3-cr: why are indices strings and values integers?
[21:27:51] teej: has joined #ruby
[21:30:34] al2o3-cr: i've no eye dear :P
[21:31:43] xco: al2o3-cr: perfect :D
[21:31:58] xco: well i can use anythign i was as keys right
[21:32:02] xco: but i think you’re right
[21:32:05] xco: it doesn’t make much sense
[21:32:24] xco: both can be integers so i don’t have to convert the keys again later
[21:32:34] xco: since i’ll use them to grab something from an array
[21:32:44] al2o3-cr: again, i wish to see this when completed! ;)
[21:32:57] xco: al2o3-cr: hahahhahaha you’ll see no worries
[21:36:01] cthulchu_: has joined #ruby
[21:38:38] gheegh: has joined #ruby
[21:47:21] hightower2: has joined #ruby
[21:53:09] orbyt_: has joined #ruby
[21:57:48] dviola: has joined #ruby
[22:19:51] ellcs: has joined #ruby
[22:27:11] _whitelogger: has joined #ruby
[22:39:34] nowhere_man: has joined #ruby
[22:56:34] hightower2: has joined #ruby
[22:58:32] preller: has joined #ruby
[23:02:02] wald0: has joined #ruby
[23:04:54] FastJack: has joined #ruby
[23:08:27] conta: has joined #ruby
[23:21:09] Devalo: has joined #ruby
[23:30:49] bga57: has joined #ruby
[23:31:12] AJA4350: has joined #ruby