2025 July 19
Resources for my next blog to replace the hugo blog.
2025 July 19
Resources for my next blog to replace the hugo blog.
// 5 Aug 2024 | |
// multiple inheritance | |
// "inspired" by tweet, 1 August 2024, from Colin McDonnell (and goaded by some | |
// benighted replies) at https://x.com/colinhacks/status/1819138095104905689 | |
// Challenge: Implement merge() to handle multiple inheritance, as per example: | |
// ``` | |
// class A {...} | |
// class B {...} |
// 15 July 2024 | |
// simulate chunked HTML response stream in the browser | |
// 1. create the response stream parts | |
var encoder = new TextEncoder; | |
var text = ` | |
<html lang="en"> |
// 1 July 2024 | |
// parseBigInt | |
function parseBigInt(b, r) { | |
var n = String(b).split("n")[0]; | |
return parseInt(n, r); | |
} | |
var base10 = ["2n.3", "5.5", "FFnA", "n.3"].map(function (v, i) { | |
return parseBigInt(v, 8); |
// 22 June 2024 | |
// is-number with bigint support | |
function isNumber(n) { | |
var m = typeof n == 'bigint' | |
? 0n | |
: 0; | |
return n - m === Object(n).valueOf(); | |
} |
// 12 June 2024 | |
// realizing the algorithm for processing event timestamps in Fidge (1988), | |
// "Timestamps in Message-Passing Systems That Preserve the Partial Ordering" | |
// https://fileadmin.cs.lth.se/cs/Personal/Amr_Ergawy/dist-algos-papers/4.pdf | |
// missing the query or aggregation step that collects the timestamps and sorts | |
// them by determinate vs. non-determinate ordering. | |
// determinate ordering should be singular (i.e., only one permutation) whereas |
// 8 June 2024 | |
// pass functions to workers and and call them in subsequent messages. | |
// similar to gists in 2022: | |
// pass functions as strings to workers and revive them with the Function() constructor | |
// https://gist.github.com/dfkaye/527f163b6913b163a579bbeb01858593 | |
// Not the same as "pass a stringified function in its own blob to a worker and | |
// import it using importScripts(blobUrl)." | |
// https://gist.github.com/dfkaye/ca9722cd247c6d907b3bbaf7273741e0 |
// 31 May 2024 | |
// visibility change and visibility state to drive web worker processing, close | |
// and restart. | |
// previous version, pause and resume, at | |
// https://gist.github.com/dfkaye/3a9d6752301733fba81c740cf4fb68b2 | |
var source = ` | |
var count = 0; | |
var interval; |
// 30 May 2024 | |
// visibility change and visibility state to drive web worker processing, | |
// pause and resume. | |
// pretty sure I'd done this in 2022 or 2023. | |
// next version implements close and restart... | |
// https://gist.github.com/dfkaye/ee75271dd58e489d3a3ab9d209e51e02 | |
var source = ` |
// 13 May 2024 | |
// async/await dependency chains | |
// 14 May 2024 | |
// added explicit try-catch-finally to test error in "finalizer" function C. | |
// what | |
// laughing at ben lesh tweet complaining about async/await being difficult | |
// without explaining why: |