Skip to content

Instantly share code, notes, and snippets.

@hausen
Last active August 29, 2015 13:57
Show Gist options
  • Star 36 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hausen/9501041 to your computer and use it in GitHub Desktop.
Save hausen/9501041 to your computer and use it in GitHub Desktop.
"Fixing" xkcd 1340 (or making the most redonkulous clock ever)

"Fixing" xkcd 1340 (or making the most redonkulous clock ever)

Update: feeling adventurous? Clone or fork the xkcd clock! If you just want to see it in action or get a glimpse of how it works, keep reading.

Problem

The date in xkcd's comic number 1340 does not change.

Solution

Since Randall publishes his comics under a permissive license, anyone can fix this problem and let the guy focus on more important issues, like writing great comics.

We propose the following approach:

  1. Grab the original image and erase the date using a raster graphics editor, such as the GIMP.
  2. Save the image to PNG and convert it to base 64.
  3. Obtain the xkcd font and convert it to a web font using FontSquirrel's font-face generator. Select the "expert" mode and check "Base 64 encode."
  4. Put all the parts together with HTML, CSS and Javascript, just like in the reference implementation

The results can be seen in http://jsfiddle.net/Lej6m/4/.

Overengineering the solution

In the spirit of the HTML clocks posted on HN, it is possible to make Cueball update its speech bubble every second, making http://jsfiddle.net/Lej6m/25/ the first instance of an xkcd-inspired clock that the author is aware of.

Conclusions

In this Gist, we have shown that it is possible to waste one's time to build an awesome clock using an xkcd comic strip as a clock face. The techniques shown in this work can be extended to other webcomics, or to newspaper comics that have been previously scanned.

Acknowledgements: Randall Munroe for the comics, Kyle Kelley and/or Brian E. Granger for the xkcd font, Mads Kristensen for the image to base64 converter and Font Squirrel for the font converter tool.

@chuckwagoncomputing
Copy link

@tomlof and @DouglasLivingstone
Here's a couple shell scripts I wrote for 1335. The first gets the images, and the second gives the path to the correct image for the current time. I have a cron job running that uses the second script to get the image for my desktop wallpaper.
https://gist.github.com/chuckwagoncomputing/9242595
https://gist.github.com/chuckwagoncomputing/9242607

@coreh
Copy link

coreh commented Mar 12, 2014

@hmottestad We could probably use canvas so that it's consistent on retina displays.

@keithwyland
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment