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
/*! | |
* jQuery ie6ize: Emulate IE-6 rendering - 11/13/2009 | |
* http://mankzblog.wordpress.com/2009/11/13/ie6-frame-to-battle-chrome-frame/ | |
* | |
* Created by Mats Bryntse | |
* | |
* Plugin-ified by "Cowboy" Ben Alman | |
* http://benalman.com/ | |
*/ |
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 Foo(name) { | |
this.type = 'foo'; | |
} | |
Foo.prototype = { | |
name: function (name) { | |
if (name) { | |
this._name = name; | |
} else { | |
return this._name; |
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 Foo(name) { | |
this.type = 'foo'; | |
} | |
Foo.prototype = { | |
name: function (name) { | |
if (name) { | |
this._name = name; | |
} else { | |
return this._name; |
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 isPrime( num ) { | |
if ( isPrime.cache[ num ] != null ) | |
return isPrime.cache[ num ]; | |
// everything but 1 can be prime | |
var prime = num != 1; | |
for ( var i = 2; i < num; i++ ) { | |
if ( num % i == 0 ) { | |
prime = false; | |
break; |
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 e = "touchstart touchmove touchend".split(' '), | |
i = e.length, | |
method = ''; | |
while(i--) { | |
$.fn[method = e[i]] = function (fn) { | |
return fn ? | |
this.bind(method, fn) : | |
this.trigger(method); | |
}; |
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 e = "touchstart touchmove touchend".split(' '), | |
i = e.length, | |
method = ''; | |
while(i--) { | |
(function (method) { // method is now private | |
$.fn[method] = function (fn) { | |
return fn ? | |
this.bind(method, fn) : | |
this.trigger(method); |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset=utf-8 /> | |
<title>Lazy Eval Technique</title> | |
</head> | |
<body> | |
<script id="lazy"> | |
/* | |
alert('lazy module loaded'); |
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 getQuery(s) { | |
var query = {}; | |
s.replace(/\b([^&=]*)=([^&=]*)\b/g, function (m, a, d) { | |
if (typeof query[a] != 'undefined') { | |
query[a] += ',' + d; | |
} else { | |
query[a] = d; | |
} | |
}); |
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
// jQuery based patch for onorientationchange | |
(function () { | |
var w = window.innerWidth, h = window.innerHeight, el = $('body')[0]; | |
if (!('onorientationchange' in el)) { | |
if (el.setAttribute) { | |
el.setAttribute('onorientationchange', 'return;'); | |
if (!typeof element[eventName] == 'function') { | |
// patch support for the onorientationchange event via onresize | |
$(window).resize(function () { |
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
// because I just needed the function to run once, then assign it - | |
// I knew that I'd never need to run it manually again, so here I | |
// extended the Function prototype :) | |
Function.prototype.runReturn = function () { | |
this.call(); | |
return this; | |
}; | |
// for example: |
OlderNewer