Skip to content

Instantly share code, notes, and snippets.

@heisters
heisters / hack.sh
Created April 11, 2012 15:57 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@heisters
heisters / require.js
Created January 31, 2011 23:30
A robust remote JS dependency manager
var require = (function(){
var requires = {};
return function(filename, callback){
if(typeof(requires[filename]) === "undefined"){
requires[filename] = {
callbacks: [],
state: "initializing",
};
}
@heisters
heisters / jsonp.js
Created October 22, 2009 00:20 — forked from malsup/jsonp
an alternative to jQuery's JSONP method with basic error handling
// fn to handle jsonp with timeouts and errors
// hat tip to Ricardo Tomasi for the timeout logic
$.getJSONP = function(s) {
s.dataType = 'jsonp';
$.ajax(s);
var t = 0, cb = s.url.match(/callback=(\w+)/)[1], cbFn = window[cb];
var $script = $('head script[src*='+cb+']');
if (!$script.length)
return; // same domain request