How to use Google Script to pull data from YQL in a spreadsheet

Here are few simple steps to pull data in an spreadsheet using google scripts.

Step-1 Create a Google Spreadsheet here
Step-2 Create a new blank script
Step-3 Paste the code from here
Step-4 Save and run the script

Here is the video

How to get output of multiple asynchronous calls in one callback

Javascript IO is asynchronous, which is awesome but sometime you might land into a situation where you wanted to call several asynchronous function and when all of them are ready you have to perform some action. Obviously you can not nest each other with anonymous functions in all situations.

so intead of doing this (assume u need to call several asyncCalls 1,2,3 etc,)

         asyncCall1(param1,function (output1){

You might like to do this

    function finalCallback(alloutput){
       //here is your final output

Well You can do it if you want to use my utility function here.

Codefoo Plugin for Sublime Text 2


I developed a Sublime Text 2 Plugin, named codefoo which does some magic for you.
This plugin helps you in retrieving code snippet from web.

Do not leave the browser simply get code in 3 easy steps 
 1. type the query
 2. select
 3. press `ctrl+alt+r`

Try with these query 

 * email validation regex
 * URL validation in javascript
 * reversing a string in javascript
 * slide To unlock css



How it works

It works by searching you query in a list of popular web pages where you find code. Then it scrapes the page to get just the code snippet.

Install Via Sublime Package Control

  1. You should use sublime package manager
  2. Use cmd+shift+P then Package Control: Install Package
  3. Look for CodeFo and install it.
This is all powered by Yahoo! BOSS Search API and YQL.

Javascript Language Sugar (one liners)

Here are some good one liners in javascript

//Hello World Program Which is Palindrome

(alert)('Hello, World') && ('dlroW ,olleH')(trela)

//Reverse a string

"this is a string".split("").reverse().join("");

//Trim a string

" Hello World ".replace(/^\s*|\s*$/g,'')

//HTML escape

"<b>Hello HTML</b>".replace(/([&<>])/g,function (c) {return "&" + {"&": "amp","<": "lt",">": "gt"}[c] + ";";});

//Shuffle an array

[1,2,3,4,5].sort(function(){return (4*Math.random()>2)?1:-1})

//Detect IE


//Force String to be a Number (multiply or divide by 1)


//Force to be boolean

!!"some value"

//Converting string to Leet

"Hello Hacker".replace(/[a-z]/g,function f(a){return "4BCD3F6H1JKLMN0PQR57"[parseInt(a, 36)-10] || a.replace(/[a-t]/gi,f)});

//Clone an array

var clone = [1,2,4,5,6,9].slice(0);

YUI DateTime Chooser

I just created YUI3 DateTime Chooser Module.

What is it?

At some time in a webform you have to capture date and time together with timezone. This YUI3 module is to help you in progressively enhance "date-time form input" to popup (calendar and slider based) UI to input date and time with TimeZone.

How to Use?

<script src=""></script>
<link rel="stylesheet" type="text/css" href="">
gallery: 'gallery-2012.12.12-21-11'
}).use('gallery-datetime-input', function (Y) {
  new Y.DateTimeInput({