havenwood changed the topic of #ruby to: Ruby 3.4.1, 3.3.7 https://www.ruby-lang.org | Log https://libera.irclog.whitequark.org/ruby
JulioPapel has quit [Ping timeout: 265 seconds]
user71 has quit [Quit: Leaving]
mange has quit [Ping timeout: 252 seconds]
grenierm has joined #ruby
konsolebox has joined #ruby
goro has joined #ruby
<goro> Hi, I'm new, what is the best practice to validate user input type?
mange has joined #ruby
konsolebox has quit [Ping timeout: 276 seconds]
fercell has quit [Quit: ZNC - https://znc.in]
goro_ has joined #ruby
fercell has joined #ruby
jhass has quit [Remote host closed the connection]
goro has quit [Ping timeout: 245 seconds]
goro_ is now known as goro
jhass has joined #ruby
konsolebox has joined #ruby
cappy has joined #ruby
cappy has quit [Quit: Leaving]
rvalue has quit [Ping timeout: 245 seconds]
rvalue has joined #ruby
luna has joined #ruby
luna has left #ruby [#ruby]
hwpplayer1 has joined #ruby
rvalue has quit [Ping timeout: 252 seconds]
rvalue has joined #ruby
goro has quit [Remote host closed the connection]
johnjaye has quit [Ping timeout: 248 seconds]
JulioPapel has joined #ruby
konsolebox has quit [Ping timeout: 276 seconds]
rvalue has quit [Ping timeout: 265 seconds]
rvalue has joined #ruby
Linux_Kerio has joined #ruby
konsolebox has joined #ruby
grenierm has quit [Quit: Client closed]
grenierm has joined #ruby
<nakilon> solved my question with "RSpec.shared_context __dir__ do", "require_relative "helper", "include_context __dir__"
<nakilon> ^ kind of anonymous per-directory helpers
<nakilon> I guess goro was gorom
whysthatso125070 has quit [Quit: The Lounge - https://thelounge.chat]
whysthatso125070 has joined #ruby
whysthatso125070 has quit [Client Quit]
whysthatso125070 has joined #ruby
user71 has joined #ruby
rvalue has quit [Read error: Connection reset by peer]
rvalue has joined #ruby
hwpplayer1 has quit [Read error: Connection reset by peer]
weaksauc_ has joined #ruby
weaksauce has quit [Ping timeout: 252 seconds]
grenierm has quit [Ping timeout: 240 seconds]
konsolebox has quit [Ping timeout: 252 seconds]
TomyWork has joined #ruby
mange has quit [Quit: Zzz...]
TomyLobo2 has joined #ruby
TomyWork has quit [Ping timeout: 246 seconds]
konsolebox has joined #ruby
whysthatso125070 has quit [Read error: Connection reset by peer]
whysthatso125070 has joined #ruby
donofrio_ has joined #ruby
donofrio_ has quit [Ping timeout: 260 seconds]
Linux_Kerio has quit [Ping timeout: 252 seconds]
donofrio_ has joined #ruby
hwpplayer1 has joined #ruby
donofrio_ has quit [Ping timeout: 252 seconds]
cahoots_ has joined #ruby
cahoots_ has quit [Quit: Client closed]
ftajhii has quit [Ping timeout: 248 seconds]
konsolebox has quit [Ping timeout: 276 seconds]
johnjaye has joined #ruby
donofrio_ has joined #ruby
donofrio_ has quit [Ping timeout: 252 seconds]
balrog has quit [Ping timeout: 252 seconds]
Pixi` has joined #ruby
joto5 has joined #ruby
brw2 has joined #ruby
<havenwood> goro: What kind of user input? Web form?
ox has joined #ruby
wgwz has quit [Quit: peace :wave:]
entropy has joined #ruby
kjetilho has quit [Ping timeout: 248 seconds]
Spitfire_ has quit [Ping timeout: 248 seconds]
Milos_ has joined #ruby
fercell_ has joined #ruby
FetidToot8 has joined #ruby
Spitfire has joined #ruby
fercell has quit [Ping timeout: 252 seconds]
entropie has quit [Ping timeout: 252 seconds]
entropy is now known as entropie
joto has quit [Read error: Connection reset by peer]
joto5 is now known as joto
wgwz has joined #ruby
oz has quit [Ping timeout: 248 seconds]
brw has quit [Read error: Connection reset by peer]
mweckbecker has quit [Ping timeout: 252 seconds]
Milos has quit [Ping timeout: 252 seconds]
FetidToot has quit [Ping timeout: 272 seconds]
FetidToot8 is now known as FetidToot
Pixi has quit [Ping timeout: 252 seconds]
ringo_ has quit [Ping timeout: 248 seconds]
Linux_Kerio has joined #ruby
balrog has joined #ruby
Pixi__ has joined #ruby
kjetilho has joined #ruby
ringo_ has joined #ruby
mweckbecker has joined #ruby
Pixi` has quit [Ping timeout: 244 seconds]
Quiet-Oil9262 has quit [Quit: The Lounge - https://thelounge.chat]
Sampersand has joined #ruby
balrog has quit [Quit: Bye]
balrog has joined #ruby
Sampersand has quit [Quit: Client closed]
ox is now known as oz
chen has quit []
gorom has joined #ruby
<gorom> I need an adult
<gorom> Did I miss something here, or the Indians coding sites too powerful for 75 iq?
weaksauc_ has quit [Quit: Textual IRC Client: www.textualapp.com]
weaksauce has joined #ruby
<gorom> nvm these guys are dic*heads, some stupid LLM answer my question but programmers with 15 years of expertise doesn't even understand why I'm asking
<gorom> what*
<weaksauce> just says page not found for me
<gorom> I deleted the post It doesnt get approveed
<gorom> I made it visible if you like to take a look
<weaksauce> still says page not found
<gorom> oh okay, my bad, they don't want to make it visible, I'll copy it somewhere
<gorom> what is the best pastebin around?
<weaksauce> hastebin.com should work or github
<gorom> it is what I posted there, however they stated that question is unclear, chatbot proved my point, but I'll be really glad if somebody alive could prove it as well
<kjetilho> "the number that is formed by selecting the last digit" is not clear
<weaksauce> the leetcode solution is correct if the question is worded that way
<weaksauce> the only digit divisible by 10 is 0
<kjetilho> yes, I agree. I just thought it was a silly question
<weaksauce> it's a dumb question yeah
<kjetilho> but I see now it is intended to check if the examinand can spot the simple optimisation
<weaksauce> i guess
<weaksauce> if i got that in an interview i'd be annoyed
<kjetilho> gorom: the "leetcode" is better since it only looks at a single element of the array
<kjetilho> I agree with the moderators, though - too much of a homework question, does not have a lasting value for the site
<gorom> ok, but look at explaination on the site
<gorom> below there is sum of all the last digits of an array
<gorom> i mean all elements not just one
<kjetilho> the explanation does not explain anything to me
<weaksauce> ah yeah
<gorom> chatbot seems to understand the question as much as I do
<weaksauce> they want each number in the array
<gorom> so the leetcode solution is the correct one after all, right?
<gorom> oh sorry I cut the picture
<gorom> one moment
<weaksauce> no the leetcode answer is wrong
<kjetilho> weaksauce: how?
<weaksauce> oh nevermind it is right
<weaksauce> the number formed by not each
<kjetilho> I first thought the question wanted to sum all the last digits, which would require looping over the array
<kjetilho> but I can't really make question text match that task
<kinduff> my brain hurts a bit
<weaksauce> 55514 div 10
<gorom> it seems to take a last digit from all elements, is it okay if I just pick last digit of an array ?
<kjetilho> gorom: right, exactly. so the last digits should be concatenated like the leetcode solution does
<kjetilho> gorom: all the preceding digits to not matter
<gorom> thanks, I owe you
<kjetilho> gorom: the key here: this optimisation ONLY works when checking for divisibility with 10
<gorom> I see
<kjetilho> gorom: if it was 3, you would have to do it your way
<kjetilho> can you solve it efficiently for 5?
<gorom> well, I have to try harder then
<gorom> hmm, I guess
<gorom> lets check
<kjetilho> (for 3 (or 7, or 9), you could take a shortcut and answer NO if the last digit has a special property (which?), and if not, do the full sum.)
<kjetilho> now you have two bonus questions :)
<weaksauce> well 5 is easy enough too... 5 or 0
<kjetilho> weaksauce: shhh!
<weaksauce> hah soory
<gorom> shh Im coding :DD
<gorom> but I know the answer already, lets check for the rest
<gorom> I need to finish sandwich first tho :-)
user71 has quit [Quit: Leaving]
balo has quit [Remote host closed the connection]
olspookishmagus has joined #ruby
<gorom> kjetilho: so for 7 and 9 the last digit method works, but I cannot figure out how to check for 3 only with the last digit
<gorom> I have to check all elements, right?
<gorom> ah, okay I've got your point if the last digit is not 3 6 9 or I guess 0 I can answer No, then check
<weaksauce> what's 3x4
<kjetilho> hrm, I haven't thought it completely through, but if the last digit is even, it can't be divisble by 3, 7 or 9.
balo has joined #ruby
<weaksauce> nevermind
<kjetilho> that was the test I had in mind
<kjetilho> but I might be wrong.
<kjetilho> don't have the energy to think now :)
<weaksauce> anyway 3xn will eventually have every last digit so that's not a reliable test
<kjetilho> yes, I think I messed up
mjanssen has joined #ruby
Vonter has quit [Ping timeout: 244 seconds]
Linux_Kerio has quit [Ping timeout: 252 seconds]
Vonter has joined #ruby
<gorom> I'm coding in vim and I missed end somewhere, can I tell by the error which line?
<gorom> oh okay I can
<gorom> so as I mentioned I'm very low in programming and it seems I didn't understand question, but optimalization come later, just coding. Here is my very low code, took me way too long haha. by7 is wild. I have to learn Rspec to debug this beast I guess. Can somebody point me the worst practices I used here? The code is very bad, no code and even I forget what the question was
<gorom> no comments*
<gorom> how to handle user input validation in ruby? regex?
<gorom> Did I change instance variable by using it that way?
<weaksauce> give your program some space to breathe
<weaksauce> each method should have one space between them
<weaksauce> and which line are you referring to
<gorom> right, my bad
<gorom> 20 and 33
donofrio_ has joined #ruby
<weaksauce> no
<weaksauce> your best bet is to keep it as strings to make appending easier or multiplying it by the factor of 10 that it needs
<weaksauce> i guess you are doing that kinda... the problem statement is strictly less than 100?
<gorom> haha this thing is really bad, no correct result, however glad I tried :-)
<gorom> weaksauce: oh okay, need to memorize it, I haven't really understood how ruby handle integers yet
<weaksauce> it looks like your thing should work at a glance
<gorom> it runs, but mostly messed up with logic
<gorom> I'll try again tho :-)
<gorom> forgot the question it supposed to answer haha
<weaksauce> make smaller helper methods to make the code more readable
ruby[bot] has quit [Remote host closed the connection]
ruby[bot] has joined #ruby
donofrio_ has quit [Ping timeout: 252 seconds]
JulioPapel has quit [Quit: JulioPapel]
<gorom> weaksauce: I will, thank you for your time, I learned some today. Have a nice day :-)
<weaksauce> you too gorom have a nice day
gorom has quit [Remote host closed the connection]
TomyLobo2 has quit [Ping timeout: 248 seconds]