this post was submitted on 17 Jul 2023
442 points (97.2% liked)

Programmer Humor

32410 readers
1 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 6 years ago
MODERATORS
 

When your code works, but you don't know how
@programmerhumor

top 17 comments
sorted by: hot top controversial new old
[–] Dirk@lemmy.ml 19 points 2 years ago (1 children)

Just containerize the dev environment and ship that to the customer.

[–] TheHalc@sopuli.xyz 17 points 2 years ago (3 children)

Just make sure to add comments like

//Magic, do not touch

To make sure no-one accidentally breaks the spell.

[–] Dirk@lemmy.ml 11 points 2 years ago (1 children)
// Do not delete! Yes, it's not used anywhere in the code, but if it is removed
// the application crashes and the error code is useless for debugging.
let f = 'a';
[–] kamenlady@lemmy.world 6 points 2 years ago (1 children)

if ( "a" == "a" ) { // i swear i saw this somewhere }

[–] Dirk@lemmy.ml 7 points 2 years ago

I once did const theNumber = 4 in a function (and then took a second, actually random, number and compared it to theNumber).

In the comment to the function I actually referenced https://xkcd.com/221/.

[–] echo@lemmy.ml 5 points 2 years ago

If you even know which line of random bullshit you changed that made it work, that is

[–] demonsword@lemmy.world 1 points 2 years ago

//HERE BE DRAGONS

[–] MyNameIsRichard@lemmy.ml 14 points 2 years ago

I solved one of these once upon a time.

There was a function that wasn't called from anywhere in the project which if deleted caused the whole system to fail in test and (presumably) production at runtime. It turned out to be scripts for a cron job that were only on the servers. I moved them in to the project and thus version control. Mystery solved.

[–] vicfic@iusearchlinux.fyi 6 points 2 years ago* (last edited 2 years ago) (1 children)

Well you can't call the code generated by chat gpt as YOURS.

[–] AstralWeekends@lemm.ee 1 points 2 years ago

The way I see, if chatgpt can steal our art, then we can steal its science.

[–] fckreddit@lemmy.ml 6 points 2 years ago (1 children)

I know why it works. Because it was copied from stack overflow..

[–] anders@rytter.me 3 points 2 years ago

@fckreddit
Haha yeah so some other random dude made it work 😄

[–] StudioLE@programming.dev 6 points 2 years ago

The answer is usually that I've pushed to the dev environment but I'm looking at staging.

Hi there! The links in your response are not clickable for Lemmy users, here are the clickable versions: !programmerhumor@lemmy.ml

[–] terrorismchord@beehaw.org 1 points 2 years ago
[–] sin_free_for_00_days@lemmy.one 1 points 2 years ago* (last edited 2 years ago) (1 children)

Going back to the most famous code comment in Unix history You are not expected to understand this.

[–] anders@rytter.me 2 points 1 year ago

@sin_free_for_00_days or "# The code is documentation enough"

load more comments
view more: next ›