Skip to content

Instantly share code, notes, and snippets.

🐪

Bnaya Peretz Bnaya

🐪
Block or report user

Report or block Bnaya

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Bnaya
Bnaya / ..serverless-project-chrome-aws-lambda_with_layer_for_node10.md
Last active Oct 15, 2019
- NOT NEEDED ANY MORE - lambda chrome node 10
View ..serverless-project-chrome-aws-lambda_with_layer_for_node10.md

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

@Bnaya
Bnaya / myentities.ts
Last active Jul 9, 2019
typeorm-idonnowhattodo-1
View myentities.ts
import {
Entity,
JoinColumn,
ManyToOne,
Column,
PrimaryGeneratedColumn,
ManyToMany,
JoinTable,
OneToMany,
CreateDateColumn,
View index.ts
import React from "react";
import fs from "fs";
console.log(React, fs, __filename);
@Bnaya
Bnaya / fetch-stream-json-parser.ts
Created Apr 9, 2019
fetch-stream-json-parser.ts basic code example
View fetch-stream-json-parser.ts
// https://github.com/dominictarr/JSONStream
// @ts-ignore
import JSONStream from "JSONStream";
import { Observable } from "rxjs";
class Bla {
public creativesOfChannelV4StreamEndpoint<T=any>(
channel: T,
brandId: string,
@Bnaya
Bnaya / index.ts
Last active Feb 15, 2019
Typescript Types indirect re-export with isolatedModules: true
View index.ts
// Cannot re-export a type when the '--isolatedModules' flag is provided.ts(1205)
export { IMyInterface } from "./types"
// this works!
import { IMyInterface as IMyInterfaceForExport } from "./types"
export type IMyInterface = IMyInterfaceForExport;
// And Also:
export type IMyInterface2 = import("./types").IMyInterface;
@Bnaya
Bnaya / compiled.js
Last active Feb 11, 2019
babel private fields playground
View compiled.js
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
View before yarn deduplicate directory structure
.
├── node_modules
│   └── @types
│   ├── fs-extra
│   │   ├── LICENSE
│   │   ├── README.md
│   │   ├── index.d.ts
│   │   ├── node_modules
│   │   │   └── @types
│   │   │   └── node
@Bnaya
Bnaya / directory structure
Last active Feb 1, 2019
yarn-dedup-examples 1
View directory structure
.
├── node_modules
│ └── @types
│ ├── fs-extra
│ │ ├── LICENSE
│ │ ├── README.md
│ │ ├── index.d.ts
│ │ └── package.json
│ └── node
│ ├── LICENSE
@Bnaya
Bnaya / example.ts
Created Mar 11, 2018
You might not need promise/async helper library after all
View example.ts
// 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 Jan 4, 2016
Track javascript errors to google analytics
View track-errors.js
(function () {
'use strict';
var duringErrorTrack = false;
var ua = 'UA-XXXXXX-X'
// don't break old browsers
if (!window.addEventListener) {
return;
}
You can’t perform that action at this time.