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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
/** | |
* Switch-style checkboxes. | |
* Inspired by Espresso’s “Tools” switch | |
*/ | |
input[type="checkbox"]:not(:checked), | |
input[type="checkbox"]:checked { /* :checked here acting as a filter for older browsers */ | |
position: absolute; | |
opacity: 0; | |
} |
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('html').empty().html('<iframe src="http://cnn.com" style="position:absolute;top:0;left:0;width:100%;height:100%;border:0"></iframe>'); |
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($){ | |
/*define the function */ | |
function use(method /*args*/){ | |
return use.fn.init.apply({},[Array.prototype.slice.call(arguments)]); | |
} | |
/*define the underlying prototype*/ | |
use.fn = use.prototype = { | |
init: function(initStack,oldstack){ |
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; | |
function hardWidth($el){ | |
$el.css({width:$el.width()}); | |
} | |
function hardSize($el){ | |
$el.css({height:$el.height(),width:$el.width()}); | |
} |
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 keydownTabString = 'keydown.tabnamespace';//string of the custom event using a custom namespace | |
function getInputs($modalOuter){ | |
return $modalOuter.find('select, input, textarea, button, a[href], [tabindex]').filter(':visible'); | |
} | |
function switchTabFocusTarget($switchFocusTo, noshift){ | |
return function(e){ | |
if ((e.which === 9 && (noshift?!e.shiftKey:e.shiftKey))) { | |
stopEvent(e); |
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 addOne(n){ return n+1; } | |
function logger(){ console.log.apply(console,arguments); return } | |
//Promise unit | |
function unit(n){ return $.Deferred().resolve(n); } | |
//make a simple function into a function that returns a Promise | |
function lift(fn){ |
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 unit(x) { | |
return Promise.resolve(x); | |
} | |
function bind(input, f) { | |
return input.then(function(x){ | |
return f(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
/*unit */ | |
//Promise.right*/ | |
function resolve(x) { | |
return Promise.resolve(x); | |
} | |
/*Promise.left*/ | |
function reject(x) { | |
return Promise.reject(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
/*Some basic units: values wrapped in a Promise */ | |
//Promise.right*/ | |
function resolve(x) { | |
return Promise.resolve(x); | |
} | |
/*Promise.left*/ | |
function reject(x) { | |
return Promise.reject(x); |
OlderNewer