I’m addicted to the webcomic Dilbert by Scott Adams. He publishes one comic strip a day, like this one:

With its archive ranging more than twenty years back, a random function to discover new old comics would be quite handy. That is what the following code snippet does: Create a random date between January 1st 1990 and today and navigate to that day’s comic address:
javascript:function pad(n){return n<10 ? '0'+n : n} var now = Date.now(); var offset = (new Date(1990, 01, 01)).valueOf(); var rdate = new Date(offset + Math.round(Math.random() * (now-offset))); location.href = 'http://dilbert.com/strips/comic/' + rdate.getFullYear() + '-' + pad(rdate.getMonth()+1) + '-' + pad(rdate.getDate()) + '/';
Just copy the text and add it as the URL to a new bookmark called “Random Dilbert”. Whenever you click on it, it takes you to a different comic.
Leave a comment