this post was submitted on 05 Apr 2024
500 points (94.3% liked)

Programmer Humor

19503 readers
1408 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 1 year ago
MODERATORS
 
top 17 comments
sorted by: hot top controversial new old
[–] [email protected] 35 points 7 months ago (1 children)
[–] [email protected] 8 points 7 months ago (1 children)
[–] [email protected] 44 points 7 months ago (3 children)
[–] [email protected] 11 points 7 months ago

But that was before she set the requirement. I assume she meant from then on, and not since the beginning of time.

[–] [email protected] 6 points 7 months ago

If they have eggs, get a dozen.

[–] [email protected] 3 points 7 months ago

Wow that went over my head haha

[–] [email protected] 29 points 7 months ago
[–] [email protected] 28 points 7 months ago (2 children)

You should always check https://xkcd.com/1205/ first to see if it makes sense to automate something

[–] [email protected] 17 points 7 months ago (2 children)

Let's say it takes half a second to copy/paste and submit the message. That's 50 seconds saved, round it to one minute. You're only doing it once, so let's cross over to yearly. According to the Munroe Automation Scale, you can spend up to 5 minutes on it.

I'd say that code took about 1 minute to write. Maybe 2.

Result: do the automation.

[–] [email protected] 7 points 7 months ago

Caveat: This is all written assuming the message is being written on a computer with a real keyboard. But if we're assuming this is written on a phone, then my analysis doesn't apply, but then again, writing a java program to execute in your messaging app is also a terrible idea. Which means we're suspending disbelief, so I choose to believe that a computer keyboard and shortcuts are available.

Type the phrase once. Select all. copy, paste, paste (the first paste replaces what you already have highlighted, the second paste adds a second copy). Now you have 2. Control + A, Control + C, Control + V.. Now you have 4.

It will take you only 7 cycles of this get 128*, you only need to copy/paste it one by one if you want to send each message separately. and even then, it's would purely be copy the original, then paste, send, paste, send, paste send, paste, send.

Assuming you can hold down control and just hit ACVV 7 times, that's 28 keystrokes. I'd bet I can get that done in 5 seconds or less (i tried it, it's less than that), so now I only save 5 seconds. Which means I only get 25 seconds to write the script. Which he chose to write in java for some reason?

[print("I'm sorry") for x in range(0, 100)] is actually a script I could write in less than 25 seconds.

*And I disagree with the "reason 4" given. She didn't say "exactly 100 times" she said "100 times before I forgive you" and to me, "before" implies >= and not ==. So if you drop it in 128 times, that exceeds the criteria. No one has ever rescinded forgiveness for receiving extra apologies.

[–] [email protected] 3 points 7 months ago

I miss /r/theydidthemath

[–] [email protected] 1 points 7 months ago

He must have to apologize to her a lot.

[–] [email protected] 13 points 7 months ago

Reason 5: she doesn't exist and you're bad at cropping

[–] [email protected] 9 points 7 months ago (1 children)

I'll do you one better

function* sorry() { yield "I'm sorry"; }

Call sorry.next().value as many times as you need to baby, hell you can even use it in a for-of loop because Generator functions are Iterable. I fucking love JavaScript

[–] [email protected] 5 points 7 months ago (1 children)

lol that doesn't work either tho. it yields the string once and then is done. you still need a loop inside

[–] [email protected] 1 points 7 months ago

You're right! That's actually a really cool point about Generator functions too, them having while(true) loops is very unproblematic :D

I'm correcting myself to:

function* sorry() { while(true){ yield "I'm sorry"; } }

[–] [email protected] 4 points 7 months ago

Twitter PR review