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
// This might be useful for certain size-limited JS competitions, or not. #js | |
function super_shrinkify( str ){ | |
if ( str.length % 2 ) { | |
str += ' '; | |
} | |
var prefix = '"', | |
suffix = '".replace(/./g,function(a){a=a.charCodeAt();return String.fromCharCode(a>>7,a%128)})', | |
str_bytes = unescape( encodeURIComponent( str ) ).length, |
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 short snippet for detecting versions of IE in JavaScript | |
// without resorting to user-agent sniffing | |
// ---------------------------------------------------------- | |
// If you're not in IE (or IE version is less than 5) then: | |
// ie === undefined | |
// If you're in IE (>=5) then you can determine which version: | |
// ie === 7; // IE7 | |
// Thus, to detect IE: | |
// if (ie) {} |
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 doHash(str, seed) { | |
var m = 0x5bd1e995; | |
var r = 24; | |
var h = seed ^ str.length; | |
var length = str.length; | |
var currentIndex = 0; | |
while (length >= 4) { | |
var k = UInt32(str, currentIndex); | |
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
//SUMMARY: | |
// a() @ b() ==> execute a(). if a() flags an async deferral inside it, | |
// then wait to continue execution of the expression until that promise is | |
// fulfilled, then continue execution *AT* b(). | |
// | |
// more generally: X @ Y ==> evaluate X expression. if it was a function call | |
// call that deferred with a promise, wait until fulfilled then continue at | |
// Y. otherwise, assume that X had an implicit immediately fulfilled promise, | |
// and continue evaluating at Y. | |
// ------ |
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
/* | |
* matchMedia() polyfill - test whether a CSS media type or media query applies | |
* primary author: Scott Jehl | |
* Copyright (c) 2010 Filament Group, Inc | |
* MIT license | |
* adapted by Paul Irish to use the matchMedia API | |
* http://dev.w3.org/csswg/cssom-view/#dom-window-matchmedia | |
* which webkit now supports: http://trac.webkit.org/changeset/72552 | |
* | |
* Doesn't implement media.type as there's no way for crossbrowser property |
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 noteval(code, doc){ | |
// add some javascript to a document, like an iframe | |
// | |
// var iframe = document.getElementById("theframe"); | |
// noteval('alert("hi")', iframe.contentDocument || iframe.) | |
var e = doc.createElement("script"), | |
how = "text" in e ? "text" : | |
"textContent" in e ? "textContent" : |
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
// LABjs style | |
<script src="js/LAB.min.js"></script> | |
<script> | |
$LAB | |
.script("underscore.js") | |
.script("jquery.js") | |
.script("mycode.js") | |
.wait(function() { | |
//do something |
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
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | |
Version 2, December 2004 | |
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE> | |
Everyone is permitted to copy and distribute verbatim or modified | |
copies of this license document, and changing it is allowed as long | |
as the name is changed. | |
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE |
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 rAF = "equestAnimationFrame"; | |
window["r"+rAF] = window["r"+rAF] || | |
window["webkitR"+rAF] || | |
window["mozR"+rAF] || | |
window["msR"+rAF] || | |
window["oR"+rAF]; | |
// A list |
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
LABEL LABEL2 UNIQUE UA's # OF USES | |
(empty) - 1 20553 | |
(unrecognized) - 740 10789 | |
(bots) - 354 111898 | |
Clients - 513 1727 | |
Windows (other) 39 166 | |
Windows IE 12301 94162 | |
Windows Chrome 770 23069 | |
Windows Safari 99 541 | |
Windows Opera 553 3645 |
OlderNewer