9 minutes
Scroll Funny Developer Comments
Here is a collection of funny source code comments, provided by developers all over the world. Take a look at it, it could definitely make your day.
I recently stumbled upon an awesome Stack Overflow thread, entitled “What is the best comment in source code you have ever encountered?”. As you might have guessed, it is a collection of funny source code comments, provided by developers all over the world. Take a look at it, it could definitely make your day. I am reposting here my personal favorites from that long long collection:
$up = new Exception("Something is really wrong.");
throw up; // Ha-ha
// When I wrote this, only God and I understood what I was doing
// Now, God only knows
foreach($collection as $model) {
break; // Hammertime!
}
// Sometimes, I believe compiler ignores all my comments
// I dedicate all this code, all my work, to my wife, Darlene, who will
// have to support me and our three children and the dog once it gets
// released into the public.
// somedev1 - 06/07/02 Adding temporary tracking of Login screen
// somedev2 - 05/22/07 Temporary my ass
// Drunk, fix later
// Magic. Do not touch.
#define TRUE FALSE
// Happy debugging suckers
// I'm sorry.
return 1; // Returns 1
try {
// Do something stupid
} catch (Exception $e) {
// Who cares?
}
/*
* You may think you know what the following code does.
* But you dont. Trust me.
* Fiddle with it, and youll spend many a sleepless
* night cursing the moment you thought youd be clever
* enough to "optimize" the code below.
* Now close this file and go play with something else.
*/
try {
} finally { // Should never happen
}
const int TEN=10; // As if the value of 10 will fluctuate...
// This code sucks, you know it and I know it.
// Fix this and call me an idiot later.
double penetration; // Ouch! Don't stop!
/////////////////////////////////////// this is a well commented line
// I don't know why I need this, but it stops the people being upside-down
$x = -($x);
// I am not sure if we need this, but too scared to delete.
$this->doRun->run($run); // "A doo run run run". I bet you sing it.
// To understand recursion, see the bottom of this file
// A very nasty long code apears
// To understand recursion, see the top of this file
// I am not responsible of this code.
// The previous developer is.
// They made me write it, against my will.
/* I did this the other way */
// A long code
/* Please work */
// A long code
/* Don't read */
// No comments for you
// It was hard to write.
// So it should be hard to read.
options.BatchSize = 300; // Madness? THIS IS SPARTA!
// Code below replaces code above - any problems?
// Guess what?
// Yeah, it doesn't fucking work.
class Act // That's me!!!
{
...
}
public isDirty() {
$dirty = true;
// Why do you always go out and
return $dirty;
}
Repeat
...
Until (JesusChristsReturn) ' Not sure
// Catching exceptions is for communists
// If this code works, it was written by Paul DiLascia.
// If not, I don't know who wrote it.
// This formula is right, work out the math yourself if you don't believe me.
// Comment this later
// Remove this if you wanna be fired
// This is becoz you messed with me the other day
if ($current_admin->name == "myname") {
sleep(1000 * 3600);
die();
}
// Linux go sex
date ; unzip ; strip ; touch ; grep ; finger ; mount ; fsck ; more ; yes ; umount ; sleep
// Peter wrote this, nobody knows what it does, don't change it!
// John! If you’ll svn remove this once more,
// I’ll shut you, for God’s sake!
// That piece of code is not "something strange"!
// That is THE AUTH VALIDATION.
try {
} catch (SQLException $e) {
// Basically, without saying too much, you’re screwed. Royally and totally.
} catch(Exception $e) {
// If you thought you were screwed before, boy have I news for you!!!
}
// If you’re reading this,
// that means you've been put in charge of my previous project.
// I am so, so sorry for you. God bless you.
/**
* For the brave souls who get this far: You are the chosen ones,
* the valiant knights of programming who toil away, without rest,
* fixing our most awful code. To you, true saviors, kings of men,
* I say this: never gonna give you up, never gonna let you down,
* never gonna run around and desert you. Never gonna make you cry,
* never gonna say goodbye. Never gonna tell a lie and hurt you.
*/
//
// Dear maintainer:
//
// Once you are done trying to 'optimize' this routine,
// and have realized what a terrible mistake that was,
// please increment the following counter as a warning
// to the next guy:
//
// total_hours_wasted_here = 42
//
// Autogenerated, do not edit. All changes will be undone.
// Replaces with spaces the braces in cases where braces in places cause stasis
$str = str_replace(array("\{","\}"), " ", $str);
/*
* You may think you know what the following code does.
* But you dont. Trust me.
* Fiddle with it, and youll spend many a sleepless
* night cursing the moment you thought youd be clever
* enough to "optimize" the code below.
* Now close this file and go play with something else.
*/
// Christmas tree initializer
$toConnect = []
$toRead = [ ]
$toWrite = [ ]
$primes = [ ]
$responses = {}
$remaining = {}
// Here be dragons
long long ago; /* in a galaxy far far away */
// If this comment is removed the program will blow up
// Dear future me. Please forgive me.
// I can't even begin to express how sorry I am.
/* You are not meant to understand this */
// I am not sure why this works but it fixes the problem.
// Hack for IE browser (assuming that IE is a browser)
$do->something() or die(); // bitch!
// I know the line below is wrong, but it came that way from our IP vendor, and
// the driver won't work if you "fix" it. I've had to revert this change 4 times
// now. Leave it alone, or I will hunt you down and hurt you
if ($r === 0) {
/* bunch of code here */
} else {
/* even more code here */
}
// This comment included for the benefit of anyone grepping for swearwords: shit.
try {
} catch (PartInitException $pie) {
// Mmm... pie
die(); // Ha-ha
}
// This comment is self explanatory.
// This only exists because Scott doesn't know how to use const correctly.
// Safety pig has arrived!
$text = h($text);
// _
// _._ _..._ .-', _.._(`))
// '-. ` ' /-._.-' ',/
// ) \ '.
// / _ _ | \
// | a a / |
// \ .-. ;
// '-('' ).-' ,' ;
// '-; | .'
// \ \ /
// | 7 .__ _.-\ \
// | | | ``/ /` /
// /,_| | /,_/ /
// /,_/ '`-'
/*
After hours of consulting the tome of Google,
I have discovered that by the will of unknown forces
without the below line, IE7 believes that 6px = 12px
*/
font-size: 0 !important;
if (/*you*/ $_GET['action']) { // , please celebrate with me!