Skip to content

Instantly share code, notes, and snippets.

@skt-t1-byungi
Last active August 30, 2016 00:59
Show Gist options
  • Save skt-t1-byungi/289691475c6cdb5042dd4a2b5f6bf02c to your computer and use it in GitHub Desktop.
Save skt-t1-byungi/289691475c6cdb5042dd4a2b5f6bf02c to your computer and use it in GitHub Desktop.
_.mixin({
deparam: function(querystring) {
querystring = querystring.substring(querystring.indexOf('?') + 1).split('&');
var params = {},
pair, d = decodeURIComponent,
i;
for (i = querystring.length; i > 0;) {
pair = querystring[--i].split('=');
params[d(pair[0])] = d(pair[1]);
}
return params;
},
waitQueue: function(fn, time) {
var waitNum = 0;
time = time || 0;
return function() {
var caller = this,
args = arguments;
waitNum++;
setTimeout(function() {
fn.apply(caller, args);
waitNum--;
}, (waitNum - 1) * time);
};
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment