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
/* 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 */ |
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 mobx = require('mobx'); | |
// Pattern 1, state is updated in autorun (or action) | |
const state = mobx.observable({ | |
name: 'state1', | |
isBoolean: false, | |
isString: false, | |
input: 1 | |
}); |
We can't make this file beautiful and searchable because it's too large.
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
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 |
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 dp = require('chi-datapackage'); | |
const store = { | |
state: {}, | |
onStateChange: (state, prev) => { | |
console.log('onStateChange', prev, '-->', state); | |
}, | |
onError: (err, state) => { | |
console.log('onError', err); | |
}, |
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 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; | |
}); | |
}) |
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
node_modules |
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 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) => { |
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 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) => { |
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 barracks = require('barracks'); | |
const dp = require('chi-datapackage'); | |
const dpStore = barracks(); | |
dpStore.use({ | |
onError: (err, state, createSend) => { | |
console.error('Error:', err) | |
}, | |
onAction: (data, state, name, caller, createSend) => { |
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 universe = require('universe'); | |
var data = [{ | |
date: "2011-11-14T16:17:54Z", | |
quantity: 2, | |
total: 190, | |
tip: 100, | |
type: "tab", | |
productIDs: ["001"] |