F*cking programming

by Ben Orenstein

Yesterday I stumbled onto a delightful tool from Google Labs: Code Search.

Turns out Google is now crawling through source code. The GoogleBot, in its never-ending quest for sentience, searches inside tars, zips, and even dives into CVS and Subversion repositories. As Code Search is targeted at programmers, you can perform fantastically powerful queries using POSIX extended regular expressions.

Granted access to billions of lines of code and the awesome power of Google’s search technology, I did what any rational, thinking programmer would do: I typed in some profanity and hit enter.

In tribute to the valiant struggles of coders everywhere, please enjoy:

The best in programming profanity

/* We will NOT put a fucking timestamp in the header here.
Every time you put it back, I will come in and take it out again.
I’m sorry. This field does not belong here. We fill it with a 0 so
it compares the same but is not a reasonable time. */

/* Dear free software world, do you NOW see we are fucking
things up?! This is insane! */

# This job would be great if it wasn’t for the fucking customers.

/* Boy, would I like to make the thing expire one second ago, or what? Of course I would. But that slimy, stinking, load of pig manure that is called Netscape/1.1N doesn’t pay any attention to the seconds part of the time… after all, what’s a second or two amongst friends? So, I thought to make it expire one minute ago, but naturally, that didn’t work on 1.1N either. Losers. So, I made it expire 24 hours ago, which, if you ask me, is most heinous, considering the Last-Modified date could be later than that. I fucking hate you, you monopolizing piece of Netscape feces. */

# However, this only works if there are MULTIPLE checkboxes!
# The fucking JS DOM *changes* based on one or multiple boxes!?!?!
# Damn damn damn I hate the JavaScript DOM so damn much!!!!!!

# Trillian, again, is fucking stupid and crashes on just
# about anything its homemade XML parser doesn’t like.

/* TODO: this is obviously not right … this whole fucking module sucks anyway */

// gratuitous hack for Adobe SVG 3, what a fucking POS

/* if we get here, there are massive fucking problems, for a start our stack is fucked up, and we can’t return(). Just crash out. */

/* FIXME: please god, when will the hurting stop? Thus function is so
fucking broken it’s not even funny. */

/* XXX toshok why oh *why* god WHY did they do this? no fucking
sense */

# Note to self: I have no idea what this does anymore
# It looks like a cool fucking segment of code though!
# I just wish I remembered writing it… :-\

/* Outlook can’t fucking follow RFC if someone PAID them to do it…
oh wait, someone paid them NOT to do it. */

/* don’t fire dem packets too fucking fast */
usleep(1000);

## fucking imap fucking sucks. what the FUCK kind of committee of
## dunces designed this shit.

Fuck me gently with a chainsaw! Will someone please tell me how the fuck you resize a fucking widget?? Why, when I call whatever resize method I try with 64×64 does the fucking window end up 64×82? WHY???????? WHY???????? WHY???????? WHY???????? WHY???????? WHY???????? (why..?)

/* No we fucking don’t! DB entries should be stored in the same order
as they are in the file ! I can’t belive I was so fucking stupid !

# no, no, no, no, no, no, no, no
# no. fuck no. I am a fucking
# moron.

## aaahhh, user input. who would have though that such a simple
## idea would be SO FUCKING COMPLICATED?! because apparently
## Ncurses.getch (and Curses.getch), even in cbreak mode, BLOCKS
## ALL THREAD ACTIVITY. as in, no threads anywhere will run while
## it’s waiting for input. ok, fine, so we wrap it in a select. Of
## course we also rely on Ncurses.getch to tell us when an xterm
## resize has occurred, which select won’t catch, so we won’t
## resize outselves after a sigwinch until the user hits a key.
## and installing our own sigwinch handler means that the screen
## size returned by getmaxyx() DOESN’T UPDATE! and Kernel#trap
## RETURNS NIL as the previous handler!
##
## so basically, resizing with multi-threaded ruby Ncurses
## applications will always be broken.
##
## i’ve coined a new word for this: lametarded.

/* Sun, you just can’t beat me, you just can’t. Stop trying,
* give up. I’m serious, I am going to kick the living shit
* out of you, game over, lights out. */

/* Holy shit, we just updated more than one row!
What do we do now? */

/* 2,191 lines of complete and utter shit coming up… */

if (!(ptr = malloc (size)))
/* SHIT! SHIT! SHIT! */
die (“malloc failed”);

And my personal favorite:

# code below replaces code above – any problems?
# yeah, it doesn’t fucking work.

(Links are to the original sources)

Stay tough out there guys. Happy Monday.