Euge wrote the code that ran PlanJam for well over a decade. We went back and read it, so you don’t have to. Every snippet below is real.
#01
Ron lives inside Euge
plan.php, L01Menu.html, js/planjam/PlanInterface.js
<iframe id="euge" name="euge" style="width:190px;height:440px;" src="L01Menu.html" frameborder="0" scrolling="no"></iframe>
<!-- L01Menu.html -->
<div id="ron">
</div>
<!-- PlanInterface.js -->
if(!IFrameLoaded)
{
//Still not loaded, keep checking
window.setTimeout(this.WaitForIframeLoad.bind(this), 20);
this.L01_Document = GetIFrameDocument("euge");
this.L01_Root = $(this.L01_Document.getElementById("ron"));
🔥The planner’s whole activity menu lives in a div called “ron”, inside an iframe called “euge”, and the page asks every 20 milliseconds whether Euge is ready yet. Some things never change.
#02
Version control, Euge style
new/euge/m2/nppBackup/
$ ls new/euge/m2/nppBackup/
indexR.php.2008-01-15_063738.bak
indexR.php.2008-01-15_063744.bak
indexR.php.2008-01-15_063749.bak
indexR.php.2008-01-15_063820.bak
indexR.php.2008-01-15_064231.bak
indexR.php.2008-01-15_064400.bak
indexR.php.2008-01-15_064423.bak
🔥Seven commits in seven minutes, starting at 6:37 in the morning, courtesy of Notepad++’s backup-on-save. Then he deployed the backup folder to production.
#03
The fork
GetActsData.php vs GetActsDataEUGE.php
$ diff GetActsData.php GetActsDataEUGE.php
8c8
< $_POST['fG'] = filter group
---
> $_POST['aG'] = activity group
120c120
< JSON_SEP, "\"fG\"", JSON_OBJ_DEF, $_POST["fG"], JSON_OBJ_END;
---
> JSON_SEP, "\"aG\"", JSON_OBJ_DEF, $_POST["aG"], JSON_OBJ_END;
🔥A 122-line copy of a file to rename one variable. He also kept DD.js and DDEUGE.js (3,000 lines each), plus PlanInterface.js, PlanInterfaceEUGE.js and PlanInterfacePREFF3.js. Branches are for trees.
#04
Calls Yelp, blames Yahoo
GetEugeData.php
// line 76 (key removed): GET api.yelp.com/business_review_search ... category=coffee &location=93101
//Pack info together like all other groups
"\"TCD\"", JSON_OBJ_DEF, "\"", ".5", ";", "10", ";", $business["categories"][0]["name"], ";", "\"";
case 503:
die('Your call to Yahoo Web Services failed and returned an HTTP status of 503. That means: Service unavailable. An internal problem prevented us from returning data to you.');
$data = strstr($response, "{\"message\": {\"te");
🔥In the one file named after himself, Euge calls Yelp and, when it fails, blames Yahoo. Every coffee shop in Santa Barbara gets the same half hour and ten bucks, and the JSON is found by searching the reply for the first 16 characters he hoped it would start with.
#05
Artisanal, hand-rolled JSON
PJUtils.php, GetActsData.php
define("JSON_OBJ_START", "{");
define("JSON_OBJ_END", "}");
define("JSON_ARR_START", "[");
define("JSON_ARR_END", "]");
define("JSON_SEP", ",");
define("JSON_OBJ_DEF", ":");
echo JSON_SEP, "\"i\"", JSON_OBJ_DEF, $_POST["i"],
JSON_SEP, "\"fG\"", JSON_OBJ_DEF, $_POST["fG"], JSON_OBJ_END;
🔥Six constants so a curly brace never gets mistyped, and the raw request echoed right back into the response. In fairness, json_encode() didn’t ship until PHP 5.2 in November 2006. In less fairness, he never went back.
#06
Success is coffee
PJUtils.php
//Global success code
define("SUCCESS", 0xC0FE);
//Errors
define("INTERNAL_ERROR", 0);
🔥Zero means something broke. Success means coffee, spelled 0xC0FE because he was one F short of a C0FFEE. He copied it into three JavaScript files, in case the coffee wore off.
#07
Trust the client
GetActsData.php
$LocQuery .= "SELECT zipcode, ROUND($cosd, 1) AS Dist FROM zip_us " .
"WHERE Latitude > $LowLatitude and Latitude < $HighLatitude and Longitude > $LowLongitude and Longitude < $HighLongitude ) " .
"AS B on A.zip = B.zipcode order by " . $RESULT_ORDER_OPTS[$SortInput] . " limit 50 offset " . ( $_POST['p'] * 50);
🔥$_POST straight into the SQL. The only thing standing between PlanJam and Little Bobby Tables was PHP quietly turning the input into a number when he multiplied it by 50. Also, the "radius" search is a box.
#08
Euge’s map of America
StateBorders.php
'AK' => "'AK'",
'DC' => "'VA', 'MD', 'PA', 'DE'",
'HI' => "'HI'",
'NH' => "'ME', 'VT', 'NY'",
'WY' => "'MT', 'SD', 'NE', 'CO', 'UT', 'ID', 'MT'",
🔥D.C. borders Pennsylvania and Delaware. New Hampshire skips Massachusetts to hang out with New York. Wyoming borders Montana twice, just to be sure, and Alaska and Hawaii are their own neighbors. This is the list behind “Show out of state results?”
#09
One table per cuisine. And per pair of cuisines.
planjam_v3db, planjam_v2db
CREATE TABLE `B_Cajun & Creole` ( ... );
CREATE TABLE `C_Eclectic & InternationalFrench` ( ... );
CREATE TABLE `C_Eclectic & InternationalPizza` ( ... );
CREATE TABLE `M_Cajun & Creole` ( ... ) ENGINE=MRG_MyISAM;
-- and in version 2:
CREATE TABLE `pj_lego'spuzzles` ( ... );
🔥169 tables in one database. Spaces in the names, ampersands in the names, and an apostrophe in a table name, which is how you know someone was brave.
#10
Why normalize when you can number?
planjam_v3db.SavedPlans
CREATE TABLE `SavedPlans` (
`PlanId` int(11) unsigned NOT NULL AUTO_INCREMENT,
`Title` varchar(255) NOT NULL,
`Act0` text NOT NULL,
`Act1` text NOT NULL,
-- ...eight more...
`Act10` text NOT NULL,
`Act11` text NOT NULL,
...
) ENGINE=MyISAM;
-- every Act holds a string like '<group>;<index>;<VendId>;<icon>;<note>'
🔥Twelve numbered columns, each holding a semicolon-separated string. A thirteenth activity was simply not allowed. Friday nights had a hard limit.
#11
First Data Friendly
js/planjam/DD.js
{
t : "First Data Friendly",
L2 :
"Live Music", //4
"Romanatic", //5
"Serves Food", //6
🔥On a site built to plan dates, the Romantic scene recommends “First Data Friendly” activities, and bars can be filtered for “Romanatic”. He had databases on his mind on the first date.
#12
Rason is sorry
new/euge/m2/PlanR.php
<li style="border-bottom:none;display:none;text-align:center;top:100px;">
<img src="images/Rason-is-Sorry2.jpg" style="width:250px;"/>
</li>

🔥When a search came up empty, Euge didn’t write an error message. He made Rason apologize: a cartoon chef holding a pizza, saying none of our locations match your criteria. The text is baked into the JPG, so fixing a typo meant opening Photoshop.
#13
Submit to Metro
js/planjam/PJPlans.js
OnSubmitMetroClick : function(Evt)
{
Evt.stop();
var Elem = Evt.element();
Elem.update("<b>Submitted!</b>").setStyle({ color : "green", textDecoration : "none"});
}
🔥It turns green, says “Submitted!” and submits absolutely nothing. The most confident code on the site.
#14
HACK for hot tubs
Linky.php
//HACK for hot tubs
if($Index == 17) {++$Index;continue;}
//Write the "Mega file"
///Write the "Sub Mega files"
fwrite($SubMegaFile, "<html><head><meta name=\"robots\" content=\"noindex,follow\" /></head></body>");
echo "DONE!!!";
🔥There was never a Hot Tub table, so instead of fixing the list he skipped number 17 with a HACK. Then he generated 2,925 SEO pages, named them the Mega file and the Sub Mega files, opened each one with a closing </body>, and celebrated with DONE!!!
#15
Optimized for two monitors
version2/date.php
echo "if(screen.width == 1024){f = .35;}else if(screen.width == 1280){f = .38;}else{f=.36;}lo = parseInt((screen.width * f),10);bo = parseInt((screen.height * .75), 10);\n";
echo "document.write(\"<style type=\\\"text/css\\\">\" + \"", $css, "\" + \"</style>\");";
🔥The 2006 planner placed itself by the width of your monitor, not your browser window, using numbers hand-tuned for exactly two monitors: 1024 and 1280 pixels wide. Everyone else got 36% and a prayer. Shrink the window and the planner stayed exactly where it was, off the edge.
#16
Pixel-perfect, per browser
version2/uploadPhoto.html
if(BrowserDetect.browser == "Explorer" && BrowserDetect.OS == "Windows")
{
offset = "-145";
}
else if(BrowserDetect.browser == "Firefox" && BrowserDetect.OS == "Windows")
{
offset = "-146;";
}
else if(BrowserDetect.browser == "Firefox" && BrowserDetect.OS == "Mac")
{
offset = "-175;";
}
document.write("<div style=\"position:absolute;top:0px;left:" + offset + "px;\">");
🔥To hide the clunky Browse box on the photo uploader, the page slid it off-screen by a pixel count measured by hand in each browser. Firefox got a bonus semicolon, so its style came out as left:-146;px. Safari was never measured, so Safari got left:undefinedpx.
#17
Expires: 1978
version2/getAd.php
<?php
header("Expires: Sun, 19 Nov 1978 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
🔥The ad server told every browser its ads had expired in November 1978. November 19, 1978 is the birthday of Dries Buytaert, who created Drupal, and Drupal sends this exact header. So now we know where this file came from. Copy and paste: the original open source.
#18
The email relay service
version2/getSharedDateProfile.php, submitDateContactRequest.php
<sup style="font-weight:bold;color:#F83232;">2</sup> all correspondance will be automatically forwarded to you via our email relay service and your email address will never be revealed.
// submitDateContactRequest.php
$file = fopen("/home/planjam2/submissions/dateContactRequest.txt", 'a') or die("Error: Contact Request Failed");
fwrite($file, $dateIdInput . "\r\n");
fwrite($file, $fromEmailInput . "\r\n");
fwrite($file, $nameInput . "\r\n");
fwrite($file, $aboutYouInput . "\r\n\r\n");
fclose($file);
echo "You Contact Request Has Been Successfully Recieved";
🔥Every “find a date” profile promised an email relay service, so nobody’s address would ever be revealed. The relay service was a text file. Whether your love letter ever reached your date depended on somebody opening dateContactRequest.txt. At least you got a confirmation: “You Contact Request Has Been Successfully Recieved.”
#19
Four products, 19,000 links
planjam_v2db
SELECT Name, purchase FROM `pj_play board games` ORDER BY Name LIMIT 3;
-- 20/30 Park http://www.amazon.com/gp/product/B00000IWD0?ie=UTF8&tag=planjamcom-20...
-- A Philip Randolph Heritage Park http://www.amazon.com/gp/product/B00000IWD0?ie=UTF8&tag=planjamcom-20...
-- A.C. Beilenson Park http://www.amazon.com/gp/product/B00000IWD0?ie=UTF8&tag=planjamcom-20...
-- ...and 5,063 more parks. Same board game.
🔥The same 5,000 parks were listed as places to picnic, paint, play board games and build Legos, and every listing got a Purchase button. All 5,066 parks in the board-game table sell the exact same board game on Amazon. The picnic, Lego and frisbee tables did the same: 19,000 affiliate links to exactly four products.
#20
iesucks.css
euge/garbage/iesucks.css
#adAppContainer
{
height:254px;
}
🔥An entire stylesheet with one rule, named like a 2007 AIM away message, filed in a folder called garbage/. The garbage/ folder was live on the site.
#21
Euge writes Python
printhi.py
print "hi"
mistake
# >python -u printhi.py
# hi
# Traceback (innermost last):
# File "printhi.py", line 2, in ?
# mistake
# NameError: mistake
# >Exit code: 1

🔥A two-line program with one bug, and the bug is a line that says “mistake”. On a Python so old its tracebacks still said “innermost last”. This is the bug that made Euge give up on Python and move to Rails. The kittens never forgave him.