This file contains 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 Fruit = ["Apple", "Kinnow", "Mango", "Orange"]; | |
var Citrus = ["Lemon", "Kinnow", "Orange", "Tangerine"]; | |
function diffArrays (A, B) { | |
var strA = ":" + A.join("::") + ":"; | |
var strB = ":" + B.join(":|:") + ":"; | |
var reg = new RegExp("(" + strB + ")","gi"); | |
var strDiff = strA.replace(reg,"").replace(/^:/,"").replace(/:$/,""); |
This file contains 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
// original (http://html5shiv.googlecode.com/svn/trunk/html5.js) | |
(function(){if(!/*@cc_on!@*/0)return;var e = "abbr,article,aside,audio,canvas,datalist,details,figure,figcaption,footer,header,hgroup,mark,menu,meter,nav,output,progress,section,summary,time,video".split(','),i=e.length;while(i--){document.createElement(e[i])}})() | |
// kangax version (29 characters less, yay!) | |
/*@cc_on(function(e,i){i=e.length;while(i--)document.createElement(e[i])})("abbr,article,aside,audio,canvas,datalist,details,eventsource,figure,footer,header,hgroup,mark,menu,meter,nav,output,progress,section,time,video".split(','))@*/ | |
// jdalton version (was 5, now 41 characters less than kangax, yay!) |
This file contains 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
[] == false; // true | |
"" == false; // true | |
null == false; // false, that's more like it | |
var a = []; | |
if (a) { | |
alert(1); // alert this; in condition need check a.length | |
} else { | |
alert(2); | |
} |
This file contains 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(){ | |
this.__defineGetter__("__FILE__", function() { | |
return (new Error).stack.split("\n")[2].split("@")[1].split(":").slice(0,-1).join(":"); | |
}); | |
})(); |
This file contains 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
// Array Remove - By John Resig (MIT Licensed) | |
Array.prototype.remove = function(from, to) { | |
var rest = this.slice((to || from) + 1 || this.length); | |
this.length = from < 0 ? this.length + from : from; | |
return this.push.apply(this, rest); | |
}; |
This file contains 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
/* by Dmitry A. Soshnikov */ | |
var object = (function () { | |
// private | |
var _x = 10; | |
// also private | |
function _privateFunc() { | |
return _x; |
This file contains 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
/** | |
* Aliases and additional "sugar" | |
* 2010-04-15 | |
* @author Dmitry A. Soshnikov | |
*/ | |
(function () { | |
["defineProperty", "defineProperties", "keys", "getOwnPropertyNames", | |
"getOwnPropertyDescriptor", "getPrototypeOf", "seal", "freeze", | |
"preventExtensions", "isFrozen", "isSealed", "isExtensible"] |
This file contains 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
if (!window.localStorage || !window.sessionStorage) (function () { | |
var Storage = function (type) { | |
function createCookie(name, value, days) { | |
var date, expires; | |
if (days) { | |
date = new Date(); | |
date.setTime(date.getTime()+(days*24*60*60*1000)); | |
expires = "; expires="+date.toGMTString(); |
This file contains 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
/* | |
* classList.js | |
* | |
* Implements a cross-browser element.classList getter. | |
* | |
*/ | |
"use strict"; | |
if (typeof Element !== "undefined") { |
This file contains 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 _restoreSymbol = (function($G) | |
{ | |
var iframe = document.createElement('iframe'); | |
(document.body || document.documentElement).appendChild(iframe); | |
iframe.style.display = 'none'; | |
var win = iframe.contentWindow, doc = win.document; | |
doc.open(); |
OlderNewer