Created
July 23, 2014 12:29
-
-
Save zhanhongtao/03d24d0076810eb38b58 to your computer and use it in GitHub Desktop.
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
</body> | |
</html> |
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 jsonpcallback = (function() { | |
var id = 0; | |
var prefix = '_json_p_' + ('' + Math.random()).slice( 2, 8 ); | |
var noop = function() {}; | |
return function(cb) { | |
var name = prefix + (++id); | |
this[ name ] = typeof cb === 'function' ? cb : noop; | |
return name; | |
}; | |
})(); | |
var partial = function( cb ) { | |
var argus = [].slice.call( arguments, 1 ); | |
return function() { | |
return cb.apply( null, argus.concat( [].slice.call(arguments) ) ); | |
}; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment