Hey 54.226.34.209, do you really want to belong to yesterday's generation? Nag your ISP about the all-new and shiny IPv6
samoz — + 117 - — Oct. 17, 2010, 11:58 a.m.

/*
This isn't the right way to deal with this, but today is my last day, Ron
just spilled coffee on my desk, and I'm hungry, so this will have to do...
*/

return 12; // 12 is my lucky number

paercebal — + 60 - — Oct. 17, 2010, 11:39 a.m.

This one was a living proof, in production code, of micro-management effects in our team followed by less than optimal code, conceived by our beloved technical director, who was quite fond of forcing down both code and coding guidelines into developers' throats.

Of course, when the project leader searched for the cause of a bug, and found it was inside the "less than optimal code", he was less than amused...

// I am not responsible of this code.
// They made me write it, against my will.

Vinicius — + 42 - — Jan. 13, 2011, 7 p.m.

/*
* OK; before you read the following code know what I am trying to do.
* I needed to get the list of child catagories from the root node so that
* the root node didn't appear in the selection box. But for some stupid
* fucking reason the stupid fucking DBA wont let me access the items using
* indices and I instead have to use their stupid fucking Iterator
* implementation. So there.
*/
$firstList = $this->getRootNode()->getChildren();
foreach ($firstList as $node)
{
$nodes = $node->getChildren();
break; // wtf?

Bahang — + 24 - — Oct. 17, 2010, 11:36 a.m.

//Dear future me. Please forgive me.
//I can't even begin to express how sorry I am.

Knobloch — + 22 - — Oct. 17, 2010, 11:48 a.m.

The sound function in the Turbo C version 2.0 Reference Guide

/* Emits a 7-Hz tone for 10 seconds.
True story: 7 Hz is the resonant frequency of a
chicken's skull cavity. This was determined
empirically in Australia, where a new factory
generating 7-Hz tones was located too close to a
chicken ranch: When the factory started up, all the
chickens died.
Your PC may not be able to emit a 7-Hz tone. */

main()
{
sound(7);
delay(10000);
nosound();
}

Brian — + 19 - — Oct. 17, 2010, 11:51 a.m.

On initialization of a linked list:

last = first; /* Biblical reference */

Samutz — + 18 - — Oct. 17, 2010, 12:03 p.m.

/*
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: 0px;

Jeremiah — + 16 - — Oct. 17, 2010, 11:52 a.m.

int MyFunction()
{
// There once was a man named Dave
int Result = 0;

// Whose code just wouldn't behave
MyObject *Ptr = new MyObject();

// He left to go to a meetin'
Result = Ptr->DoSomething();

// And left his memory a leakin'
return Result;
}

bikesandcode — + 13 - — Oct. 17, 2010, 11:56 a.m.

Taken from the Quake III source, I stumbled across this in some random slashdot posting. It's a particularly fast method of calculating an inverse square root. As for the best comment? It's a common one to be sure, but given that it's attached to the line that does the magic is what makes it great.

float Q_rsqrt( float number )
{
long i;
float x2, y;
const float threehalfs = 1.5F;

x2 = number * 0.5F;
y = number;
i = * ( long * ) &y; // evil floating point bit level hacking
i = 0x5f3759df - ( i >> 1 ); // what the fuck?
y = * ( float * ) &i;
y = y * ( threehalfs - ( x2 * y * y ) ); // 1st iteration
// y = y * ( threehalfs - ( x2 * y * y ) ); // 2nd iteration, this can be removed

#ifndef Q3_VM
#ifdef __linux__
assert( !isnan(y) ); // bk010122 - FPE?
#endif
#endif
return y;
}

proudgeekdad — + 2 - — Oct. 17, 2010, 11:50 a.m.

Our DBA found this in the middle of a 3000 line stored procedure written by a third party.

/* IF DOLPHINS ARE SO SMART, HOW COME THEY LIVE IN IGLOOS? */

Jules — + -2 - — Jan. 13, 2011, 7 p.m.

I hope the code never got released...

// 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

Samat — + -9 - — Oct. 17, 2010, 11:47 a.m.

/* Halley's comment */

devwebninja — + -9 - — Oct. 25, 2011, 6:35 p.m.

Late night/Early morning coders.

/* ==|== Update Plugin =====================================================
THE UPDATE CODE GOES HERE! PLEASE DO NOT MODIFY ANYTHING IN THIS SECTION
YOU *WILL* BREAK IT
=========================================================================
*/

/**
* Standard database check, make sure we're using
* at least version 1.1, otherwise, request the update.
* @return bool
*/
function update_db_check()
{
# I must be going crazy.. it's 3am and I can smell bacon..
[code] ...
}

Martin — + -10 - — Oct. 17, 2010, 11:59 a.m.

A classic case of why you shouldn't off shore your software development:

public class Contact
{
//...

/// <summary>
/// Gets or sets the name of the first.
/// </summary>
/// <value>The name of the first.</value>
public string FirstName
{
get { return _firstName; }
set { _firstName = value; }
}
}

XCondE — + -11 - — Oct. 17, 2010, 12:06 p.m.

On the linux 1.0 kernel scheduler (sched.c):

/*
* 'schedule()' is the scheduler function. It's a very simple and nice
* scheduler: it's not perfect, but certainly works for most things.
* The one thing you might take a look at is the signal-handler code here.
*
* NOTE!! Task 0 is the 'idle' task, which gets called when no other
* tasks can run. It can not be killed, and it cannot sleep. The 'state'
* information in task[0] is never used.
*
* The "confuse_gcc" goto is used only to get better assembly code..
* Djikstra probably hates me.
*/
asmlinkage void schedule(void)

BeardHat — + -14 - — Jan. 13, 2011, 6:53 p.m.

From the original UNIX source:

/*
* If the new process paused because it was
* swapped out, set the stack level to the last call
* to savu(u_ssav). This means that the return
* which is executed immediately after the call to aretu
* actually returns from the last routine which did
* the savu.
*
* You are not expected to understand this.
*/

Chris — + -19 - — Oct. 17, 2010, 11:21 a.m.

// I don't know why I need this, but it stops the people being upside-down

x = -x;

Lyudmil — + -21 - — Oct. 17, 2010, 12:01 p.m.

public boolean isDirty() {
//Why do you always go out and
return dirty;
}

Golradir — + -24 - — Jan. 13, 2011, 7 p.m.

I thought it was funny

StringBuilder Bob = new StringBuilder(); // Bob the StringBuilder

Raj — + -24 - — Jan. 13, 2011, 7 p.m.

//
// 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 = 16