Merry Christmas, everyone! We have a special card just for you:
(In case you miss it the first time, try reloading or clicking the button.)
Read on if you’d like to know more about how our awesome card works.
We started the Christmas card in 2005, as a simple way to do a card online. My wife Jamie and I had several reasons for doing our card this way.
- We didn’t want to waste paper or fuel to deliver physical objects half-way around the world.
- We didn’t want to use an online card service, which offer all kind of funny/animated/religious/specialised cards but exist solely to get you to give up personal information about your friends. The fastest way to lose me as a friend is to sell me out to spammers and marketing droids.
- We wanted to create something, both for our own pleasure and as a way to give back to our friends.
So I wrote the first card in plain HTML, and made customised messages for certain people using differently-named files, and hand-sent all the emails that year.
This was a quick hack but it worked well. The next year we upgraded to PHP. Then each successive year we added more features, improved the code base, and found various ways to foil our hacker friends (who wasted no time testing the security of the card – guessing URLs, testing PHP arguments, and so on). The full details are now in the changelog, which is new this year.
The big hit was in 2008, when we created the “madlib” greeting. The madlib card uses PHP to generate a random greeting from a template and a series of variables. Judging from server logs this was tremendously popular with my friends, who clicked the reload button many times until they’d exhausted enough combinations to be satisfied. Others didn’t immediately realise what was happening, and probably just assumed Tyler wrote a really weird card and closed the browser. I figure I was accurately represented either way.
The PHP code is simple. Here is the basic idea:
$happy_list = array("merry", "happy", "wonderful", "drunken", "special");
$holiday_list = array("Christmas", "Hannukah", "Kwanza", "Festivus");
$happy = "$happy_list[array_rand($happy_list)];
$holiday = "$holiday_list[array_rand($holiday_list)];
echo "<p>$happy $holiday, everyone!</p>";
$happy $holiday, everyone!