bazel query 'rdeps(..., //vistar/geo/qtdb:go_default_library)' --output package
#!/usr/bin/env node | |
// call using --inspect brk, GC using memory tab of devtools | |
// call globalThis.tick() to move the code along and see when things reap from | |
// manually calling GC | |
{ | |
const registry = new FinalizationRegistry((_) => console.log(_, 'reaped')); | |
let EASY_TO_FIND = class EASY_TO_FIND2 { | |
big = new Uint8Array(1024 * 1024 * 10); | |
constructor(_) { | |
registry.register(this, _); |
// Setup: RxJS shaped types | |
declare class Observable<T> { _t: T; } | |
declare interface ObservedValueOf<T> { _t: T; _brand: 'ObservedValueOf'; } | |
declare interface Scheduler { _brand: 'Scheduler'; } | |
declare type ObservableInput<T> = Observable<T> | Promise<T> | T[]; | |
// A trick to force T to be inferred as a tuple type. TypeScript would prefer to infer | |
// an array, but arrays don't match {0: any}. | |
type Tuple<T> = (T & { 0: any }) | []; |
(also know as lies and/or alternative facts)
- setImmediate - doesn't set anything immediately, waits for a tick before executing
- setTimeout(fn, n) - never sets the timeout to exactly n
- Math.random() - computers cannot generate random numbers
- Promise - is a lie when rejected
- Array.reduce - accumulates, does not reduce (via @sbmadhav)
A complete list of RxJS 5 operators with easy to understand explanations and runnable examples.
This is a little style and expressiveness test for various stream libraries. It is certainly not a proof of anything, so much as an ability to showcase how some basic features of streams fit together with different libraries.
Problem statement: given a library of streams, implement an API analogous to fgrep
, i.e., a literal string grepper.
Specifically, implement a function fgrep(test, filenames[, limit=10])
, which takes a source string, a list of filenames, and an optional concurrency limit, and produces a stream of Match
records { filename: string, lineNumber: number, line: string }
, representing all lines of all files that contain the string test
. For each matching record, filename
is the name of the file where the match was found, lineNumber
is the one-indexed line number where the match was found, and line
is the contents of the line where the match was found.
The limit
argument indicates the maximum number of concurrent filehandles that should b