Skip to content

Instantly share code, notes, and snippets.

@zhirzh
zhirzh / rxviz.js
Last active August 10, 2020 18:30
action queue 500 retry
/**
* run on https://rxviz.com
* Time window must be 10+ seconds
*/
// rxviz setup
console.clear();
const { BehaviorSubject, EMPTY, from, merge, of, Subject } = Rx;
Object.keys(RxOperators).forEach(k => {
if (k !== "window") window[k] = RxOperators[k];
simple cases:
U call A: outgoing A
call ends: idle A
A accepts: offhook A
call ends: idle A
A call U: ringing A
call ends: idle A
U accepts: offhook A
export interface Doodle {
alternate_url: string
blog_text: string
call_to_action_image_url: string
collection_id: number
countries: string[]
doodle_args: DoodleArg[]
doodle_type: DoodleType
height: number
high_res_height: number
const { join, resolve } = require('path')
const tsconfig = require('../tsconfig.json')
const { outDir, paths } = tsconfig.compilerOptions
const _load = module.constructor._load
module.constructor._load = function(request, ...args) {
for (let alias in paths) {
const aliasRegExp = new RegExp('^' + alias.replace('*', '(.*)') + '$')
jscodeshift \
-t js-codemod-import-absolute-develop/import-absolute.js \
--extensions=ts,tsx \
--parser=tsx \
--sort=false \
--replace="$PWD/src/" \
--replaceWith="~" \
src/
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>loops</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<script src="./suite.js"></script>
</head>
<body>
<h1>Open the console to view the results</h1>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Untitled benchmark</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<script src="./suite.js"></script>
</head>
<body>
<h1>Open the console to view the results</h1>
// store.ts
import { combineStore, createStore } from 'redux'
import { todosReducer } from './todos'
import { userReducer } from './user'
const store = createStore(
combineStore({
user: userReducer,
todos: todosReducer,
@zhirzh
zhirzh / eslint.log.js
Created February 20, 2019 09:01
flip eslint logs from rules-per-file pattern to files-per-rule pattern
const fs = require('fs')
const path = require('path')
const ESLING_LOG = path.join(__dirname, 'eslint.log')
const STATE = {
EMPTY: 'EMPTY',
FILE: 'FILE',
}