Skip to content

Instantly share code, notes, and snippets.

View Bnaya's full-sized avatar
πŸͺ

Bnaya Peretz Bnaya

πŸͺ
View GitHub Profile
@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 / dep.ts
Last active April 28, 2022 16:23
ts-node + esm
export function funci() {
return "AHH HHHHAAA";
}
@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 / myentities.ts
Last active September 28, 2020 03:24
typeorm-idonnowhattodo-1
import {
Entity,
JoinColumn,
ManyToOne,
Column,
PrimaryGeneratedColumn,
ManyToMany,
JoinTable,
OneToMany,
CreateDateColumn,
import React from "react";
import fs from "fs";
console.log(React, fs, __filename);
@Bnaya
Bnaya / fetch-stream-json-parser.ts
Created April 9, 2019 08:24
fetch-stream-json-parser.ts basic code example
// 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 July 16, 2022 11:55
Typescript Types indirect re-export with isolatedModules: true
// 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 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
@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 / 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