DEV Community

Ahmed Musallam
Ahmed Musallam

Posted on

Do you leave jokes in your code? If so, please share!

Sometimes, I leave bad jokes in my code, here are some examples from a backup tool I built a while back:

When a user tries to delete a backup:

console.log(`Still wanna do it? just checkin'...`)

When trying to remove a backup but something wrong happens:

spinner.fail(`ummm, yeah.. this is awkward; we could't delete the backups for some reason`)

When the user tries to remove a backup, but then cancels at the prompt:

console.log(`Whew, nothing happened. That must feel good, eh?`.green)

When something goes wrong:

spinner.fail('womp womp... some error occurred *rolls eyes*')

Other times, I add a funny* comment to a funky looking piece of code, just because..

I am curious if other devs do it to, do you do anything like that? funny comments? funny method/variable names? or funny messages you show to users? please share!

*Depends on whom you ask ;)

Latest comments (54)

Collapse
 
ievgenragulin profile image
IevgenRagulin

I work on a fasting app where I named a function to clean up old fasts "deleteOldFarts" instead of "deleteOldFasts". Tried to pretend it was a typo. During a PR a colleague of mine asked me to fix the typo. I'm not a native speaker and I guess I didn't realize this might have been a bit too offensive.

Collapse
 
oraclesean profile image
Oracle Sean ♠️

Is nawk installed?

function nawknawk () {
(nawk '{ print ; exit }' /etc/passwd) > /dev/null 2>&1
if [ ${?} -eq 0 ]
  then whosthere=nawk
  else whosthere=awk
fi
}
Collapse
 
phallstrom profile image
Philip Hallstrom

Awhile back I was legitimately able to return HTTP status 418 (I'm a tea pot) as I needed to trigger on something that I could guarantee wouldn't be caught by anyone else. That was fun :)

Collapse
 
rvictorino profile image
Robin Victorino

makes me wondering if in our IoT era some actual connected teapot™ now responds a legitimate 418 in some situations

Collapse
 
ahmedmusallam profile image
Ahmed Musallam

AH! I totally forgot about this status code! nice one! haha
For reference: developer.mozilla.org/en-US/docs/W...

Collapse
 
dougblackjr profile image
Doug Black

I add Silicon Valley quotes to every automated command in my app. Users never see them, but I get them in my log notifications, and it makes me smile and reminds me I'm alive.

Collapse
 
ahmedmusallam profile image
Ahmed Musallam

I demand examples! haha

Collapse
 
tdubs profile image
Thom W

I used to troll people in code. You should move out to Cali! Missing you at work!

Collapse
 
codemouse92 profile image
Jason C. McDonald • Edited

One of our developers, Scott, was well-known at MousePaw Media for possessing a lethally dry wit. I made the mistake of asking once for a "yay or nay" on something, and from then ever afterwards, he'd respond to yes/no questions with "yay" or "nay". It caught on at the company, even prompting a pair of yay-nay T-shirts to be made for our holiday gift exchange.

When we wrote IOChannel, a featureful wrapper around C++'s std::iostream, we offered a few formatting flags for printing boolean variables. Among those is the undocumented bool_scott...

bool foo = true;
ioc << bool_scott << foo << io_end;

...which would output...

Yay


Meanwhile, the official (still unpublished) specification for our upcoming language contains these little gems...

ERROR 22: Paradox. Something impossible happened.
ERROR 22: Paradox. Computer will now self-destruct.

Error 22 is actually useful for "can't happen" scenarios. There will be some way get it to print out the second message instead, though.

ERROR 42: Unknown question.
Collapse
 
equinusocio profile image
Mattia Astorino

I use bootstrap

Collapse
 
hdennen profile image
Harry Dennen

If a user hadn't used the new feature the UI needed to display a "new" icon next to it's menu link. so...

  let thaySeentIt;

  function init() {
    thaySeentIt = checkNewFeatureFlag();
Collapse
 
scrabill profile image
Shannon Crabill

On Twitter the other day we were talking about weird function/parameter names we had used in past projects.

This one wins.

twitter.com/saronyitbarek/status/1...

At work, I don't really leave jokes in my code. On occasion, I had used Bacon Ipsum or Cupcake Ipsum for mockups. I used Riker Ipsum in conference slides which got some chuckles on Twitter

Collapse
 
molly profile image
Molly Struve (she/her) • Edited

Our CTO once put a client into maintenance mode accidentally. When that happens, the client can't log into their account or anything. He panicked and started blowing up Slack asking about how to reverse it. Since then we have a confirm dialog on that button that says

Are you sure you want to enable maintenance mode for this client, Ed?

That was added over a year ago. What is better is that a newer dev recently saw it and assumed we had incorrectly identified the user. He was quite amused when we told him, nope, that was on purpose. 😂

Collapse
 
crongm profile image
Carlos Garcia ★

One of my hobbies was to leave snarky comments in commits that fixed dumb code... until my current employer had an issue with it. :(

Collapse
 
emrz profile image
EMRZ

Until march last year i worked maintaining a legacy insurance system, tech was Visual Basci 6 + T-Sql Stored Procedures.

Core product was from early 90s and was kept working by applying custom hacks for every customer since the beginning.

When i was about to quit, i was so stressed and angry all the time that i started leaving passive-agressive comments all around the code, not very matture from myself, but i needed to survive there.

I wish i had more screenshots from that time.

One day i inserted an ASCII version of Facebook's angry reaction at the end of a function

angery boii

I also remember writing Lasciate ogni speranza, voi ch'entrate on top of a really complicated and weird hack i had to do, it was something involving Ms Office automation.

Lots of the funny comments i have are in Spanish, so the joke is gone when translating.

But yes, i put a lot of weird/funny comments on code, the best part is finding it months or even years after.

Collapse
 
reegodev profile image
Matteo Rigon

I just inject this github.com/kitcambridge/evil.js/bl...
Usually before quitting my job.
And changing identity.

Collapse
 
grmnsort profile image
German Rodriguez Ortiz

Whenever I leave a comment about flushing an entity manager, I'll Aldo leave a "also don't forget to wash hands :)" comment :P

Collapse
 
shubhambattoo profile image
Shubham Battoo

Have a method for going back from a certain screen which spells , symondsGoBack, which is not that funny but a slogan during Indian freedom movement which is kind of odd.

Some comments may only be visible to logged-in visitors. Sign in to view all comments.