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;
}
@Bnaya
Bnaya / directory structure
Last active February 1, 2019 00:07
yarn-dedup-examples 1
.
├── node_modules
│ └── @types
│ ├── fs-extra
│ │ ├── LICENSE
│ │ ├── README.md
│ │ ├── index.d.ts
│ │ └── package.json
│ └── node
│ ├── LICENSE
@Bnaya
Bnaya / before yarn deduplicate directory structure
Last active February 1, 2019 01:11
before yarn deduplicate
.
├── node_modules
│   └── @types
│   ├── fs-extra
│   │   ├── LICENSE
│   │   ├── README.md
│   │   ├── index.d.ts
│   │   ├── node_modules
│   │   │   └── @types
│   │   │   └── node
@Bnaya
Bnaya / compiled.js
Last active February 11, 2019 15:16
babel private fields playground
function _classPrivateFieldLooseBase(receiver, privateKey) { if (!Object.prototype.hasOwnProperty.call(receiver, privateKey)) { throw new TypeError("attempted to use private field on non-instance"); } return receiver; }
var id = 0;
function _classPrivateFieldLooseKey(name) { return "__private_" + id++ + "_" + name; }
class Person {
constructor() {
Object.defineProperty(this, _increaseAge, {
value: _increaseAge2
import React from "react";
import fs from "fs";
console.log(React, fs, __filename);
@Bnaya
Bnaya / ..serverless-project-chrome-aws-lambda_with_layer_for_node10.md
Last active October 15, 2019 15:58
- NOT NEEDED ANY MORE - lambda chrome node 10

serverless project with chrome-aws-lambda with layer for node10

@Bnaya
Bnaya / PseudoOpaqueType-jsdocs-and-more.ts
Created March 30, 2020 17:55
PseudoOpaqueType jsdocs and more
{
"name": "giltype",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"devDependencies": {
"typescript": "^3.8.3"
}
}
@Bnaya
Bnaya / jsconfig.json
Last active May 6, 2020 19:06
webdriver why you hate me so much
{
"typeAcquisition": {},
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"checkJs": true
},
"include": ["wat.js"],
}
import assert from "assert";
assert.strictEqual(4, 4);