« Back to channel list

#ruby - 18 March 2019

« Back 1 day
[00:06:23] jottr: has joined #ruby
[00:10:13] P-NuT: has joined #ruby
[00:17:38] dar123: has joined #ruby
[00:27:21] jottr: has joined #ruby
[00:27:57] bjpenn: has joined #ruby
[00:40:21] NeilCarvalho: has joined #ruby
[00:41:37] urbanmonk: has joined #ruby
[00:42:07] urbanmonk: has joined #ruby
[00:47:49] elcontrastador: has joined #ruby
[00:48:14] jottr: has joined #ruby
[01:09:08] jottr: has joined #ruby
[01:10:17] laaron: has joined #ruby
[01:10:42] Krebsgewehr: has joined #ruby
[01:14:19] mochiyoda: has left #ruby: ("Konversation terminated!")
[01:24:07] Autolycus: has joined #ruby
[01:30:04] jottr: has joined #ruby
[01:32:07] jrafanie: has joined #ruby
[01:36:00] rafadc: has joined #ruby
[01:47:20] Devalo: has joined #ruby
[01:48:35] dar123: has joined #ruby
[01:50:59] jottr: has joined #ruby
[01:56:09] t0xik: has joined #ruby
[02:02:01] s3nd1v0g1us: has joined #ruby
[02:07:35] dar123: has joined #ruby
[02:11:54] jottr: has joined #ruby
[02:22:36] Swyper: has joined #ruby
[02:26:29] mangold: has joined #ruby
[02:32:49] jottr: has joined #ruby
[02:50:50] c0dec: has joined #ruby
[02:52:28] saysjonathan: has joined #ruby
[02:53:42] jottr: has joined #ruby
[02:58:33] duderonomy: has joined #ruby
[03:01:35] duderonomy: has joined #ruby
[03:02:41] duderonomy: has joined #ruby
[03:03:22] duderonomy: has joined #ruby
[03:04:14] duderonomy: has joined #ruby
[03:04:53] duderonomy: has joined #ruby
[03:05:39] duderonomy: has joined #ruby
[03:07:23] Swyper: has joined #ruby
[03:08:05] duderonomy: has joined #ruby
[03:10:23] duderonomy: has joined #ruby
[03:14:40] jottr: has joined #ruby
[03:15:21] duderonomy: has joined #ruby
[03:19:09] haivron: has joined #ruby
[03:19:37] laaron: has joined #ruby
[03:20:28] xlued: has joined #ruby
[03:22:46] iMadper: has joined #ruby
[03:30:53] SuperLag: has joined #ruby
[03:52:36] ur5us: has joined #ruby
[03:55:03] jottr: has joined #ruby
[04:09:24] braincrash: has joined #ruby
[04:15:57] jottr: has joined #ruby
[04:21:08] yaewa: has joined #ruby
[04:31:33] dellavg__: has joined #ruby
[04:36:52] jottr: has joined #ruby
[04:42:25] laaron: has joined #ruby
[04:42:54] marz_d`ghostman: has joined #ruby
[04:43:16] marz_d`ghostman: When your app uses secret keys and stuff for api calls, where's the best place to put it? as environment variable on the system?
[04:45:19] havenwood: marz_d`ghostman: Rails uses encrypted credentials these days. Lots of folk still use environment variables.
[04:45:45] Devalo: has joined #ruby
[04:46:29] marz_d`ghostman: havenwood: I'll take a look at encrypted credentials, thanks, I'm currently using environment variable by the way, was just wondering if there is a more secure way to do it :)
[04:47:17] havenwood: marz_d`ghostman: Here's simple encryption with the JOSE gem, fwiw: https://gist.github.com/havenwood/e18de5fa23ec1c49e3feab493d579909
[04:53:37] sagax: has joined #ruby
[04:57:49] jottr: has joined #ruby
[04:59:14] mangold: has joined #ruby
[05:02:59] Swyper: has joined #ruby
[05:14:27] baweaver: https://medium.com/@baweaver/ruby-2-7-numbered-parameters-3f5c06a55fe4
[05:18:44] jottr: has joined #ruby
[05:26:12] laaron: has joined #ruby
[05:33:12] Emmanuel_Chanel: has joined #ruby
[05:36:16] dar123: has joined #ruby
[05:47:56] Devalo: has joined #ruby
[05:52:55] laaron: has joined #ruby
[05:54:31] jottr: has joined #ruby
[05:55:18] laaron: has joined #ruby
[05:55:52] Devalo: has joined #ruby
[06:15:53] leftylink: ah interesting
[06:20:49] conta: has joined #ruby
[06:26:51] segy: has joined #ruby
[06:28:00] dar123: has joined #ruby
[06:31:44] jottr: has joined #ruby
[06:45:39] jottr: has joined #ruby
[06:46:00] JasonO: has joined #ruby
[06:51:25] t0xik: i'm loving ruby :D
[06:54:06] segy: has joined #ruby
[07:02:26] segy: has joined #ruby
[07:18:26] cfjk: has joined #ruby
[07:24:09] clemens3: has joined #ruby
[07:24:50] qual: has joined #ruby
[07:27:04] johnny56: has joined #ruby
[07:29:36] DaniG2k: has joined #ruby
[07:44:49] jottr: has joined #ruby
[07:46:53] _joes_: has joined #ruby
[07:47:28] tdy1: has joined #ruby
[07:52:28] _joes_: has joined #ruby
[07:53:29] tdy1: has joined #ruby
[07:54:04] za1b1tsu: has joined #ruby
[07:58:09] cgfbee: has joined #ruby
[07:59:30] Devalo: has joined #ruby
[08:05:47] ur5us: has joined #ruby
[08:07:58] TomyWork: has joined #ruby
[08:10:05] clemens3: has joined #ruby
[08:18:31] dionysus69: has joined #ruby
[08:21:11] reber: has joined #ruby
[08:28:48] vondruch: has joined #ruby
[08:29:09] Xeago_: has joined #ruby
[08:35:44] _joes_: has joined #ruby
[08:40:41] iMadper: has joined #ruby
[08:43:47] schleppel: has joined #ruby
[08:48:25] jottr: has joined #ruby
[08:59:12] tdy1: has joined #ruby
[09:02:08] sagax: has joined #ruby
[09:05:59] suukim: has joined #ruby
[09:08:41] Flyingdog: has joined #ruby
[09:09:19] jottr: has joined #ruby
[09:10:34] aufi: has joined #ruby
[09:13:44] marcoecc: has joined #ruby
[09:16:06] suukim: has joined #ruby
[09:18:15] ur5us: has joined #ruby
[09:19:07] alem0lars: has joined #ruby
[09:20:07] Emmanuel_Chanel: has joined #ruby
[09:23:18] bjpenn: has joined #ruby
[09:27:58] grr12314: has joined #ruby
[09:30:13] jottr: has joined #ruby
[09:32:00] TomyWork: has joined #ruby
[09:33:14] AJA4350: has joined #ruby
[09:36:35] dtzuzu: has joined #ruby
[09:37:30] DTZUZO: has joined #ruby
[09:40:42] jottr: has joined #ruby
[09:44:12] ellcs: has joined #ruby
[09:44:37] Nicmavr: has joined #ruby
[09:46:12] laaron: has joined #ruby
[09:51:04] alem0lars: has joined #ruby
[09:56:13] _joes_: has joined #ruby
[09:58:40] jottr: has joined #ruby
[10:06:00] apparition: has joined #ruby
[10:08:03] tdy1: has joined #ruby
[10:17:20] mikecmpbll: has joined #ruby
[10:18:23] nchambers: has joined #ruby
[10:20:08] mangold: has joined #ruby
[10:49:10] themsay: has joined #ruby
[11:02:13] haivron: has joined #ruby
[11:08:04] tdy1: has joined #ruby
[11:15:16] laaron: has joined #ruby
[11:17:35] sina: has joined #ruby
[11:20:49] TheBrayn: has joined #ruby
[11:45:08] jottr_: has joined #ruby
[12:12:10] Emmanuel_Chanel: has joined #ruby
[12:13:30] laaron: has joined #ruby
[12:14:04] tdy1: has joined #ruby
[12:17:37] conta1: has joined #ruby
[12:32:54] jrafanie: has joined #ruby
[12:34:06] t0xik: has joined #ruby
[12:36:25] bmurt: has joined #ruby
[12:38:06] ubuntuisloved: has joined #ruby
[12:48:30] tdy1: has joined #ruby
[12:50:09] leah2: has joined #ruby
[12:52:26] saysjonathan: has joined #ruby
[13:01:59] laaron: has joined #ruby
[13:05:07] ubuntuisloved: has joined #ruby
[13:10:40] _joes_: has joined #ruby
[13:13:51] s2013: has joined #ruby
[13:18:26] jcalla: has joined #ruby
[13:24:48] InfinityFye: has joined #ruby
[13:24:58] jaytull: has joined #ruby
[13:25:42] InfinityFye: has left #ruby: ()
[13:36:51] NeilCarvalho: has joined #ruby
[13:37:15] jrafanie: has joined #ruby
[13:38:33] guardian: has joined #ruby
[13:39:48] dionysus70: has joined #ruby
[13:41:05] tdy1: has joined #ruby
[13:46:23] darix: baweaver: I am not really sure why we needed this
[13:51:44] griffindy: has joined #ruby
[13:51:48] jaytull: What, IRC? ;-)
[13:52:25] darix: jaytull: the positional parameter thingie
[13:52:27] TheBrayn: IRC was a mistake
[13:52:47] TheBrayn: I think it's not too bad, better than nondescript variable names
[13:55:30] joast: has joined #ruby
[14:00:08] cow[moo]: has joined #ruby
[14:00:30] Stan: has joined #ruby
[14:10:49] xco: has joined #ruby
[14:13:13] xco: Hi. What will be the best way to determing if a string has repeating strings? for example this should return true “abcabcabcabc”
[14:13:25] xco: sorry this should return false “abcabcabcabc”
[14:13:38] xco: this should return true “utdutdtdutd"
[14:13:47] xco: not sure how to find repeating strings in a string
[14:14:09] grr12314: explain the logic in english
[14:14:24] tbuehlmann: what's your definition of "repeating"?
[14:14:27] grr12314: your false example looks like repeating to me
[14:16:00] xco: yeah i made a mistake
[14:17:07] xco: maybe i’ll a simpler example
[14:17:26] xco: something like "xyxy" should return false
[14:17:29] xco: likewise
[14:17:35] xco: “aa”
[14:17:41] xco: because there’s a repeating string
[14:18:19] xco: this "utdutdtdutd" has no repeating string and i’ll like a way to track that
[14:18:39] Tau: has joined #ruby
[14:18:40] xco: so i want to get true for “"utdutdtdutd”
[14:19:07] ytti: abcabcabcabck would be true also?
[14:19:44] xco: ytti: “abcabcabcabck” the “k” is not repeating so it should return true
[14:20:10] laaron: has joined #ruby
[14:21:01] ytti: abaaba is this false?
[14:21:06] Swyper: has joined #ruby
[14:21:08] xco: so basically the challenge i picked says this “We'll define a string as prime if it cannot be constructed by concatenating some (more than one) equal strings together.”
[14:21:40] xco: “For example, "abac" is prime, but "xyxy" is not("xyxy" = "xy" + "xy”).”
[14:21:57] grr12314: (s.size-1).times.any?{|x|s[0..x]*(s.size/(x+1))==s}
[14:22:03] ytti: challenge you picked? :>
[14:22:10] xco: yeah from codwars
[14:22:19] xco: practice site :)
[14:22:52] phaul: you can limit the loop to prime factors of size if you want to
[14:23:42] grr12314: yea if i know how :p
[14:23:48] grr12314: actually may not be prime
[14:25:20] xco: ytti: “abaaba” is repeating, should be false
[14:25:41] phaul: &>> require 'prime'; 12.prime_division.map(&:first)
[14:25:45] rubydoc: # => [2, 3] (https://carc.in/#/r/6iu9)
[14:27:04] grr12314: ok i see. the substring size isnt necesserily prime but its repeat count is
[14:27:12] Onwarion: has joined #ruby
[14:28:30] xco: that’s works on integers
[14:28:38] xco: unless it’s not meant for me
[14:29:20] phaul: if it repeats a*b times then (thing * b) it also repeats a times
[14:30:35] grr12314: still no need to involve prime lib, seems overkill
[14:31:04] grr12314: (s.size-1).times.any?{|x|s.size%x==0&&s[0..x]*(s.size/(x+1))==s}
[14:31:16] grilix: has joined #ruby
[14:31:23] grr12314: if you want to avoid some pointless ops
[14:31:25] cranq: has joined #ruby
[14:32:10] grr12314: for small strings probably no need to bother avoiding them even
[14:32:25] Fusl: has joined #ruby
[14:32:47] phaul: yeah. It was just an idea. I am not saying that's the way you should do it
[14:33:35] Swyper: has joined #ruby
[14:33:37] xco: right :)
[14:35:17] Fusl: has joined #ruby
[14:36:51] Fusl: has joined #ruby
[14:38:38] hightower3: has joined #ruby
[14:39:33] hightower3: has joined #ruby
[14:40:08] Azure: has joined #ruby
[14:42:40] stryek: has joined #ruby
[14:43:24] Inline: has joined #ruby
[14:48:07] AJA4351: has joined #ruby
[14:48:10] ytti: quite, rather many optimzation there could be
[14:48:31] ytti: like for example, you only need to figure out the lengths which are divisible by the total length of the string
[14:48:48] ytti: but premature optimsation is source of great many evil
[14:54:08] grilix: has joined #ruby
[14:58:48] ghoti: has joined #ruby
[15:02:05] ghoti: has left #ruby: ()
[15:02:12] jaytull: has joined #ruby
[15:16:17] Dbugger: has joined #ruby
[15:20:16] phaul: &>> require 'prime'; 'abcabc'.yield_self { |s| s.length.prime_division.any? { |p, _| p < s.length && s[0,p] * (s.length / p) == s } }
[15:20:18] rubydoc: # => true (https://carc.in/#/r/6iuh)
[15:20:35] polishdub: has joined #ruby
[15:21:26] grr12314: s[a,b] same as s[a..b] ?
[15:21:35] grr12314: &>> require 'prime'; 'zzzzz'.yield_self { |s| s.length.prime_division.any? { |p, _| p < s.length && s[0,p] * (s.length / p) == s } }
[15:21:36] rubydoc: # => false (https://carc.in/#/r/6iui)
[15:21:53] grr12314: oops, sorry for breaking it phaul :p
[15:22:00] phaul: no. p number of elemems startting from 0
[15:22:24] phaul: 0...p would be the same
[15:23:04] jrafanie: has joined #ruby
[15:23:30] phaul: oh. wait a minute...
[15:23:41] phaul: &>> require 'prime'; 'abcdabcd'.yield_self { |s| s.length.prime_division.any? { |p, _| p < s.length && s[0,p] * (s.length / p) == s } }
[15:23:43] rubydoc: # => false (https://carc.in/#/r/6iuj)
[15:24:17] phaul: exactly the thing you mentioned above on substring not being prime length
[15:24:23] Swyper: has joined #ruby
[15:24:35] grr12314: just swap p and length/p
[15:24:44] _joes_: has joined #ruby
[15:27:37] reber: has joined #ruby
[15:28:25] grr12314: the block could also be s.chars.each_slice(X).to_a.uniq.size==1 or something :p
[15:34:25] jaytull: has joined #ruby
[15:35:12] phaul: it would also be broken for prime length single char strings like 'aaa' assuming that's supposed to be repeating
[15:35:42] phaul: "ytti | but premature optimsation is source of great many evil" :D
[15:40:44] duderonomy: has joined #ruby