View .gitignore
node_modules
package-lock.json
View tvl.ts
export type bool = boolean | null;
export type cmpValue = -1 | 0 | 1;
export function not(a: bool) {
if (a === true) return false;
if (a === false) return true;
return null;
}
export function and(lhs: bool, rhs: bool): bool {
View index.js
/* Given a list of positions:
('long', 50, 09-01-2015, 09-30-2015)
('short', 100, 09-15-2015, 10-15-2015)
('long', 50, 11-01-2015, 11-15,2015)
A stock like AAPL.
09-01 09-15 50
09-15 09-30 -50
09-30 10-15 -100 */
View index.js
const mobx = require('mobx');
// Pattern 1, state is updated in autorun (or action)
const state = mobx.observable({
name: 'state1',
isBoolean: false,
isString: false,
input: 1
});
View flights-20k.tsv
We can't make this file beautiful and searchable because it's too large.
date delay distance origin destination
2001-01-01T19:55:00.000Z 23 588 OAK SLC
2001-02-09T20:20:00.000Z 14 407 LAS OAK
2001-01-16T03:26:00.000Z 3 281 BWI BUF
2001-03-13T00:10:00.000Z 3 361 OAK ONT
2001-03-02T16:15:00.000Z -3 324 DAL AMA
2001-02-08T04:15:00.000Z -8 447 SFO SAN
2001-01-12T03:47:00.000Z 7 256 PHX LAS
2001-02-08T20:30:00.000Z 4 347 ELP PHX
2001-01-15T00:45:00.000Z 5 487 STL CLE
View index.js
const dp = require('chi-datapackage');
const store = {
state: {},
onStateChange: (state, prev) => {
console.log('onStateChange', prev, '-->', state);
},
onError: (err, state) => {
console.log('onError', err);
},
View index.js
const dp = require('chi-datapackage');
const {action, extendObservable, autorun, whyRun, observe} = require('mobx');
const store = {
loadPackage: action(function loadPackage(data) {
dp.load(data)
.then(p => {
store.package = p;
});
})
View index.js
const dp = require('chi-datapackage');
const barracks = require('barracks');
const store = barracks()
store.use({
onError: (err, state, createSend) => {
console.error(`error: ${err}`);
},
onAction: (data, state, name, caller, createSend) => {