<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...!!!!!!
<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
<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.
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…]
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.
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)