Skip to content

Instantly share code, notes, and snippets.

View Bnaya's full-sized avatar
🐪

Bnaya Peretz Bnaya

🐪
View GitHub Profile
@Bnaya
Bnaya / example.ts
Created March 11, 2018 01:04
You might not need promise/async helper library after all
// You probobly don't need a helper library for Promise/Async after all
const seedValues = [Promise.resolve(777), Promise.resolve(888)];
// reduce
// Promise based
seedValues
.reduce((accumulator, currentValue) =>
accumulator.then(v => currentValue.then(cv => v + cv))
)
@Bnaya
Bnaya / track-errors.js
Created January 4, 2016 15:39
Track javascript errors to google analytics
(function () {
'use strict';
var duringErrorTrack = false;
var ua = 'UA-XXXXXX-X'
// don't break old browsers
if (!window.addEventListener) {
return;
}