Skip to content

Instantly share code, notes, and snippets.

View eavichay's full-sized avatar
💻
assert.equals(javascript, awesome)

Avichay Eyal eavichay

💻
assert.equals(javascript, awesome)
View GitHub Profile
@eavichay
eavichay / test.md
Created January 25, 2022 11:09
Example

image

@eavichay
eavichay / stuff.bash
Created January 9, 2022 17:15
AWS stuff
aws ecs execute-command --cluster dev-ecs --task TASK_ID --interactive --command sh
@eavichay
eavichay / mock-local-storage-issue-reproduce.js
Created October 13, 2020 14:11
mock-local-storage API incomaptible with browser
// node.js
import 'mock-local-storage';
localStorage.setItem('some-value');
/*
In browser environment, this should throw TypeError:
Uncaught TypeError: Failed to execute 'setItem' on 'Storage': 2 arguments required, but only 1 present
*/
@eavichay
eavichay / detect.js
Last active April 17, 2019 13:56
Mutations Detection
// first approach: MutationObserver
!(function () {
// IIFE
const serverEndpoint = 'http://localhost:3000//get-report/';
if (!typeof MutationObserver === 'function') {
// second approach - using DOMSubtreeModified event (buggy, unstable and deprecated for MutationObserver API)
document.body.addEventListener('DOMSubtreeModified', (e) => {
const data = {
@eavichay
eavichay / dearXXX.txt
Created November 22, 2018 10:43
What to answer to emails after you purchase a domain name
Hello XXXXXX
I appreciate your email.
I would like to know if you could help me with the following.
I require a time estimation for production-ready product and estimated cost.
The application should be available via web browser (all browsers should be supported, including Internet Explorer version 6+) - as the customers includes also financial groups, i.e. banks.
It should support all modern frameworks: Angular, React, PHP and jQuery.
It should be fully compatible with all modern libraries like moment.js, node.js, typescript and java.
@eavichay
eavichay / build.js
Created September 4, 2018 09:24
Typescript compiler output to browser es-modules + watch
const fs = require('fs');
const watch = require('node-watch');
const { execSync } = require('child_process');
const StaticServer = require('static-server');
const walker = function(dir, fn) {
const files = fs.readdirSync(dir);
files.forEach((file) => {
if (fs.statSync(dir + '/' + file).isDirectory()) {
walker(dir + '/' + file + '/', fn);
@eavichay
eavichay / .babelrc
Created May 16, 2018 06:28
Decorators only for browser-es native modules
{
"plugins": ["transform-decorators-legacy"]
}
// code
const foo = function(target) {
target.prototype.foo = function() {
console.log("foo");
}
}
const bar = function(myText) {
return function(target) {