This file contains hidden or 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
| import { | |
| comp, | |
| groupByObj, | |
| map, | |
| multiplex, | |
| noop, | |
| pairs, | |
| postProcess, | |
| pushKeys, | |
| range2d, |
This file contains hidden or 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
| import { output, processImage } from "@thi.ng/imago"; | |
| import { GRAY8 } from "@thi.ng/pixel"; | |
| import { readGeoTiff } from "@thi.ng/pixel-io-geotiff"; | |
| import { range2d } from "@thi.ng/transducers"; | |
| import { readFileSync } from "node:fs"; | |
| // a 44155 x 25153 pixel GeoTIFF file | |
| const path = "DOM_Tirol_5m_epsg31254/DOM_Tirol_5m_epsg31254_2017-2023.tif"; | |
| // load GeoTIFF |
This file contains hidden or 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
| import type { FnU2, Maybe, Predicate2 } from "@thi.ng/api"; | |
| import { difference, intersection, union } from "@thi.ng/associative"; | |
| import { isArray, isString } from "@thi.ng/checks"; | |
| import { illegalArgs } from "@thi.ng/errors"; | |
| import { evalSource } from "@thi.ng/lispy"; | |
| import { defQuery, type QueryOpts } from "@thi.ng/oquery"; | |
| import { expect, test } from "bun:test"; | |
| type Note = { id: number; tags: string[] }; |
This file contains hidden or 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
| import { parseHtml } from "@thi.ng/hiccup-html-parse"; | |
| import { serialize } from "@thi.ng/hiccup-markdown"; | |
| import { arrayZipper, type Location } from "@thi.ng/zipper"; | |
| const HOST = "mastodon.thi.ng"; | |
| const STATUS_ID = "115464108396925195"; | |
| // load a Mastodon status via API | |
| const res = await ( | |
| await fetch(`https://${HOST}/api/v1/statuses/${STATUS_ID}`) |
This file contains hidden or 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
| import { writeFile } from "node:fs/promises"; | |
| // your account domain | |
| const DOMAIN = "mastodon.social"; | |
| // your API access token | |
| const ACCESS_TOKEN = "TODO"; | |
| // directory path for storing JSON backups of deleted bookmarks | |
| const BACKUP_DIR = "backup/20260901"; |
This file contains hidden or 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
| fn swizzleEnum(comptime N: usize, comptime T: type, a: @Vector(N, T), comptime id: Swizzle) @Vector(swizzleLength(id), T) { | |
| comptime var code = @intFromEnum(id); | |
| comptime var i = 0; | |
| comptime var offset = 0; | |
| comptime var count = 4; | |
| inline while (code >= offset + count) { | |
| offset += count; | |
| count <<= 2; | |
| i += 1; | |
| } |
This file contains hidden or 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
| import type { Fn2 } from "@thi.ng/api"; | |
| import { | |
| DEFAULT, | |
| expand, | |
| interpret, | |
| type LSysSymbol, | |
| type RuleImplementations, | |
| } from "@thi.ng/lsys"; | |
| // iterative rule expansion |
This file contains hidden or 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
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" /> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
| <meta http-equiv="X-UA-Compatible" content="ie=edge" /> | |
| <title>svg-gauge</title> | |
| <style> | |
| :root { | |
| --gauge-col: #0c9; |
This file contains hidden or 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
| import { Z4, type Stringer } from "@thi.ng/strings"; | |
| import { | |
| comp, | |
| iterator, | |
| map, | |
| mapcat, | |
| partition, | |
| range, | |
| wrapSides, | |
| } from "@thi.ng/transducers"; |
This file contains hidden or 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
| import { | |
| asSvg, | |
| bounds, | |
| circleFrom2Points, | |
| group, | |
| GroupAttribs, | |
| line, | |
| Polygon, | |
| starWithCentroid, | |
| svgDoc, |
NewerOlder