Skip to content

Instantly share code, notes, and snippets.

const jsondiff = require("json0-ot-diff");
var diff = jsondiff(
{
name: "something",
more: {
a: "hello world"
},
haha: [1, 2, 3]
},
`File > Preferences > Settings`
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: OpenPGP v2.0.8
Comment: https://sela.io/pgp/
xsFNBFtVpRYBEACmi0l5qI9DX4QEgc20Apkp2NzVDLc6x1ziR2DVPLVni4ioLcAi
Huir3IDltPihojLH1D3ypOZLbgrF0wVF8VWzO4xAai5MAWxKxbMSuY/icyX15RuS
bFnZ/MWZe0ILoJrLaZz+6L0PXWSm6OWfO06EkEumJWdNTrCd/krrpm/ulsvU/5us
ZFmA57iYOpujUxOHnrAGu66q4znP9s6bKzmeJHsre6XV4R62M2sUiY6VCw3dFV/E
WEYYqUgY0V4Rdw1Q4taQyotrlq8AH0eSgNWcOGwovDy/4VC5ziV2AJmuodzekwna
sSRjOXO64Mll6zMnYe2C1E5/12GZeWx8+CUaZSKY4u3E61wF5UWsEMPt546Uj/fj
@johnrees
johnrees / callbags.ts
Created June 13, 2018 17:11
playing with callbags
enum Type {
START,
DATA,
END
}
type Callbag = (type: Type, payload: any) => void;
const producer: Callbag = (type, payload) => {
if (type === Type.START) {
// by @noffle
autoinstall () {
local MODULES=$(cat $1 | grep "require('.*')" | sed "s/.*require('\(.*\)')/\1/" | grep -v '^\.' | tr '\n' ' ')
shift
shift
npm install $MODULES $@
}
this is the second set of answers
{ nodes:
[ { id: '23e32bafe0c4fe3c-19',
value: 'How much land is covered by the original property and any other additions or buildings? ',
type: 'QUESTION' },
{ id: '23e32bafe0c4fe3c-26',
value: 'Does the extension match materials and style of the existing building?',
type: 'QUESTION' },
{ id: '2',
value: 'How many storeys does the extension have?',
type: 'QUESTION' },
{ nodes:
[ { id: '23e32bafe0c4fe3c-19',
value: 'How much land is covered by the original property and any other additions or buildings? ' },
{ id: '23e32bafe0c4fe3c-26',
value: 'Does the extension match materials and style of the existing building?' },
{ id: '2', value: 'How many storeys does the extension have?' },
{ id: '12', value: 'How close to boundary?' },
{ id: '20',
value: 'Are the extension\'s roof, eaves and ridge height equal or lower than those of the property?' },
{ id: '50', value: 'Will the new roof be used as deck?' },
@johnrees
johnrees / async.js
Last active January 21, 2018 00:15
rxdux-rx
const Rx = require('rxjs');
const sleep = ms => new Promise(res => setTimeout(res, ms));
const action$ = new Rx.Subject();
const initialState = {
bays: 3
};
const inc = (x) => x + 1
const dbl = (x) => x * 2
const add = (x, y) => x + y
const multiply = (x, y) => x * y
const subtract = (x, y) => x - y
const divide = (x, y) => x / y
const partial = (fn, ...args) => fn.bind(null, ...args)
const _pipe = (f, g) => (...args) => g(f(...args))
const pipe = (...fns) => fns.reduce(_pipe)