Quotes on Design API v3.0 (+ Widgets!)
Published by Chris Coyier
Back in the sad ol' days of the v1.0 API, everytime any site using it loaded the script, a database call was made to pull a fresh quote from the Quotes on Design archives. It worked, but it was slow and clearly not going to scale well.
Version 2.0 was put together to solve those problems. A CRON job was used to run one DB query every 10 minutes and write the quote and markup to a .TXT file. Then when the script was called, it just read the content of that file and used that to work the magic. It actually worked great. I learned that this technique is referred to as "Ghetto Caching" which I love.
But 2.0 was limited in a number of ways, hence we bring you version 3.0! Credit where credit is due, Doug Neiner spearheaded this project. As with everything Doug does, he did a great job with all of it. </megapraise>
What does it do?
It inserts random quotes from Quotes on Design onto any website. It's also a JSON file, for use in more advanced scenarios.
Different Strokes for Different Folks
See the documentation for information on all these cases.
How does it work?
Sound complicated? I guess it kinda is. There are a lot of different technologies at work here all coming together to ultimately make things simple for people using it. It's really pretty beautiful looking at all of it together.
Can we see it?
Keep an eye on Fuel Your Coding where eventually Doug is going to talk about the considerations of building a JSON API like this and will probably reference this at least somewhat during it.
Oh, and a widget!
If you are an OS X user, there is now a Dashboard Widget for you! On that widgets page, you'll find a link to download it as well as a link to Github where the project is hosted (and open sourced!)
It looks cool there but even more lovely on the faded gray of the dashboard. It's really quite sweet. Again, Doug did an awesome job translating the design of the site into a widget. Windows folks, sorry this is OS X only for now, but remember there is a JSON file out there which surely other widgets may be built.
If you use the API for a site or a widget or anything else, do share by commenting here or sending in an message. It'll be fun to see how this might be used. And if you have some great quotes to share, send them in (click the Got One? link). Getting near 500 now!