Skip to content

Instantly share code, notes, and snippets.

@pelonpelon
Last active August 29, 2015 14:21
Show Gist options
  • Save pelonpelon/45bad068bf041260f8bf to your computer and use it in GitHub Desktop.
Save pelonpelon/45bad068bf041260f8bf to your computer and use it in GitHub Desktop.
Javascript snippets
somePromise().then(function () {
return anotherPromise();
}).then(function () {
return yetAnotherPromise();
}).catch(console.log.bind(console)); // <-- this is badass
function spy(m, plugin) {
function res() {
var vdom = m.apply(null, arguments)
plugin(vdom);
return vdom;
}
for (var k in m) if (m.hasOwnProperty(k)) res[k] = m[k];
return res;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment