Standard escape codes are prefixed with Escape
:
- Ctrl-Key:
^[
- Octal:
\033
- Unicode:
\u001b
- Hexadecimal:
\x1B
- Decimal:
27
import { Z4, type Stringer } from "@thi.ng/strings"; | |
import { | |
comp, | |
iterator, | |
map, | |
mapcat, | |
partition, | |
range, | |
wrapSides, | |
} from "@thi.ng/transducers"; |
import { | |
asSvg, | |
bounds, | |
circleFrom2Points, | |
group, | |
GroupAttribs, | |
line, | |
Polygon, | |
starWithCentroid, | |
svgDoc, |
import { identity } from "@thi.ng/api"; | |
import { topoSort } from "@thi.ng/arrays"; | |
import { defDGraph } from "@thi.ng/dgraph"; | |
import { toDot } from "@thi.ng/dgraph-dot"; | |
import { comp, filter, map, mapcat, pairs, run, trace } from "@thi.ng/transducers"; | |
interface Task { | |
title: string; | |
done?: boolean; | |
// IDs of other tasks this task depends on (aka is blocked by) |
const std = @import("std"); | |
const wasm = @import("wasm-api"); | |
const dom = @import("wasm-api-dom"); | |
// expose thi.ng/wasm-api core API (incl. panic handler & allocation fns) | |
pub usingnamespace wasm; | |
// main entry point | |
export fn start() void { | |
init() catch |e| @panic(@errorName(e)); |
import { epoch, int, parseCSV, type CSVRecord, type ColumnSpecs } from "@thi.ng/csv"; | |
import { defFormat, months } from "@thi.ng/date"; | |
import { readText, writeText } from "@thi.ng/file-io"; | |
import { serialize } from "@thi.ng/hiccup"; | |
import { svg } from "@thi.ng/hiccup-svg"; | |
import { closedOpen } from "@thi.ng/intervals"; | |
import { split } from "@thi.ng/strings"; | |
import { comp, filter, push, transduce } from "@thi.ng/transducers"; | |
import { | |
barPlot, dataBounds, dataMaxLog, |
import { readJSON, writeText } from "@thi.ng/file-io"; | |
import { XML_PROC, serialize } from "@thi.ng/hiccup"; | |
// source path of the Google Takeout (GT) places | |
const path = "/Downloads/Takeout/Maps (your places)/Saved Places.json"; | |
// load GT places | |
const places = readJSON(path).features; | |
// FYI: partial structure of a GT place |
import { HAVERSINE_LATLON } from "@thi.ng/distance"; | |
import { kmeans, meansLatLon } from "@thi.ng/k-means"; | |
// 20 world cities, sorted alphabetically | |
// data sourced from: | |
// https://github.com/OpenDataFormats/worldcities/blob/master/src/data/cities.json | |
const cities = [ | |
{ id: "anchorage", latlon: [61.21806, -149.90028] }, | |
{ id: "berlin", latlon: [52.52437, 13.41053] }, | |
{ id: "boston", latlon: [42.35843, -71.05977] }, |
// $ node | |
// Welcome to Node.js v20.5.1. | |
// Type ".help" for more information. | |
const { barChartHStr, lineChartStr } = await import("@thi.ng/text-canvas"); | |
const { adsr, osc, modOsc, rect, saw, sin, tri } = await import("@thi.ng/dsp"); | |
// display line plot of 100 samples from an amplitude-modulate sine oscillator | |
console.log(lineChartStr(20, modOsc(sin, 0.01, 0, osc(sin, 0.2)).take(100))); | |
// ╭╮ ╭╮ ╭╮ ╭╮ |
import { FORMAT_MD, suite } from "@thi.ng/bench"; | |
import { range } from "@thi.ng/transducers"; | |
const testForIndexFwd = (src: number[]) => { | |
let m = 0; | |
for (let i = 0, n = src.length; i < n; i++) m += src[i]; | |
return m; | |
}; | |
const testForIndexRev = (src: number[]) => { |