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
<html> | |
<head> | |
<!-- The <script> switches rel="prefetch" to rel="stylesheet" at proper time, et voila, magic happens :-) --> | |
<link rel="prefetch" type="text/css" href="https://cdn.limitlesslane.com/css/mini/async_lib.css" /> | |
<link rel="stylesheet" type="text/css" href="https://cdn.limitlesslane.com/css/mini/lib.css" /> | |
<link rel="stylesheet" type="text/css" href="https://cdn.limitlesslane.com/css/mini/app.css" /> | |
<link rel="prefetch" type="text/css" href="https://cdn.limitlesslane.com/css/mini/async_app.css" /> | |
<script> | |
;(function(w,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
// 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
/* | |
source: http://stackoverflow.com/questions/2048720/get-all-attributes-from-a-html-element-with-javascript-jquery/16935800#16935800 | |
*/ | |
(function($) { | |
$.fn.getAttributes = function () { | |
var elem = this, | |
attr = {}; | |
if(elem && elem.length) $.each(elem.get(0).attributes, function(v,n) { | |
n = n.nodeName||n.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
/** | |
* Find selector in this and descendants of this. | |
* if up == true, search parents as well. | |
* | |
*/ | |
;(function (global) { | |
var $ = global.jQuery || global.Zepto; | |
$.fn.findAll = function findAll(selector, up) { |
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
/** | |
* 4-10 times faster .each replacement | |
* use it carefully, as it overrides jQuery context of element on each iteration | |
* | |
* function clb(DOM, idx, $DOM, DOM) {}; | |
* $DOM == $(DOM), is the same object throughout iteration | |
* | |
*/ | |
;(function (global) { |
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
/** | |
* A small jQuery plugin to enable/disable any form element, | |
* and any generic element (with 'disabled' class) | |
*/ | |
;(function (global) { | |
var $ = global.jQuery || global.Zepto; | |
$.fn.enable = function (cls) { | |
var prp = 'disabled'; |
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
/** | |
* Gets outerHTML of an element | |
*/ | |
;(function (global) { | |
var $ = global.jQuery || global.Zepto; | |
$.fn.outerHTML = function fouterHTML() { | |
$t = $(this); | |
if ('outerHTML' in $t[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
/** | |
* Finds maximum zIndex of an element | |
*/ | |
;(function (global) { | |
var $ = global.jQuery || global.Zepto; | |
var maxZIndex = function maxZIndex(el,min) { | |
var el = this | |
, zIdx = el.css('zIndex') |
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
//******************************************* | |
// Level 1, basic API, minimum support | |
//******************************************* | |
/* | |
Modules IDs are strings that follow CommonJS | |
module names. | |
*/ | |
//To load code at the top level JS file, | |
//or inside a module to dynamically fetch |
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
/** | |
* Set cache control headers and manage http cache logic. | |
* | |
* @param (int|bool) $expires: true - use cache, false - no cache, int - expires timeout | |
* @param (time) [$modified]: Last modification time stamp | |
* @param (string) [$etag]: ETag content identifier | |
* @param (int) [$die]: 0 - no die, 1 - die on 304, -1 - no 304 headers | |
* | |
* @return (mixed) status code if cache, false if headers sent, true otherwise | |
* |
OlderNewer