Skip to content

Instantly share code, notes, and snippets.

View stuf's full-sized avatar

Stef stuf

View GitHub Profile
const $ = require('sanctuary-def');
const Ratio =
$.NullaryType('package-name/Ratio',
'https://package.url.io/Ratio',
x => typeof x === 'number' && (x >= 0 && x <= 1));
//
const def = $.create({
[*.js]
indent_size = 2
indent_style = space
trim_trailing_whitespace = true
insert_final_newline = true
@stuf
stuf / README.md
Created March 21, 2018 13:58
TSX component scaffold

TSX component scaffold

For convenience and example for whoever might be wondering about TypeScript and React.

Why separate import of SFC?

Because SFC<Props> is much more readable in a chunk of code than React.SFC<Props>

Why a separate type declarations file?

export declare type Lens = string | number;
export declare type Optic = Lens | Array<Lens>;
export type Pred<T> = (x: T) => boolean;
export type GetValueFn<T = any, U = T> = (maybeData: T, index: number) => U;
export type SetValueFn<T1 = any, T2 = T1, U = T2> = (maybeValue: T1, maybeData: T2, index: number) => U;
export type ModifyFn<T = any, U = T> = (maybeData: T, i?: number) => U;
Services*
Init*
init -> Get Results
Get Results
success -> Show Results
failed -> Show Error
Show Results
const { Suite } = require('benchmark');
const R = require('ramda');
const util = require('util');
const suite = new Suite();
const colors = `be4a2f
d77643
ead4aa
e4a672
@stuf
stuf / SketchSystems.spec
Created January 15, 2020 08:40
Notification
Notification
Idle
show -> Show
Show
delay ms -> Close
Close
completed -> Reset
@stuf
stuf / SketchSystems.spec
Last active February 25, 2021 14:02
API call Promise
API call Promise
Pending
on data -> Fulfilled
on error -> Rejected
canceled -> Rejected
Fulfilled
done -> Finally
Rejected
done -> Finally
Finally