How to hide few keys from being stringify

Hello Reader,
Sorry for blogging after really long time. Here is something interesting.

JSON stringify generally try to stringify every thing deeply in an object. There is a formal way to skip (of hiding) something from being stringified. Just use the second argument on stringify function.

There is a easy and hidden trick to hide few keys. Which works like this.

1. Create a variable and assign an empty array. This makes object to be the prototype of array. 
2. Add non numeric keys on this object. 
3. Serialize this object using JSON.stringify
4. You will see that nothing is serialized from this object. 

See It here,output

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);