Skip to content

Instantly share code, notes, and snippets.

View Bamieh's full-sized avatar

Ahmad Bamieh Bamieh

View GitHub Profile
@Bamieh
Bamieh / dynamic-waterfall-promise.js
Created July 20, 2016 19:49
Promise Waterfall for dynamic number of promises with callback on each and array resolve on complete
var counter = 0;
function run(cb) {
counter++;
return (function(count) {
return new Promise(function(resolve, reject) {
cb(count);
resolve(count);
});
})(counter);
}
@Bamieh
Bamieh / app.html
Last active April 17, 2016 06:58 — forked from ebidel/app.html
Fast Polymer app loading (Promises version) - optimized for first render, progressively enhanced lazy loading
<!DOCTYPE html>
<html class="no-scroll">
<head>
<style>
.no-scroll,
body.loading-app {
overflow: hidden;
}
body.loading-app #splash-screen {
opacity: 1;
/*!
* jQuery Tiny Pub/Sub - v0.X - 11/18/2010
* http://benalman.com/
*
* Original Copyright (c) 2010 "Cowboy" Ben Alman
* Dual licensed under the MIT and GPL licenses.
* http://benalman.com/about/license/
*
* Made awesome by Rick Waldron
*