Barney is...

Posted by barnoid Tue, 05 Oct 2010 09:49:00 GMT

So you're wondering where that quote on every page of my site comes from?

Every night a script runs that uses a Google API to search the web for the string "Barney x ", where x is one of: "is", "was", "can", "should", "shall", "will", "thinks", "says", "does", "keeps", "won", "isn't", "wasn't", "can't", "shouldn't", "won't". The results are cleaned up and then stored in a file along with the URL of the source and the date of the search. Up to 200 quotes are kept in the file with the older ones being replaced when new ones are found, this ensures the quotes remain topical. A random quote is picked from the file on page load, it might not always change every time though due to caching.

The original idea for this came from googlism.com several years ago. My old site used to achieve the same thing by doing a Google query for every page load, which is not ideal.

A certain Purple Dinosaur has always featured as the subject of many quotes along regular appearances from a Flintstone, a Simpsons character and from the artist Matthew Barney. More recently there seem to be a lot of quotes about a character from How I Met Your Mother and about the politician Barney Frank. The number of quotes about George W Bush's dog have reduced in recent years.