This markdown was exported from Data-Forge Notebook
First define some test data:
// | |
// Search backwards iteratively through a graph from the head nodes to find the set of last common | |
// ancestors that all paths pass through and that are reachable from the head nodes. | |
// | |
export function findLastCommonAncestor(blockGraph: BlockGraph, blocks: string[]): IBlockNode[] { | |
if (blocks.length === 0) { | |
return []; | |
} | |
// |
import * as path from "path"; | |
import { IDiagnostic } from "./language-code-generator"; | |
import { readJsonFile } from "../common/file"; | |
// | |
// Result of compiling TypeScript code. | |
// | |
export interface ICompilationResult { | |
code?: string; | |
diagnostics: IDiagnostic[]; |
This markdown was exported from Data-Forge Notebook
First define some test data:
// | |
// Original code here. | |
// | |
// https://stackoverflow.com/a/41674522/25868 | |
// | |
const m = require('module'); | |
const originalLoader = m._load; | |
m._load = function(request, parent, isMain) { |
[ | |
{ | |
"ORDERNUMBER": 10107, | |
"QUANTITYORDERED": 30, | |
"PRICEEACH": 95.7, | |
"ORDERLINENUMBER": 2, | |
"SALES": 2871, | |
"ORDERDATE": "2/24/2003 0:00", | |
"STATUS": "Shipped", | |
"QTR_ID": 1, |
/* | |
This a prototype / pseudo-code in TypeScript for a new multi-core task scheduler that I'm planning to open source. | |
This is based on my earlier private code that I've used to munge masses of stock market data and also talked about in my | |
book Data Wrangling with JavaScript. | |
To give me private feedback on this please email me on [email protected]. | |
The basic premise of this is that we can split up a complex data processing job into mulitple 'tasks' each of | |
which can potentially run in parallel on a multi-core machine. |
// https://stackoverflow.com/a/15964759/25868 | |
export type BasicEventHandler = () => void; | |
export type SenderEventHandler<SenderT> = (sender: SenderT) => void; | |
// | |
// Simulate C# style events in JS. | |
// | |
export interface IEventSource<HandlerType extends Function> { | |
// |
/* | |
This module creates an HTTPS web server and serves static content | |
from a specified directory on a specified port. | |
To generate a new cert: | |
openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 365 | |
To remove the passphrase requirement: |
This notebook demonstrate backtesting of very simple mean reversion trading strategy.
It uses the Grademark JavaScript API for backtesting.
For a version of this code runnable on Node.js - please see the Grademark first example repo.
To keep up with what I'm doing checkout my blog or YouTube channel.
{ | |
"$schema": "https://vega.github.io/schema/vega-lite/v2.json", | |
"layer": [ | |
{ | |
"data": { | |
"url": "https://vega.github.io/vega-lite/data/seattle-weather.csv" | |
}, | |
"mark": "line", | |
"encoding": { | |
"x": { |