Skip to content

Instantly share code, notes, and snippets.

-/
node_modules/
package-lock.json
module.exports = {
"package_path": "./-/",
"package_root": "/-/"
}
import { Injectable, Injector, Compiler } from '@angular/core';
import { SettingsService } from './settings.service';
@Injectable({
providedIn: 'root'
})
export class PluginsService {
constructor(
private settings: SettingsService,
node_modules
package-lock.json
@Hypercubed
Hypercubed / tvl.ts
Created December 23, 2017 01:25
Three-valued logic (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 {
node_modules/
*.js
@Hypercubed
Hypercubed / index.js
Created October 4, 2016 15:55
requirebin sketch
/* 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 */
@Hypercubed
Hypercubed / index.js
Last active September 25, 2016 15:11
requirebin sketch
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.
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
@Hypercubed
Hypercubed / index.js
Last active September 21, 2016 09:23
requirebin sketch
const dp = require('chi-datapackage');
const store = {
state: {},
onStateChange: (state, prev) => {
console.log('onStateChange', prev, '-->', state);
},
onError: (err, state) => {
console.log('onError', err);
},