Skip to content

Instantly share code, notes, and snippets.

@stucox
stucox / README.md
Last active August 3, 2016 07:29
Test case for github.com/stealjs/steal/issues/800
@stucox
stucox / modernizr-3.0-beta.all.js
Last active December 29, 2015 17:59
Beta version of Modernizr 3.0, with everything in, built from commit 6d7c5ffa
/*! modernizr 3.0.0pre (Custom Build) | MIT */!function(a,b,c){function d(a,b){return typeof a===b}function e(){var a,b,c,e,f,g,h;for(var i in r){if(a=[],b=r[i],b.name&&(a.push(b.name.toLowerCase()),b.options&&b.options.aliases&&b.options.aliases.length))for(c=0;c<b.options.aliases.length;c++)a.push(b.options.aliases[c].toLowerCase());for(e=d(b.fn,"function")?b.fn():b.fn,f=0;f<a.length;f++)g=a[f],h=g.split("."),1===h.length?Modernizr[h[0]]=e:2===h.length&&(Modernizr[h[0]][h[1]]=e),u.push((e?"":"no-")+h.join("-"))}}function f(a){var b=v.className,c=Modernizr._config.classPrefix||"",d=new RegExp("(^|\\s)"+c+"no-js(\\s|$)");b=b.replace(d,"$1"+c+"js$2"),Modernizr._config.enableClasses&&(b+=" "+c+a.join(" "+c),v.className=b)}function g(a,b){if("object"==typeof a)for(var c in a)t(a,c)&&g(c,a[c]);else{a=a.toLowerCase();var d=a.split("."),e=Modernizr[d[0]];if(2==d.length&&(e=e[d[1]]),"undefined"!=typeof e)return Modernizr;b="function"==typeof b?b():b,1==d.length?Modernizr[d[0]]=b:2==d.length&&(Modernizr[d[0]][d[1]]=b
#!/usr/bin/env python
"""
To enable save as /yourproject/.git/hooks/prepare-commit-msg and make executable: chmod +rx prepare-commit-msg
"""
import sys
from subprocess import check_output
def get_ticket_number():
branch_name = check_output(['git', 'rev-parse', '--abbrev-ref', 'HEAD'])
@stucox
stucox / modernizr.all.bookmarklet
Last active December 16, 2015 15:49
A Modernizr 2.6.2 build with *everything* in it - including community detects and extensibility features. Designed for development/debugging/dabbling - **Don't use this in production!** - it'll be painfully slow. Note: this uses @ryanseddon's revised MathML test (https://github.com/Modernizr/Modernizr/issues/682), because the packaged one left s…
javascript:(function(){var script=document.createElement('script'); script.type='text/javascript'; script.src='https://rawgithub.com/stucox/5459054/raw/4eca7c322df2fa1036a04a63e618c1a4e5db7996/modernizr.all.min.js'; document.head.appendChild(script);})();
@stucox
stucox / blackout.js
Created March 26, 2013 14:03
Blacks out / reveals the window. Useful as a bookmark (it toggles) — copy the minified version and stick `javascript:` in front of it.
(function () {
var cover = document.getElementById('__cover');
if(cover) {
document.body.removeChild(cover);
}
else {
cover = document.createElement('div');
cover.id = '__cover';
cover.setAttribute('style', 'background:#000;position:fixed;top:0;left:0;width:100%;height:100%;z-index:999999');
document.body.appendChild(cover);
@stucox
stucox / mutationobserver.js
Created March 24, 2013 09:36
Mutation Observer feature detection
// http://www.w3.org/TR/dom/
// http://updates.html5rocks.com/2012/02/Detect-DOM-changes-with-Mutation-Observers
// https://developer.mozilla.org/en-US/docs/DOM/MutationObserver
var MutationObserver = (function () {
var prefixes = ['WebKit', 'Moz', 'O', 'Ms', '']
for(var i=0; i < prefixes.length; i++) {
if(prefixes[i] + 'MutationObserver' in window) {
return window[prefixes[i] + 'MutationObserver'];
}
}
window.Modernizr=function(e,t,n){function r(e){b.cssText=e}function o(e,t){return r(M.join(e+";")+(t||""))}function i(e,t){return typeof e===t}function a(e,t){return!!~(""+e).indexOf(t)}function d(e,t){for(var r in e){var o=e[r]
if(!a(o,"-")&&b[o]!==n)return"pfx"==t?o:!0}return!1}function s(e,t,r){for(var o in e){var a=t[e[o]]
if(a!==n)return r===!1?e[o]:i(a,"function")?a.bind(r||t):a}return!1}function c(e,t,n){var r=e.charAt(0).toUpperCase()+e.slice(1),o=(e+" "+T.join(r+" ")+r).split(" ")
return i(t,"string")||i(t,"undefined")?d(o,t):(o=(e+" "+x.join(r+" ")+r).split(" "),s(o,t,n))}function l(){f.input=function(n){for(var r=0,o=n.length;o>r;r++)B[n[r]]=!!(n[r]in y)
return B.list&&(B.list=!(!t.createElement("datalist")||!e.HTMLDataListElement)),B}("autocomplete autofocus list placeholder max min multiple pattern required step".split(" ")),f.inputtypes=function(e){for(var r,o,i,a=0,d=e.length;d>a;a++)y.setAttribute("type",o=e[a]),r="text"!==y.type,r&&(y.value=w,y.style.cssText="position:absolute;visibility:hidd
/*! Modernizr 3.0.0pre (Custom Build) | MIT */
(function(e,t,n){function o(e,t){return typeof e===t}function u(){var e,t,n,i,u;for(var a in r){e=[],t=r[a];if(t.name){e.push(t.name.toLowerCase());if(t.options&&t.options.aliases&&t.options.aliases.length)for(n=0;n<t.options.aliases.length;n++)e.push(t.options.aliases[n].toLowerCase())}i=o(t.fn,"function")?t.fn():t.fn;for(u=0;u<e.length;u++)Modernizr[e[u]]=i,s.push((Modernizr[e[u]]?"":"no-")+e[u])}}function f(e){var t=e||a;t.className=t.className.replace(/(^|\s)no-js(\s|$)/,"$1$2")+(Modernizr._config.enableClasses?" js "+(s.length?Modernizr._config.classPrefix||"":"")+s.join(" "+(Modernizr._config.classPrefix||"")):"")}function c(e,t){if(typeof e=="object")for(var r in e)l(e,r)&&c(r,e[r]);else{e=e.toLowerCase();if(Modernizr[e]!==n)return Modernizr;t=typeof t=="function"?t():t,Modernizr._config.enableClasses&&(a.className+=" "+(Modernizr._config.classPrefix||"")+(t?"":"no-")+e),Modernizr[e]=t}return Modernizr}function p(e,t){return!!~(""+e).indexOf(t)}function y(
@stucox
stucox / modernizr.custom.07390.js
Created January 28, 2013 10:31
Modernizr 2.6.2 build with IndexedDB
/* Modernizr 2.6.2 (Custom Build) | MIT & BSD
* Build: http://modernizr.com/download/#-indexeddb-shiv-cssclasses-testprop-testallprops-domprefixes-load
*/
;window.Modernizr=function(a,b,c){function x(a){j.cssText=a}function y(a,b){return x(prefixes.join(a+";")+(b||""))}function z(a,b){return typeof a===b}function A(a,b){return!!~(""+a).indexOf(b)}function B(a,b){for(var d in a){var e=a[d];if(!A(e,"-")&&j[e]!==c)return b=="pfx"?e:!0}return!1}function C(a,b,d){for(var e in a){var f=b[a[e]];if(f!==c)return d===!1?a[e]:z(f,"function")?f.bind(d||b):f}return!1}function D(a,b,c){var d=a.charAt(0).toUpperCase()+a.slice(1),e=(a+" "+n.join(d+" ")+d).split(" ");return z(b,"string")||z(b,"undefined")?B(e,b):(e=(a+" "+o.join(d+" ")+d).split(" "),C(e,b,c))}var d="2.6.2",e={},f=!0,g=b.documentElement,h="modernizr",i=b.createElement(h),j=i.style,k,l={}.toString,m="Webkit Moz O ms",n=m.split(" "),o=m.toLowerCase().split(" "),p={},q={},r={},s=[],t=s.slice,u,v={}.hasOwnProperty,w;!z(v,"undefined")&&!z(v.call,"undefined")?w=fu
@stucox
stucox / patch.diff
Created May 7, 2012 22:53
Patch for pyjon to support Underscore.js
diff --git a/pyjon/interpr.py b/pyjon/interpr.py
index 5520d95..4c639b4 100644
--- a/pyjon/interpr.py
+++ b/pyjon/interpr.py
@@ -1467,6 +1467,11 @@ class array_proto(list, Prototype):
def pop(self): return list.pop(self)
@publicmethod
+ def sort(self, sortfn=None):
+ list.sort(self, sortfn)