This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var seen = [] | |
JSON.stringify(components[0], function(key, val) { | |
if (typeof val == "object") { | |
if (seen.indexOf(val) >= 0) | |
return | |
seen.push(val) | |
} | |
return val | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function fibo(n) { | |
var f = []; | |
for (var i = 0; i < n; i++ ) { | |
var item = (i < 2) ? i : f[i-1] + f[i-2]; | |
f.push(item); | |
} | |
return f; | |
} | |
var fibos = fibo(5); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function LinkedList(){ | |
this.head = null; // can be replaced with class or model (to have strong type) | |
this.tail = null; | |
var count = 0; | |
this.AddFirst = function(node){ | |
//Save off the head node so we dont lose it | |
var temp = this.head; | |
//Point head to the new node |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Information hiding | |
function User(){ | |
var username = "Jineesh"; | |
this.getName = function(){ | |
return username; | |
} | |
} | |
var u = new User(); | |
u.getName(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<project default="theMerger" basedir="."> | |
<taskdef resource="net/sf/antcontrib/antcontrib.properties"/> | |
<target name="theloop"> | |
<foreach target="theSeparator" param="theFile"> | |
<path id="someId"> | |
<fileset dir="${basedir}/dd" includes="**/*.js"/> | |
</path> | |
</foreach> | |
</target> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function.prototype.defer = function(t,args){ | |
var __method = this; | |
var timeout = t*1000; | |
window.setTimeout(function() { | |
return __method.call(__method, args); | |
}, timeout); | |
}; | |
function foo(args){ | |
console.log("ss:" , args.a); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
1) doing things in sequence | |
$(btn).click(function(){ | |
getTwitterHandle(function(){ | |
getTweets(function(){ | |
}); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Connector port="8080" protocol="HTTP/1.1" | |
connectionTimeout="20000" | |
redirectPort="8443" | |
compression="on" | |
compressionMinSize="2048" | |
noCompressionUserAgents="gozilla, traviata" | |
compressableMimeType="text/html,text/xml,text/css,text/javascript,application/javascript,application/x-javascript" | |
/> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Y = (function(){ | |
return { | |
Car:function(model){ | |
this.model = model; | |
this.applyBreak = function(){ | |
alert("done break!!"); | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE HTML> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Sample Document</title> | |
<script></script> | |
</head> | |
<body> | |
... |