Playing with Javascript Closure, JSON, & YQL to Visualize upcoming Android Version Names

Hi There,
As you know that First version of android was named "cupcake" and then it was "Donut" and current version is "Éclair".
People found a pattern in naming; they are alphabetical names of cake. Now many people on internet came up with the names up to the Z.
Here they are

  • Cupcake
  • Donut
  • Eclair Cake
  • Frosting
  • Gelato
  • Honey
  • Icing cake
  • Jelly
  • Kiwi
  • Lemon
  • Marshmellow
  • Noodle
  • Orange
  • Pudding
  • Quince
  • RockyRoad
  • Sundae
  • Taffee
  • upside-down-cake
  • Vanilla
  • Waffle
  • Xmas Cookies
  • Yogurt
  • Zebra Cake

I am completely unaware of some of these names; I really don’t know how they look like. So here i made a small YQL hack to get images with these names to visualize them.

Here is the YQL Bing table query to images

function get_images_from_bing(query,callback){
var yql_url="*"+query+"%22&format=json&"+callback;
var div_ele=document.getElementById("myscrpts");
var scrpt=document.createElement("SCRIPT");

Here I am using closure to get a call-back function which will render the my images.

function GetCallbackFunction(element){
element will be accessible to inner returned function
even after outer function has returned
return function(data){
/*Get randomely from top 3 images*/
var index=get_random(3);

No comments:

Post a Comment

Your comment will inspire me, Please leave your comment