Skip to content

Instantly share code, notes, and snippets.

const MONTHLY_PAYMENT = 558;
const BORROW_APR = 0.2607;
const REWARD_APR = 0.446;
const TARGET_LTV = 0.3;
const ETH_STAKING_APR = 0.0483;
let collateral = 100000;
let debt = 30000;
let cost = 0;
@renwoox
renwoox / example.js
Created August 29, 2019 15:25 — forked from colingourlay/example.js
Lodash / Underscore sort object keys. Like _.sortBy(), but on keys instead of values, returning an object, not an array. Defaults to alphanumeric sort.
var obj = {b: 3, c: 2, a: 1};
_.sortKeysBy(obj);
// {a: 1, b: 3, c: 2}
_.sortKeysBy(obj, function (value, key) {
return value;
});
// {a: 1, c: 2, b: 3}
@renwoox
renwoox / yaml2json
Created December 2, 2018 13:05 — forked from mboersma/yaml2json
YAML to JSON one-liner
python -c 'import sys, yaml, json; y=yaml.load(sys.stdin.read()); print json.dumps(y)'

d3.unconf example gist. Fork it here.