Wednesday, August 8, 2012


warning: lots of text ahead. just read it.

this post is all about random-ness. but not in the way you're probably thinking about it. i have two weeks left and obviously that means that i'm working my tail off to get things ready—to get myself ready, to finish off any last things i want to get done, and deciding what i'll be doing with my blog while i'm gone for two years. that's a long time and at some point i know most of you will be all like—psh, he's basically dead to me. (if you do that i will be livid. you had better all write me and consider me very much alive.) 

so i came up with an idea to keep clay-all-day more alive than just a weekly letter i'll have my mom post (that's pretty much all i have planned. is that okay? would you guys want to read my letters through my blog? it's how you're keeping up-to-date with my life anyways so i'll take that blank stare as a yes.) i did some research and some late-night coding and came up with this—you might've already noticed it in the past twelve-or-so hours:

that's a button. go ahead, click on it. did you see that? cool, huh?  it brings up a completely random post from the past (and maybe the future... i've clicked it a bunch of times and have yet to come across one that i have yet to write—maybe if i click it one more time...) and since i've made four-hundred and ten (this will be four-hundred and eleven) posts, and i'll be gone for roughly seven-hundred and thirty days, that leaves you with a completely (but not at all) new post every days! (holy moly it takes a lot of self-restraint not to use numbers in that situation. in case you were wondering, i made the decision a long time ago not to use numbers ever because in this font the numbers are an eye-sore. and i refuse to not use this font.) which is actually just about my average frequency of a new post every days! (not including my very first post, which preceded the second post by sixty-seven days holding the record for the longest time between any two posts. bonus points to the first person to tell me the second longest gap. update: ding ding ding! we have winner, folks! my good friend, Wyatt Duclos got it: "Twenty four days between the posts ".111111" and "SHRIMP AND DANCE MOVES." I am that good." yes, Wyatt, yes you are. here's fifty-four-thousand three-hundred one points. spend them wisely.) 

so in short, if you come back to my blog every day and a half and click that button just once, it'll be like i never left. plus, you'll be getting a weekly supplement of my writings anyway. oh guys, i really hope you'll write me. i'm deathly afraid that all of the bad karma i've stacked up from not writing my friends as frequently as i should will come back to bite me. so in order to balance my karma and sway the universe into making you guys write me, i'm going to do the most noble thing any person can do for another person. and that is teach you something. would you like to know how to make a custom button for your blog to bring up a random post from the past? yes? you would? cool! 

it's actually pretty easy, it took me a while to get the pieces together but i'll try to make it as painless as possible for you.

go to your blog's template page and click "Edit HTML". now, this is important, this page holds the guts of your blog. mess one thing up and kablamo. there goes your blog. but don't let that scare you! i'm right here with you. so in order to avoid utter destruction, let's make a backup of your blog first. so click "Cancel" on the window that came up and find the "Backup/Restore" button in the top right. click it, and then "Download full template" somewhere on your computer.

now we're ready to work. click "Edit HTML" again and this time click "Proceed." mmmmm code :) to make sure you don't mess anything up, stay focused and don't go messing with things. (that's completely against the way that i live, let me clear that up. don't go messing with thing yet. once you're done with this, please! by all means! go mess with that code until the phat lady sings! i encourage curiosity! look up tutorials on how to write in HTML or JavaScript or make art with CSS. it's great stuff, really!) we want to inject some code in between the <head> </head> tags, i always add new stuff to the bottom of code i haven't written myself so let's find the space right before the </head> tag. press command + f (or control + f if you're using a PC) and search for </head>. now copy and paste this code before </head> and not inside of any other tags that are already nested in <head>

<script type='text/javascript'>
function showLucky(root){
    var feed = root.feed;
    var entries = feed.entry || [];
    var entry = feed.entry[0];
      for (var j = 0; j <; ++j) {
       if ([j].rel == "alternate") { 
       window.location =[j].href; 

function fetchLuck(luck){
    script = document.createElement('script');
    script.src = '/feeds/posts/summary?start-index='+luck+'&max-results=1&alt=json-in-script&callback=showLucky';
    script.type = 'text/javascript';
function readLucky(root){
    var feed = root.feed;
    var total = parseInt(feed.openSearch$totalResults.$t,10);
    var luckyNumber = Math.floor(Math.random()*total);
function feelingLucky(){
    var script = document.createElement('script');
    script.type = 'text/javascript';
    script.src = '/feeds/posts/summary?max-results=0&alt=json-in-script&callback=readLucky';

this is just some simple JavaScript to grab a random post. i named it after the "Feeling Lucky" button on Google. nerds... okay! that's all you need to do there! you've just made that function available on your blog, so now let's make the button that will call that function when it's clicked. click "Save template" and we'll move on.

i put my button in my sidebar. go to your Layout page and click "Add a Gadget" wherever you want to put yours. pick the "HTML/JavaScript" gadget. and then copy and paste this code into the Content box. make sure that the button in the top right corner says Rich Text because that means you're editing HTML (confusing, i know. that's why Google isn't Apple...) 

<a href="#random">
<img border="0" src="http://yourimage.url" width="your image width" height="your image height" onclick="feelingLucky()" title="Random Post" />

let's break that down a bit. 

href="#random" will append ?random to the back of your url which is needed for our feelingLucky function i mentioned earlier.

border="0" will make sure your image doesn't have the default border around it which can be visually disrupting. (if that doesn't work for you, comment and i'll work with you, because it could take some CSS tweaking behind the scenes.)

 src="" this is probably the only part you care about. this is the face of the button, the image, the goods, the juice. call it what you will, just point src to a real image you've made and uploaded (i just throw all of mine on Google+ actually. that's the only use i have for that site.)

width="" and height="" just make sure you get these right or your image with get skewed and look horrible.

onclick="feelingLucky()" there's the magic. when the button is clicked the site calls the JavaScript function you injected in the <head> tags which will bring up a random post! cool, huh?

now just click Save and go pull up a blast from the past! that's just about all there is to it. tweak it, make it just right, and let me know when you use it! and as always, if you ever need help just ask! well, at least for the next two weeks, after that you're on your own! 

hopefully i've earned some good karma and in turn earned a few letters from you, my faithful readers. i don't want to get all sappy yet (i'll save that for my last few posts) but i really do appreciate you guys. i get so happy when i see that someone has commented. i always try to reply because you guys really do mean quite a bit to me! together we've shared some of my favorite days, moments, songs, videos, ideas. i feel more creative because i want to create things for you! i have such a great time here and i hope you guys do, too. i mean it when i say it—i love you guys. i have some of the best readers a blogger could ask for. 

now go make me proud and make a random post button.

oh and, once i leave, come back every day and a half and click on that button. it'll be living over in the sidebar to the right.


  1. Twenty four days between the posts ".111111" and "SHRIMP AND DANCE MOVES." I am that good.

    1. booya! ding ding ding! we have a winner! i should've known it would be you Mr. Duclos.

    2. your reward has been awarded. go check out that paragraph again!

    3. I am so proud to have won. I have been saving points for years and I haven't even gathered a fourth of fifty-four-thousand three-hundred one points. Thank you, sir. Thank you.