Skip to content

Instantly share code, notes, and snippets.

View gioragutt's full-sized avatar

Giora Guttsait gioragutt

View GitHub Profile
@gioragutt
gioragutt / codefresh-example.yaml
Created May 9, 2021 19:59
Example of distributing a website with S3+CloudFront via CI
version: '1.0'
kind: pipeline
metadata:
name: my-website/publish
project: my-website
spec:
triggers:
- name: master_commit
@gioragutt
gioragutt / example.ts
Created June 5, 2021 18:07
I'm an RXJS Pleb please help
import { defer, NEVER, Subject, throwError } from "rxjs";
import {
bufferTime,
catchError,
filter,
mapTo,
mergeMap,
retry,
// tap,
} from "rxjs/operators";
@gioragutt
gioragutt / expected-implementation.ts
Last active June 21, 2021 19:20
Example for my custom json parse/stringify reviver/replacer
import {isObservableMap, isObservableSet, observable} from 'mobx';
const DATA_TYPE_FIELD = '___jsonDataType';
function getCollectionTypeName(value: any): 'Set' | 'Map' | 'ObservableSet' | 'ObservableMap' | undefined {
if (isObservableMap(value)) {
return 'ObservableMap';
}
if (isObservableSet(value)) {
return 'ObservableSet';
}
@gioragutt
gioragutt / json-utils.ts
Created June 22, 2021 19:17
Boilerplate for extendable ES6/MobX compatible JSON replacer/reviver
import {isObservableMap, isObservableSet} from 'mobx';
interface Adapter {
is: (value: unknown) => boolean;
serialize: (value: any) => any;
deserialize: (value: any) => any;
}
const spread = (value: any) => [...value];
@gioragutt
gioragutt / video_activity.json
Created August 2, 2021 10:53
video_activity
[
null,
null,
[4],
[26],
1617712224719887,
"AODP23YAAAAiUiAIHRCA6NzY_-fvAhj_p7rHwervAjoKCJqUgdaP_fWPZYKq8GJhyNufIGMobYdaxGb11CPJ",
"AODP23YAAAATChEIzQEQl9uUJBiPqIPUz-nvAvgaUiH-QF1r6sbp1CQSdAdoe2ac",
[
"YouTube",
@gioragutt
gioragutt / example-for-facebook1.ts
Last active August 2, 2021 20:42
Example for facebook
const smallArray: string[] = []; // initial value IDK?
// unless you need to update the array itself, you can leave with the set.
// If you need to update the array, you can do that close to actions on the set.
const smallSet = new Set<string>(smallArray);
addEventListener('new-array-to-compare', (bigArray: string[]) => {
for (const value of bigArray) {
if (smallSet.delete(value)) {
// value was in smallSet and was deleted
declare namespace Cypress {
interface Chainable {
tid: Cypress.Chainable['get'];
}
}
function attributeSelector(key: string, value: string) {
return `[${key}=${value}]`;
}
@gioragutt
gioragutt / hack.ts
Last active December 8, 2021 18:53
nestjs swagger helper for extracting inline schemas to the document schemas
/* eslint-disable @typescript-eslint/no-explicit-any */
import { getSchemaPath, OpenAPIObject } from '@nestjs/swagger';
import _set from 'lodash.set';
import _get from 'lodash.get';
function flattenObject(theObject: any): Record<string, any> {
const toReturn: any = {};
for (const objectKey in theObject) {
@gioragutt
gioragutt / .commitlintrc.js
Last active May 21, 2022 20:28
setting up nx-pwm
/**
* @type {import('@commitlint/types').UserConfig}
*/
module.exports = {
extends: ['@commitlint/config-conventional', '@commitlint/config-nx-scopes'],
rules: {
// NOTE: uncomment this if you want to alter the scopes
// 'scope-enum': async (ctx) => {
// const projects =
// require('@commitlint/config-nx-scopes').utils.getProjects(ctx);
@gioragutt
gioragutt / yad2-sucks-a-little-less-with-this.js
Created July 15, 2022 20:51
yad2 tampermonkey userscript
// ==UserScript==
// @name Yad2 Fixes
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://www.yad2.co.il/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=co.il
// @grant none
// ==/UserScript==