Skip to content

Instantly share code, notes, and snippets.

(function () {
var embedJquery = function (callback) {
var js = document.createElement('script');
js.src = 'https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js';
js.onload = function () {
jQuery.noConflict();
callback(jQuery);
};
@elmigranto
elmigranto / awaitable.js
Last active February 10, 2017 14:21
awaitability
'use strict';
// awaitable(fn, [arg1, [arg2[, ..., argN]]])
// Always returns array of results.
const awaitableSpread = (fn, ...args) => {
if (typeof fn !== 'function')
throw new Error(`awaitable() needs a function as first argument, got "${typeof func}"`);
return new Promise((resolve, reject) => {
fn.call(null, ...args, (err, ...results) => {