Pages

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

function finalCallback(alloutput){//here is your final output}cbGenerator=getGroupCallBackGenerator(timeout,finalcallback);asyncCall1(param1,cbGenerator.getCallback('asyncCall1'))asyncCall2(param2,cbGenerator.getCallback('asyncCall2'))asyncCall3(param3,cbGenerator.getCallback('asyncCall3'))asyncCall4(param4,cbGenerator.getCallback('asyncCall4'))cbGenerator.start();

//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
isIE='\v'=='v';//Force String to be a Number (multiply or divide by 1)"100"*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 arrayvar clone =[1,2,4,5,6,9].slice(0);

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.

Mojito is a model-view-controller (MVC) application framework built on YUI 3 and its open source. Most notable feature of mojito is its capability to give you seamless MVC framework to manage your code on server as well as on client. Applications built on Mojito consists of small components called Mojits which are independent UI element which can have their own Model,View, Controller and Binders.

Get from github
git clone https://github.com/markandey/mojito-example-youtube.git

HTMLFrameMojit is inbuilt mojit in the Mojito framework which creates basic html layout. In the example we have created a containerMojit, which is a composite mojit. Then In searchResultMojit we have created binder to handle click of search button. We are using mojitProxy to tunnel the request to mojit. We never bothered about the location of searchResultMojit and framework automatically tunnels the request to mojit either it is on server or it is on client. There is a way to lazyLoad a mojit.

Hi There,
At times you might have to generate few colors which almost covers entire rainbow (visible spectrum) range.

Here in this article I am giving away a function which generates as many colors as you want but those colors will try to cover the entire (visible light) spectrum. i.e if you just generate 3 colors you will get Green, Red and Blue. If you generate 100 colors you will get multiple tints of Green, Red and Blue.

How it works?
I have taken 3 sine waves, all are with different phase. Each of these sine curve generates my RGB values. Each sine wave will swing from 0 to 2pie (360deg). There has been a bit of normalization just to make the colors look good (in final code).

Recently I saw this site , which claims to be working offline, in fact it does but it sucks because it was built using Flash.

Now since we have HTML5 browsers ready!!, we can have 100% working offline website.

On Feb 11 2012, it was Bar Camp (11th) in Bangalore so I decided to educate people about offline capability of HTML5. BCB11 was really nice and many talks were awesome including a talk from Sameer Panchangam on hypnotism.