Goals: Add links that are reasonable and good explanations of how stuff works. No hype and no vendor content if possible. Practical first-hand accounts of models in prod eagerly sought.

import { main } from "npm:[email protected]"; | |
import { useEventStream } from "./use-event-stream.ts"; | |
// consume the server as an interable. | |
await main(function* () { | |
let source = yield* useEventStream<number, string>("http://localhost:8000"); | |
let next = yield* source.next(); |
import { | |
call, | |
createSignal, | |
each, | |
type Operation, | |
spawn, | |
type Stream, | |
suspend, | |
} from "effection"; |
import { useCallback, useMemo } from 'react'; | |
import { Task, Operation, createQueue, spawn } from 'effection'; | |
import { useOperation } from './use-operation'; | |
/** | |
* Create an event handler that can be used for UI events safely. | |
* If the handler is invoked more than once, the existing task is halted | |
* and a new one is spawned. E.g. | |
* | |
* const AutoCompleter = ({ searchFn }) => { |
//========== .split() with lookbehind ========== | |
// Downside: Safari doesn’t support lookbehind | |
import * as assert from 'node:assert/strict'; | |
const RE_SPLIT_AFTER_EOL = /(?<=\r?\n)/; | |
function splitLinesWithEols1(str) { | |
return str.split(RE_SPLIT_AFTER_EOL); | |
} |
This super simple, fast, flexible layout system operates in a single pass (no reflow or constraint solving) and is probably <100 lines of non-comment, non-duplicate logic (there's a lot of duplicate logic between the top/left/right/bottom directional code that's not worth de-duplicating).
To layout PinLayout's Example 1:
The code is much simpler than PinLayout's:
/** | |
* Export all data from an IndexedDB database | |
* | |
* @param {IDBDatabase} idbDatabase The database to export from | |
* @return {Promise<string>} | |
*/ | |
export function exportToJson(idbDatabase) { | |
return new Promise((resolve, reject) => { | |
const exportObject = {} | |
if (idbDatabase.objectStoreNames.length === 0) { |
This is the first post of a series about Algebraic Effects and Handlers.
There are 2 ways to approach this topic:
Both approaches are valuables and give different insights on the topic. However, not everyone (including me), has the prerequisites to grasp the concepts of Category theory and Abstract Algebra. On the other hand, the operational approach is accessible to a much wider audience of programmers even if it doesn't provide the full picture.
// We model the call stack using a linked list of Generators | |
// Each Generator has a _return field pointing back to its parent | |
function stepGen(gen, arg) { | |
const {done, value} = gen.next(arg) | |
if(done) { | |
if(gen._return) { | |
stepGen(gen._return, value) | |
} |
This guide shows how to set up a bidirectional client/server authentication for plain TLS sockets.
Newer versions of openssl are stricter about certificate purposes. Use extensions accordingly.
Generate a Certificate Authority: