This file contains 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
var StateType; | |
(function (StateType) { | |
StateType["Down"] = "DOWN"; | |
StateType["Booting"] = "BOOTING"; | |
StateType["Failure"] = "FAILURE"; | |
StateType["Up"] = "UP"; | |
StateType["ShuttingDown"] = "SHUTTING_DOWN"; | |
})(StateType || (StateType = {})); | |
var EventType; | |
(function (EventType) { |
This file contains 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
TodoItem | |
Complete | |
uncheck -> Incomplete | |
Incomplete* | |
check -> Complete |
This file contains 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
AddAsset | |
onChangeLabel -> AddAsset | |
onChangeParent -> AddAsset | |
Submit -> PostAsset | |
PostAsset | |
ok -> FetchFieldInfo | |
bad -> AddAsset | |
FetchFieldInfo | |
ok -> PutFieldInfo | |
bad -> Failure |
This file contains 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
// Redux | |
import * as _ from 'lodash' | |
import { createSelectorCreator } from 'reselect' | |
import memoize from './defaultMemoizeWithDeepEqualsOutput' | |
/** Selector creator for lists. Uses _.isEqual for deeper array comparisons */ | |
export default createSelectorCreator(memoize as any, _.isEqual) |
This file contains 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 describing a "lazy" value, a.k.a a function returnting the value | |
*/ | |
type Lazy<A> = () => A | |
/** | |
* Continued | |
*/ | |
class Cons<A> { | |
constructor(readonly head: Lazy<A>, readonly tail: Lazy<List<A>>) {} |
This file contains 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
interface Fruit { | |
isRotten: boolean | |
} | |
interface Apple extends Fruit { | |
apple: true | |
} | |
interface Banana extends Fruit { |
This file contains 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
export function composeGetter<K extends string>(prop: K) { | |
function getter<T extends { [P in K]?: any }>(object: T): T[typeof prop] | |
function getter<T extends { [P in K]: any }>(object: T) { | |
return object[prop] | |
} | |
return getter | |
} | |
export function composeSetter<K extends string>(prop: K) { |
This file contains 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
/** | |
* @private | |
* | |
* An object representing a map of selector functions that | |
* accept application state and return a value. | |
*/ | |
interface MapOfSelectors { | |
[prop: string]: (storeState: any) => any | |
} |
This file contains 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 { State, modify, gets } from 'fp-ts/lib/State' | |
import { Option, fromNullable, none, some } from 'fp-ts/lib/Option' | |
import * as _ from 'lodash' | |
/** Use state combinators. */ | |
type StateCache<A> = State<Cache, A> | |
interface SocialService { | |
followerStats(u: string): StateCache<FollowerStats> | |
} |
This file contains 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
const util = require('util') | |
const exec = util.promisify(require('child_process').exec) | |
const fs = require('fs') | |
const figures = require('figures') | |
const ansi = require('ansicolor').nice | |
const cmdList = 'find ./packages -type f -name package.json' | |
async function getPathOfPackageJsons() { | |
const { stdout, stderr } = await exec(cmdList) |