This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // https://github.com/microsoft/TypeScript/issues/13298#issuecomment-885980381 | |
| type UnionToIntersection<U> = ( | |
| U extends never ? never : (arg: U) => never | |
| ) extends (arg: infer I) => void | |
| ? I | |
| : never; | |
| type UnionToTuple<T> = UnionToIntersection< | |
| T extends never ? never : (t: T) => T | |
| > extends (_: never) => infer W |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| type Ix = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | |
| type KVMap<T extends { k: string, v: any }> = { | |
| [k in T['k']]: Extract<T, { k: k }>['v'] | |
| } | |
| type ZipKVMap<K extends string[], V extends any[]> = { | |
| [ix in Ix] | |
| : K[ix] extends string | |
| ? V[ix] extends infer T |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {-# LANGUAGE | |
| TypeFamilies | |
| , FlexibleInstances | |
| , UndecidableInstances | |
| , FunctionalDependencies | |
| #-} | |
| module Garbage where | |
| data Root m a = Root (m a) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import * as THREE from 'three' | |
| /** | |
| * @see https://github.com/mrdoob/three.js/blob/master/examples/jsm/controls/OrbitControls.js#L152 | |
| */ | |
| export const mkOrbitControl = (canvas, options = {}) => { | |
| const orbit = mkOrbit(canvas, options) | |
| const pos = new THREE.Vector2() | |
| const listener = (e) => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import mapValues from 'lodash/mapValues' | |
| import curry from 'lodash/curry' | |
| import {connect} from 'react-redux' | |
| /** | |
| * Creates an async dispatcher for a given actionFn | |
| * @param {Function} dispatch Redux action dispatcher | |
| * @param {Function} actionFn Action creator, eg: (async, ...args) => ({type: "SOME_ACTION", async}) | |
| * @returns {Function} Async action dispatcher | |
| */ |