havenwood changed the topic of #ruby to: Rules & more: https://ruby-community.com | Ruby 2.6.1, 2.5.3, 2.4.5: https://www.ruby-lang.org | Paste 4+ lines of text to https://dpaste.de/ and select Ruby as the language | Rails questions? Ask in #RubyOnRails | Books: https://goo.gl/wpGhoQ | Logs: https://irclog.whitequark.org/ruby | Can't talk? Register/identify with Nickserv first!
jyaworski has joined #ruby
<Darmani> Okay I think I got it
<Darmani> I mean it seems to work when I try it in irb
<Darmani> nvm
<leftylink> I suddenly had a crazy thought. what if I wanted to use rubydoc to test whether someone's gist worked. how will I instruct it to load the gist... well...!!!!!!
<rubydoc> stderr: -e:2:in `<main>': uninitialized constant Grade (NameError) (https://carc.in/#/r/6e7h)
<leftylink> I am a bad person
<leftylink> oh
<leftylink> that is unfortunate
<Darmani> You tried.
<leftylink> does the curl part even work?
<rubydoc> # => "" (https://carc.in/#/r/6e7i)
<leftylink> okay guess not
<leftylink> &>> `wget -O - example.com`[0, 30]
<rubydoc> stderr: -e:2:in ``': No such file or directory - wget (Errno::ENOENT) (https://carc.in/#/r/6e7j)
nchambers has quit [Remote host closed the connection]
<leftylink> I can do the http get from ruby code natively but it sounds like work
<leftylink> &>> require 'net/http'; Net::HTTP.get('example.com', '/index.html')[0, 30]
<rubydoc> stderr: playpen: application terminated abnormally with signal 31 (Bad system call) (https://carc.in/#/r/6e7k)
<leftylink> okay
<leftylink> I mean I guess that's to be expected
<leftylink> and it encourages people to use more minimal examples
<Darmani> yeah maybe
<leftylink> or compress their entire class into a one-liner, but nobody wants to read an entire class as a one-liner
<Darmani> okay
<Darmani> this is better
jyaworski has quit [Ping timeout: 246 seconds]
<havenwood> Darmani: You can drop the `self.`
<Darmani> Is it implied? Okay
<Darmani> I just like to be thorough.
<havenwood> Darmani: You have a valid arguement.
<Darmani> Still not correct though. It thinks the "a-" is greater than an "a".
<Darmani> And I don't think it works like that.
<havenwood> Darmani: You might consider renaming `string` to `grade` for symmetry and conveying meaning.
<havenwood> Darmani: you need to `include Comparable`
<Darmani> On line 4?
<Darmani> Comparable isn't included??
<havenwood> Darmani: I'd do 2, but pick your poison.
<havenwood> Darmani: No, it's up to you to mix it in.
<havenwood> err
<leftylink> hopefully, it makes sense why the current code would (wrongly) consider "a-" to be greater than "a". that should hopefully give hints as to what it should do instead
[Butch] has quit [Quit: Textual IRC Client: www.textualapp.com]
blackmesa has quit [Ping timeout: 264 seconds]
<havenwood> though a- with a sword should clearly defeat a, so ¯\_(ツ)_/¯
<Darmani> haha
<havenwood> Darmani: @grade is quicker yet than #grade, on line 13 - and it simplifies meaning for the reader
<Darmani> kk
<havenwood> (I should have just said that immediately, multitasking)
<havenwood> I like using instance variables directly.
<Darmani> I mean why not use them?
<havenwood> &ri Comparable
<havenwood> Darmani: They're light and quick and signify to the reader that you're getting and setting directly without having to read more.
nwradio has quit [Read error: Connection reset by peer]
nwradio has joined #ruby
mkroman has quit [Remote host closed the connection]
<havenwood> Darmani: I usually put my includes/prepends/extends up top.
<Darmani> makes sense
mkroman has joined #ruby
jyaworski has joined #ruby
<Darmani> behlod
<Darmani> wait
<Darmani> BEHOLD
jyaworski has quit [Ping timeout: 240 seconds]
<havenwood> Darmani: Congrats! You can drop the `return`s
aspiers has quit [Ping timeout: 250 seconds]
<Darmani> Okay ^_^
<leftylink> the reason you should be suspicious is that you notice that the result of <=> depends nothing on `other_grade`
jyaworski has joined #ruby
<leftylink> which will mean that C <=> A will surely give the same result as C <=> F
<leftylink> which should cause suspicion
<leftylink> to put it lightly
<Darmani> hmmm you're right
<havenwood> Darmani: Also a bit opposite on the +/0
<havenwood> +/-
<Darmani> What is that?
<havenwood> + with +, - with -
<havenwood> you have + with -, - with +
<havenwood> Darmani: Grade.new("+") > Grade.new("-") #=> false # problem
<Darmani> oh
<leftylink> as it has been made apparent, sorting solely on letter doesn't work. and sorting solely on the symbol doesn't work, because then C+ <=> A- will surely give the same answer as C+ <=> D-
<Darmani> So we have to combine the two? And check that way?
<leftylink> thus, we see it is necessary to consider both of those components when sorting
<leftylink> or comparing, rather
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jyaworski has quit [Ping timeout: 244 seconds]
DarthGandalf has joined #ruby
bmurt has joined #ruby
<Darmani> Okay so I thought this would work and it did if I only gave it one grade
<Darmani> But if I give it two grades then it messes up for some reason.
<Darmani> nvm I'm just confused
cthulchu_ has quit [Ping timeout: 250 seconds]
tdy has joined #ruby
<leftylink> you know, I was presenting this as a primary+secondary sort kind of thing, but it occurs to me that converting each possible grade to a number would work as well for this purpose
lucasb has quit [Quit: Connection closed for inactivity]
<leftylink> at any rate, it seems prudent to test each combination of possible grades. if we are to assume they can only go from A to F, there are so few of them that one should do it exhaustively
<leftylink> with something like
<leftylink> %w(A+ A A- B+ B B- C+ C C- D+ D D- F).map { |g| [g, Grade.new(g)] }.combination(2) { |(s1, g1), (s2, g2)| puts "#{s1} should > #{s2}" unless g1 > g2; puts "#{s2} should be < #{s1}" unless g2 < g1 }
<Darmani> Yes I see that.
dviola has quit [Quit: WeeChat 2.4]
Dbugger has quit [Ping timeout: 268 seconds]
crankharder has quit [Ping timeout: 250 seconds]
Xiti has quit [Quit: Xiti]
mad_hatter has joined #ruby
<mad_hatter> Does anyone have any general ideas/can point me to a good doc/tutorial for how to go about implementing integration/unit tests into a code base without any for the purposes of CI/CD?
mad_hatter has quit [Read error: Connection reset by peer]
Xiti has joined #ruby
orbyt_ has quit [Ping timeout: 255 seconds]
mad_hatter has joined #ruby
<mad_hatter> Does anyone have any general ideas/can point me to a good doc/tutorial for how to go about implementing integration/unit tests into a code base without any for the purposes of CI/CD?
<havenwood> mad_hatter: Are you familiar with Minitest?
<bambanx> hey
<havenwood> bambanx: hi
<bambanx> howdy havenwood ?
<havenwood> howdy
<bambanx> i wrote well?
<bambanx> i am not native english
<bambanx> spanish from chile
<bambanx> :D
<havenwood> welcome
<bambanx> cool
<bambanx> i am old here tho
<bambanx> :D
<havenwood> welcome back!
<bambanx> like15 years ago
<bambanx> thanks
<mad_hatter> havenwood: i am not
<havenwood> mad_hatter: Minitest is the testing library that ships with Ruby.
<havenwood> mad_hatter: Minitest and RSpec are the two most popular Ruby testing gems.
renich_ has quit [Quit: renich_]
renich_ has joined #ruby
xrexeon has quit [Read error: Connection reset by peer]
<Darmani> Okay so this isn't correct but I don't know what is
<Darmani> How do you tell the operator how to judge to values at the same time? Or am I supposed to lookup one value and then the other value.
<Darmani> Separate them somehow?
<Darmani> Obviously it should check the letter and then the symbol but I don't know how I would write it.
johnny56 has quit [Ping timeout: 272 seconds]
johnny56_ has joined #ruby
mangold has joined #ruby
mad_hatter has quit [Ping timeout: 250 seconds]
orbyt_ has joined #ruby
AJA4350 has quit [Remote host closed the connection]
cliluw has quit [Read error: Connection reset by peer]
ogres has joined #ruby
wildermind has quit [Quit: Connection closed for inactivity]
jyaworski has joined #ruby
jyaworski has quit [Ping timeout: 250 seconds]
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
dviola has joined #ruby
cschneid has joined #ruby
cschneid has quit [Ping timeout: 268 seconds]
bruce_lee has quit [Ping timeout: 255 seconds]
jyaworski has joined #ruby
braincrash has quit [Read error: Connection reset by peer]
Dreamer3 has joined #ruby
braincrash has joined #ruby
rprimus_ has quit [Ping timeout: 255 seconds]
jyaworski has quit [Ping timeout: 250 seconds]
rprimus has joined #ruby
Dreamer3 has quit [Quit: Leaving...]
cschneid has joined #ruby
dviola has quit [Quit: WeeChat 2.4]
gix has quit [Ping timeout: 250 seconds]
tdy has quit [Ping timeout: 250 seconds]
jyaworski has joined #ruby
crankharder has joined #ruby
jyaworski has quit [Ping timeout: 250 seconds]
<bambanx> why ruby people is friendly?
t0x has quit [Quit: Connection closed for inactivity]
cschneid has quit [Ping timeout: 245 seconds]
crankharder has quit [Ping timeout: 245 seconds]
tdy has joined #ruby
<al2o3-cr> &>> trap(:XCPU) { abort "[TIMED OUT]" }; Process.setrlimit(:CPU, 2, -1); loop {}
<rubydoc> stderr: playpen: application terminated abnormally with signal 31 (Bad system call) (https://carc.in/#/r/6e9o)
aqd has joined #ruby
aqd has quit [Remote host closed the connection]
aqd has joined #ruby
KnownSyntax_ is now known as KnownSyntax
t0x has joined #ruby
_whitelogger has joined #ruby
cschneid has joined #ruby
rippa has joined #ruby
arekushi has joined #ruby
mangold has quit [Quit: This computer has gone to sleep]
mniip has quit [Ping timeout: 624 seconds]
ogres has quit [Quit: Connection closed for inactivity]
aspiers has joined #ruby
aqd has quit [Quit: Leaving]
<vdl> how do I parse an INI like configuration file in Ruby? (pretty basic, no string quoting, multiple sections with the same name allowed)
bambanx has quit [Quit: Leaving]
<al2o3-cr> vdl: you could use the inifile gem
Darmani has quit [Ping timeout: 256 seconds]
Autolycus has joined #ruby
cschneid has quit [Ping timeout: 244 seconds]
sauvin has joined #ruby
mniip has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Autolycus has quit []
jyaworski has joined #ruby
mangold has joined #ruby
Puffball has joined #ruby
kapil____ has joined #ruby
blackmesa has joined #ruby
jyaworski has quit [Ping timeout: 244 seconds]
reber has joined #ruby
jyaworski has joined #ruby
connor_goodwolf has quit [Ping timeout: 250 seconds]
wilbert has joined #ruby
jyaworski has quit [Ping timeout: 245 seconds]
ravenousmoose has joined #ruby
jyaworski has joined #ruby
fluxAeon has quit [Ping timeout: 255 seconds]
fluxAeon has joined #ruby
jyaworski has quit [Ping timeout: 255 seconds]
tdy has quit [Ping timeout: 250 seconds]
amosbird has quit [Ping timeout: 258 seconds]
amosbird has joined #ruby
jcarl43 has quit [Quit: WeeChat 2.4]
themsay has quit [Ping timeout: 255 seconds]
zapata has quit [Ping timeout: 258 seconds]
zapata has joined #ruby
ravenousmoose has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
sameerynho has joined #ruby
Puffball has quit [Remote host closed the connection]
wilbert has quit [Ping timeout: 255 seconds]
_whitelogger has joined #ruby
al2o3-cr has quit [Quit: WeeChat 2.4]
al2o3-cr has joined #ruby
MyMind has joined #ruby
Sembei has quit [Ping timeout: 255 seconds]
nwradio has quit [Quit: Ping timeout (120 seconds)]
nwradio has joined #ruby
blackmesa has quit [Ping timeout: 264 seconds]
<c-c> If I have a method that creates a class instance, its not possible to refer to that instance from a block passed into that method for yielding?
Onwarion has joined #ruby
gix has joined #ruby
<tbuehlmann> c-c: you can call `yield your_instance` which will run the block with that variable as block variable
<c-c> >class Spawner; def initialize; @foo=0; end; def spa; bar = @foo + 1; yield; end; end; s=Spawner.new; s.spa do; p bar; end
<c-c> &> class Spawner; def initialize; @foo=0; end; def spa; bar = @foo + 1; yield; end; end; s=Spawner.new; s.spa do; p bar; end
<rubydoc> parser error at position 0 around `>'
Dbugger has joined #ruby
<c-c> &>> "test"
<rubydoc> # => "test" (https://carc.in/#/r/6ebd)
<c-c> &>> class Spawner; def initialize; @foo=0; end; def spa; bar = @foo + 1; yield; end; end; s=Spawner.new; s.spa do; p bar; end
<rubydoc> stderr: -e:2:in `block in <main>': undefined local variable or method `bar' for main:Object (NameError) (https://carc.in/#/r/6ebe)
reber has quit [Remote host closed the connection]
blackmesa has joined #ruby
<c-c> (so I'm after bar, in the spa do; end; -block)
bruce_lee has joined #ruby
<c-c> B)
aqd has joined #ruby
blackmesa has quit [Ping timeout: 264 seconds]
cnsvc_ has quit [Read error: Connection reset by peer]
Fusl has quit [Read error: Connection reset by peer]
cd has quit [Write error: Connection reset by peer]
laaron has quit [Read error: Connection reset by peer]
laaron has joined #ruby
Fusl has joined #ruby
cd has joined #ruby
cnsvc_ has joined #ruby
znz_jp has joined #ruby
bruce_lee has quit [Remote host closed the connection]
connor_goodwolf has joined #ruby
cschneid has joined #ruby
cnsvc_ has quit [Ping timeout: 256 seconds]
marmotini_ has joined #ruby
themsay has joined #ruby
renich_ has quit [Remote host closed the connection]
TomyLobo has joined #ruby
cd has quit [Quit: cd]
cschneid has quit [Ping timeout: 268 seconds]
wildermind has joined #ruby
conta has joined #ruby
conta has quit [Ping timeout: 246 seconds]
ravenousmoose has joined #ruby
mangold has quit [Quit: This computer has gone to sleep]
<phaul> leftylink: if you come up with a way on carc.in to load a gist, I integrate it into rubydoc the same way as &ast>>, &asm>> etc works it could be &gist>>
jyaworski has joined #ruby
jyaworski has quit [Ping timeout: 240 seconds]
clemens3 has joined #ruby
Fernando-Basso has joined #ruby
sacomo has joined #ruby
nowhereman has quit [Read error: Connection reset by peer]
<al2o3-cr> phaul: what do you mean? grab the gist content and evaluate it on carc.in?
<phaul> yeah, that's what leftylink was playing with ^
<phaul> it's a good idea, but I don't think it's possible
<phaul> I mean grabbing it using carc.in
<al2o3-cr> oh, right, yes. that will be handy ;)
<phaul> but.. I could grab it myself. that shouldn't be security risk. It's just web requests, based on strings.
<phaul> yeah. ok. I'll do this
<al2o3-cr> sure. pretty positive carc.in is well sandboxed.
ellcs has joined #ruby
lucasb has joined #ruby
mangold has joined #ruby
ellcs has quit [Ping timeout: 252 seconds]
mangold has quit [Quit: This computer has gone to sleep]
jyaworski has joined #ruby
dionysus70 has joined #ruby
jyaworski has quit [Ping timeout: 255 seconds]
TheBloke has joined #ruby
mangold has joined #ruby
nowhereman has joined #ruby
jyaworski has joined #ruby
conta has joined #ruby
_whitelogger has joined #ruby
jyaworski has quit [Ping timeout: 246 seconds]
jyaworski has joined #ruby
marmotini_ has quit [Remote host closed the connection]
t0x has quit [Quit: Connection closed for inactivity]
conta has quit [Ping timeout: 255 seconds]
jyaworski has quit [Ping timeout: 255 seconds]
BOOGIEMAN-pN has joined #ruby
ravenousmoose has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ravenousmoose has joined #ruby
cschneid has joined #ruby
BOOGIEMAN-pN has left #ruby [#ruby]
jyaworski has joined #ruby
cschneid has quit [Ping timeout: 240 seconds]
AJA4350 has joined #ruby
jyaworski has quit [Ping timeout: 250 seconds]
wildermind has quit [Quit: Connection closed for inactivity]
aqd has quit [Remote host closed the connection]
aqd has joined #ruby
kitikonti has joined #ruby
aqd has quit [Remote host closed the connection]
aqd has joined #ruby
ellcs has joined #ruby
_whitelogger has joined #ruby
wildermind has joined #ruby
dionysus70 has quit [Ping timeout: 250 seconds]
Puppet_ has quit [Remote host closed the connection]
dionysus70 has joined #ruby
ravenousmoose has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
minimal_life has joined #ruby
ellcs has quit [Ping timeout: 250 seconds]
dionysus70 has quit [Quit: dionysus70]
kitikonti has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
dionysus70 has joined #ruby
TheBloke has quit [Quit: Textual IRC Client: www.textualapp.com]
TheBloke has joined #ruby
minimal_life has quit [Quit: ZZZzzz…]
conta has joined #ruby
ams__ has joined #ruby
conta has quit [Ping timeout: 240 seconds]
jyaworski has joined #ruby
ravenousmoose has joined #ruby
cschneid has joined #ruby
jyaworski has quit [Ping timeout: 246 seconds]
conta has joined #ruby
kitikonti has joined #ruby
conta has quit [Ping timeout: 268 seconds]
nowhereman has quit [Ping timeout: 258 seconds]
kitikonti has quit [Quit: Textual IRC Client: www.textualapp.com]
ravenousmoose has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jyaworski has joined #ruby
mangold has quit [Quit: This computer has gone to sleep]
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
laaron has joined #ruby
ravenousmoose has joined #ruby
ravenousmoose has quit [Client Quit]
ravenousmoose has joined #ruby
jyaworski has quit [Ping timeout: 255 seconds]
tdy has joined #ruby
wildermind has quit [Quit: Connection closed for inactivity]
Darmani has joined #ruby
<Darmani> Hi everyone! I'm trying to write a comparable method for my object class but I'm not really sure how to go about it.
<Darmani> I need to compare each object by their letter grade and symbol.
jyaworski has joined #ruby
szulak_ has joined #ruby
jyaworski has quit [Ping timeout: 250 seconds]
rprimus has quit [Ping timeout: 250 seconds]
jyaworski has joined #ruby
ravenousmoose has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rprimus has joined #ruby
jyaworski has quit [Ping timeout: 245 seconds]
<al2o3-cr> &>> class Grade include Comparable; attr_reader(:grade); def initialize(grade) @grade = grade end; def <=>(other) other.grade <=> @grade end end; g1 = Grade.new('A'); g2 = Grade.new('B'); g1 > g2
<rubydoc> # => true (https://carc.in/#/r/6eea)
<al2o3-cr> ^ Darmani
<al2o3-cr> &>> class Grade include Comparable; attr_reader(:grade); def initialize(grade) @grade = grade end; def <=>(other) other.grade <=> @grade end end; g1 = Grade.new('A'); g2 = Grade.new('B'); g3 = Grade.new('C'); g2.between?(g3, g1)
<rubydoc> # => true (https://carc.in/#/r/6eeb)
<al2o3-cr> doing it this way because of lexicology.
<Darmani> a12o3-cr: What if the grades has symbols?
<Darmani> Like + or - ?
<Darmani> Would that still work?
<al2o3-cr> yeah.
<al2o3-cr> oh, hang on.
<Darmani> It wouldn't I think it looks too simple.
<al2o3-cr> ah, i think in this case it does work.
TheBloke has quit [Quit: Textual IRC Client: www.textualapp.com]
<Darmani> Well yeah in the test case you provided
<al2o3-cr> no, should work for all.
<Darmani> It's not as simple as other.grade <=> @grade though. Also that filters them backwards.
<Darmani> I think it's supposed to be @grade <=> other.grade if anything.
<Darmani> https://repl.it/repls/PitifulCalculatingFormats <- So when I try this with multiple grades that have letters it puts the "A-" grade first, then "A+", then "A".
<Darmani> So I don't see how that works at all.
<Darmani> I'm about to give up though. This shit is starting to irritate me.
<al2o3-cr> Darmani: ah, yeah, wasn't thinking of that.
<Darmani> All good. I thought that was the solution too to begin with.
cschneid has quit [Ping timeout: 268 seconds]
Cthulu201 has quit [Quit: Nowhere special. I always wanted to go there.]
Cthulu201 has joined #ruby
<Darmani> This kind of works as long as you keep all the grades the same letter.
cschneid has joined #ruby
lucasb has quit [Quit: Connection closed for inactivity]
<c-c> Ok I have Ale for (n)vim and it seems to pinpoint problems long before I even save. Also, I added airline. What other vim plugs do you use? (I don't use plugin installers, git svn etc use from terminal, so I won't need those)
ravenousmoose has joined #ruby
<al2o3-cr> Darmani: are you sure that works as you think?
<Darmani> No not even close
<Darmani> It's just what I have so far.
<al2o3-cr> A+ > A == true; B- > C == true ??
<Darmani> um yeah
<Darmani> A b- would be greater than a C that's correct.
cschneid has quit [Ping timeout: 244 seconds]
reber has joined #ruby
cschneid has joined #ruby
ua_ has joined #ruby
<canton7> Darmani, you need to parse the grade into the letter, and the '+' or '-'. First compare the letters. If they're the same, compare the '+' or '-'
ua has quit [Ping timeout: 244 seconds]
TheBloke has joined #ruby
joaumg has joined #ruby
<Darmani> canton7: I came to the same conclusion but I'm still missing something.
<canton7> Darmani, again, you need to parse the grade into the letter, and the '+' or '-'. You don't parse out the letter.
ravenousmoose has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<Darmani> That's not parsing out the letter it's parsing out the symbol.
<Darmani> canton7: Then it compares the letter to see if they match.
Swyper has joined #ruby
<Darmani> Unless I'm confused which I might be.
ravenousmoose has joined #ruby
<canton7> Darmani, shall I just keep repeating what I said? I don't think I'm getting anywhere here
<canton7> "Do it this way" "Yes, I'm doing it a different way" "I suggested doing it this way" "I know, I'm doing it a different way"
<Darmani> canton7: If it was as simple as "do this" I obviously would have done that by now.
<Darmani> If I knew what you were talking about
<Darmani> I might actually do it.
<Darmani> I appreciate the advice though.
<canton7> well it really is as simple as I described. If you don't understand what I'm describing, ask: don't say "I came to the same conclusion"...
<Darmani> The same conclusion to compare the letters and then compare the symbols?
<Darmani> That's pretty easy to understand.
<canton7> I said to parse out the letter and the symbol. *first* compare the letters, *then* if the letters are the same, look at the symbols
<canton7> so step 1: create variables containing the letter, and the symbol
Swyper has quit [Ping timeout: 268 seconds]
<canton7> step 2: compare the variables containing *just* the letters. No symbols.
cschneid has quit [Ping timeout: 244 seconds]
<canton7> step 3: *if* and only if the letters match, then compare the variables containing *just* the symbols
<Darmani> canton7: And then apply -1, 1, 0 accordingly?
szulak_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<canton7> Yes. If the letters are *not* the same, return -1 or 1 as appropriate. If the letters are the same, compare the symbols and return -1, 0, or 1 as appropriate
<Darmani> canton7: okay that seems pretty straightforward.
TheBloke has quit [Quit: Textual IRC Client: www.textualapp.com]
AJA4350 has quit [Ping timeout: 250 seconds]
cyberRodent has joined #ruby
uranoss has joined #ruby
cyberRodent has quit [Client Quit]
<Darmani> canton7: Dude
<Darmani> I will literally give you money for helping me solve this
<Darmani> where do I donate lol
Yxhuvud has joined #ruby
<Darmani> Also here's the finished product, it could probably be cleaned up a little more but it works
tdy has quit [Ping timeout: 245 seconds]
orbyt_ has joined #ruby
TheBloke has joined #ruby
cyberRodent has joined #ruby
AJA4350 has joined #ruby
sticaz has quit [Read error: Connection reset by peer]
TheBloke has quit [Client Quit]
<Darmani> Very clean.
<canton7> and if you're serious about the money: https://secure.msf.org.uk/Donate/ :)
<Darmani> Thanks man :)
cyberRodent has quit [Quit: ZNC - http://znc.in]
cschneid has joined #ruby
cyberRodent has joined #ruby
ams__ has quit [Quit: Connection closed for inactivity]
wildermind has joined #ruby
nwradio has quit [Read error: Connection reset by peer]
nwradio has joined #ruby
<Darmani> canton7: What about finding the longest substring in a string? Is there any good articles for that sort of thing?
<canton7> that's a classic programming problem
<canton7> comes up in all sorts of online code challenge thingies
<Darmani> canton7: Is there an elegant solution?
<Darmani> Because most of the ones I see look like shit
<canton7> which variant of the problem is yours?
<Darmani> implement an algorithm that when given a string, returns the longest repeating substring found in the input. E.g., in the string "phenomenal", the longest repeating substring is "en".
<Darmani> Not too complicated but I've never solved this problem before so I don't know where to start.
<canton7> iirc they're all slightly gnarly
blackmesa has joined #ruby
<canton7> oh, longest repeating substring, not longest substring without repeating characters
<Darmani> yeah this is a pretty basic one I think
<canton7> you can do it yourself, by hand, right?
<Darmani> Well I've never done this before but I have an idea on how it would be solved...
<canton7> do it by hand, with pencil and paper. Then analyze how you did it
<canton7> turn that into a set of instructions on how to do it, then turn that into code
<Darmani> With a pencil and paper? What do you mean?
<canton7> get a physical pencil and a piece of physical paper :)
<Darmani> What do I do with those things? lmao I think I know what a substring is
<canton7> then use them to find the longest common substring in a word
<canton7> then come up with a set of instructions on how to do it, and write them down
<Darmani> Well I guess starting from the beginning couldn't hurt
<Darmani> Thanks ^_^
<canton7> that's the starting point for any algorithm
<canton7> I always start by sketching things out in a logbook
<Darmani> I usually just stare at my computer until my eyes hurt
<Darmani> works every time
<Darmani> lol
<c-c> surprising that all kinds of tech has gone into computers, but note scribbling as a creative efforte is still smoother on pen&paper or whiteboard
<c-c> *or
<canton7> if you're solving "phenomenal" by hand, what do you do? you start at the 'p': uh, no other p's. Same with the 'h'. Reach the 'e': ooh another e! And they've both got 'n' after them, but that's all. The 'n' was part of 'en' so we can skip that. Onto the 'o'...
cschneid has quit [Ping timeout: 255 seconds]
hanmac has quit [Ping timeout: 250 seconds]
<c-c> so a char is a substring
<c-c> or do you need n > 1
<canton7> dunno. It doesn't matter: it's the same algorithm, one just has a step to reject substrings of length 1 at the end
<Darmani> canton7: So you count the characters which show up at least twice in a string and then you examine the characters next to them and so on and so forth until you have your string?
jaddison has joined #ruby
<canton7> that's one way of doing it, sure
<canton7> there will be neater ways - googling gave a couple of very terse recursive solutions
<Darmani> Seeing as this is my first time solving this problem I'd like to just figure it out before I get creative.
c-c has quit [Killed (Sigyn (Spam is off topic on freenode.))]
AJA4350 has quit [Ping timeout: 246 seconds]
wilbert has joined #ruby
joaumg has quit [Quit: joaumg]
ravenousmoose has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
wilbert has quit [Read error: Connection reset by peer]
wilbert_ has joined #ruby
<Darmani> can
<Darmani> oops
<Darmani> canton7: Did you go to school for this?
mamantoha has joined #ruby
<canton7> I did electronics at uni, which had some programming in it
<Darmani> I feel like such a fake sometimes
<canton7> figuring out simple algorithms like this is just practice. coming up with the perfect solution requires a bunch of data structures and algorithms knowledge, which a cs uni course will give you
<Darmani> Yeah I guess.
c-c has joined #ruby
conta has joined #ruby
AJA4350 has joined #ruby
dinfuehr_ has joined #ruby
mamantoha has quit [Ping timeout: 268 seconds]
dinfuehr has quit [Ping timeout: 240 seconds]
am0123 has joined #ruby
conta has quit [Ping timeout: 240 seconds]
mamantoha has joined #ruby
mamantoha has quit [Quit: Konversation terminated!]
hiroaki_ has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
cschneid has joined #ruby
cschneid has quit [Ping timeout: 255 seconds]
<al2o3-cr> canton7: what language?
<canton7> what language what?
jyaworski has joined #ruby
<al2o3-cr> "I did electronics at uni, which had some programming in it"
<canton7> ah, a combination of C and C#
<al2o3-cr> do you still practice these now?
<al2o3-cr> or stick to interpreted languages?
<canton7> yep, they're the two languages I'm paid to write. C for embedded stuff, C# for desktop stuff
<al2o3-cr> oh, cool. :)
<canton7> I picked up ruby at school because it was fun, and still use it for scripts / build scripts / etc, but I don't build anything serious in it
jyaworski has quit [Ping timeout: 250 seconds]
<al2o3-cr> that must of been a long time ago ;) jk hehe
<al2o3-cr> canton7: i've seen you around for like an eternity.
<al2o3-cr> i remember when the eval bot in here used to be named al2o3cr going back a few years now ;)
ravenousmoose has joined #ruby
<canton7> heh, that's probably before me time!
<canton7> *my time
jaddison has quit [Quit: jaddison]
jaddison has joined #ruby
jaddison has quit [Client Quit]
<al2o3-cr> yeah, hehe :)
<al2o3-cr> probably
jaddison has joined #ruby
ravenousmoose has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
sacomo has quit [Ping timeout: 264 seconds]
sacomo has joined #ruby
ravenousmoose has joined #ruby
am0123 has quit [Ping timeout: 245 seconds]
<Darmani> canton7: okay I gave up
<Darmani> pls dont hate me
<Darmani> q.q
AJA4350 has quit [Ping timeout: 240 seconds]
<canton7> did you figure out how to do it by hand? could you describe to someone else how to do it by hand?
<Darmani> I think so.
<Darmani> I can try to explain it.
wilbert has joined #ruby
<canton7> right, so write that down in a gist
<Darmani> okay
<canton7> (going to be afk in about 10 mins - dinner is cooking)
<Darmani> np
wilbert_ has quit [Ping timeout: 244 seconds]
jyaworski has joined #ruby
hanmac1 has joined #ruby
<Darmani> That's my understanding of it.
<Darmani> A poor man's understanding of it probably
dviola has joined #ruby
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
laaron has joined #ruby
jaddison has quit [Quit: jaddison]
jaddison has joined #ruby
jaddison has quit [Client Quit]
jaddison has joined #ruby
jaddison has quit [Client Quit]
jaddison has joined #ruby
jaddison has quit [Client Quit]
jaddison has joined #ruby
jaddison has quit [Client Quit]
jaddison has joined #ruby
sagax has joined #ruby
jaddison has quit [Client Quit]
<canton7> Darmani, I'll look in a bit. No cheating: this is my super-naive O(n^3) attempt, just implementing what I'd do by hand: https://repl.it/repls/TallAstonishingGreyware
wilbert has quit [Ping timeout: 245 seconds]
wilbert_ has joined #ruby
<Darmani> canton7: yeah that's exactly what I was thinking!!
cristof has joined #ruby
jaddison has joined #ruby
jaddison has quit [Client Quit]
jyaworski has quit [Ping timeout: 255 seconds]
cschneid has joined #ruby
orbyt_ has joined #ruby
lucasb has joined #ruby
cschneid has quit [Ping timeout: 250 seconds]
jyaworski has joined #ruby
renich has joined #ruby
blackmesa has quit [Ping timeout: 258 seconds]
t0x has joined #ruby
hiroaki_ has quit [Ping timeout: 252 seconds]
sariyar_ has joined #ruby
Darmani has quit [Ping timeout: 256 seconds]
jyaworski has quit [Ping timeout: 240 seconds]
jyaworski has joined #ruby
jyaworski has quit [Ping timeout: 245 seconds]
xrexeon has joined #ruby
ravenousmoose has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ravenousmoose has joined #ruby
gnufied has quit [Remote host closed the connection]
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
postmodern has quit [Quit: Leaving]
jyaworski has joined #ruby
clemens3 has quit [Ping timeout: 268 seconds]
tdy has joined #ruby
wildermind has quit [Quit: Connection closed for inactivity]
jaddison has joined #ruby
jyaworski has quit [Ping timeout: 268 seconds]
jaddison has quit [Quit: jaddison]
jaddison has joined #ruby
jaddison has quit [Client Quit]
jaddison has joined #ruby
cristof has quit []
jaddison has quit [Client Quit]
jaddison has joined #ruby
AJA4350 has joined #ruby
jaddison has quit [Client Quit]
jaddison has joined #ruby
jaddison has quit [Client Quit]
jaddison has joined #ruby
jaddison has quit [Client Quit]
houhoulis has joined #ruby
dellavg__ has quit [Ping timeout: 258 seconds]
udiudi has joined #ruby
iNs has joined #ruby
varesa_ is now known as varesa
Nicmavr has joined #ruby
anothertorusr has joined #ruby
tdy has quit [Ping timeout: 250 seconds]
cd has joined #ruby
dviola has quit [Quit: WeeChat 2.4]
dionysus70 has quit [Ping timeout: 245 seconds]
udiudi has quit [Quit: Textual IRC Client: www.textualapp.com]
sariyar_ has quit [Quit: Connection closed for inactivity]
Dbugger has quit [Ping timeout: 250 seconds]
xrexeon has quit [Remote host closed the connection]
hightower2 has joined #ruby
wilbert has joined #ruby
wilbert_ has quit [Ping timeout: 250 seconds]
blackmesa has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
DTZUZU has quit [Quit: WeeChat 2.2]
orbyt_ has joined #ruby
jetchisel has joined #ruby
AJA4350 has quit [Ping timeout: 245 seconds]
DTZUZU has joined #ruby
AJA4350 has joined #ruby
ravenousmoose has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
nowhereman has joined #ruby
jetchisel has quit [Ping timeout: 250 seconds]
blackmesa1 has joined #ruby
blackmesa has quit [Read error: Connection reset by peer]
sameerynho has quit [Ping timeout: 245 seconds]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
t0x has quit [Quit: Connection closed for inactivity]
reber has quit [Remote host closed the connection]
dviola has joined #ruby
wilbert has quit [Ping timeout: 250 seconds]
orbyt_ has joined #ruby
jmcgnh has quit [Ping timeout: 250 seconds]
Fernando-Basso has quit [Remote host closed the connection]
duderono_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
catbusters has joined #ruby
AJA4351 has joined #ruby
AJA4350 has quit [Ping timeout: 255 seconds]
AJA4351 is now known as AJA4350