Skip to content

Instantly share code, notes, and snippets.

View scripting's full-sized avatar

Dave Winer scripting

View GitHub Profile
@scripting
scripting / firstSentence.js
Created October 13, 2026 15:24
Get the first sentence in a string
function firstSentence (s, maxCt) {
var segmenter = new Intl.Segmenter (undefined, {granularity: "sentence"});
var iterator = segmenter.segment (s) [Symbol.iterator] ();
var item = iterator.next ();
var result = "";
if (!item.done) {
result = item.value.segment.trim ();
if (result.length > maxCt) {
result = result.substr (0, maxCt - 3);
var ix = result.lastIndexOf (" ");
@scripting
scripting / markdownbrowser.md
Created October 7, 2026 18:19
Markdown browser spec written by ChatGPT

Markdown Browser

Goal

Build a very simple web browser whose native document format is Markdown.

This is not a Markdown editor inside a conventional web app.

It is a browser for a simpler web.

@scripting
scripting / findDiffs.js
Created September 13, 2026 14:30
A script Claude wrote to find all the parts that changed in my Frontier.root odb
//compareRoots.js -- what in a snapshot of DW's root differs from the shipping root (or another snapshot): node compareRoots.js <his .root> <shipping .db or .root>
const odb = require ("/Users/davewiner/Claude/trigger/frontierodb.js");
const sqlite3 = require ("/Users/davewiner/Claude/trigger/node_modules/better-sqlite3");
function val (v) { return ((v && v.value !== undefined && v.type) ? v.value : v); }
function typeOfNode (v) { return ((v && v.type) ? v.type : (v && typeof v === "object" && !Array.isArray (v) && !(v instanceof Date) ? "table" : typeof v)); }
function textOfLines (lines) { return (lines.map (function (l) { return ("\t".repeat (l.level) + (l.flComment ? "«" : "") + l.text); }).join ("\n")); }
function flatten (t, path, out) { //path -> {type, text}; a node from the root reader is {type, value}
Object.keys (t).forEach (function (name) {
const node = t [name], p = path ? path + "." + name : name;
if ((node === undefined) || (node === null)) { out [p] = {type: "novalue", text: ""}; return;
@scripting
scripting / leafletrss.xml
Created August 8, 2026 13:22
Review of Leaflet RSS feed
<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>Let’s try leaflet</title>
<link>https://davew.leaflet.pub</link>
<description>I want to have a try and hopefully some fun.</description>
<lastBuildDate>Thu, 30 Jul 2026 18:06:57 GMT</lastBuildDate>
@scripting
scripting / trigger.md
Created August 5, 2026 12:12
A shot description of what "trigger" can do (codename for Frontier in Node)

What trigger can do

Written 8/4/26 for Jake Savin and Dave Winer. Describes trigger v0.5.0 running usertalk v0.3.0 at https://trigger.usertalk.org, backed by a SQL copy of Dave's Frontier object database — 212,591 objects, decoded from the real .root files.

The one-paragraph version

Trigger is a web server that runs UserTalk. You send it a script over HTTP and it answers with the value. The scripts are Dave's own — not ported, not rewritten — read straight out of a decoded copy of his object database, and the language underneath is a fresh implementation of the UserTalk interpreter in JavaScript. As of today it runs the nodeEditor build pipeline end to end: an outline written in Electric Drummer on a laptop is uploaded, built by nodeEditorSuite.uploadScripts, and the rendered files land on a live website.

The endpoints

@scripting
scripting / universalMentions.md
Created June 14, 2026 00:04
ChatGPT summary of its observations re "Universal Mentions"

Universal Mentions

Universal Mentions is a simple convention for mentioning people on the open web without needing a central username system.

On Twitter/X, Bluesky, Mastodon, and similar systems, a mention is usually something like:

@davewiner

That only works because each platform controls its own user directory. On the open web, there is no single global directory of usernames.

@scripting
scripting / demo.js
Created June 12, 2026 14:40
A script used to generate Wikipedia-style pages via ChatGPT
//mypedia -- build a short, balanced reference page about a name, using ChatGPT.
const name = args [0];
if (name === undefined) {
console.log ("Usage: belt mypedia.belt \"name\"");
}
else {
//first-cut prompt -- refine the wording here.
const prompt = "Build a short, balanced reference page about " + name + ". "
+ "Follow the structure of a Wikipedia article but keep it brief -- an outline of the basic facts, not a long detailed treatment. "

Superman

Superman is a fictional superhero appearing in comic books published by DC Comics. The character was created by writer Jerry Siegel and artist Joe Shuster, debuting in "Action Comics" #1 in June 1938. Known as a cultural icon, Superman is often hailed as the archetype of the superhero trope and has had a profound impact on American culture and beyond.

Creation and Development

Superman was conceived during the Great Depression, initially as a villain in a short story and later reimagined as a hero. Siegel and Shuster sold the character to Detective Comics, Inc., which later became DC Comics, kickstarting what is considered the Golden Age of Comic Books.

Character Overview

@scripting
scripting / repeatProcess.js
Created May 12, 2026 21:28
This code was coming up all over the place and I wanted to make it easy to find.
function addFeedsIfNecessary (urlsToCheck, callback) {
const ctTotalFeeds = urlsToCheck.length;
var ixNext = 0, ctInFlight = 0, ctDone = 0;
function startMore () {
while (true) {
if (ctInFlight >= config.maxConcurrentFeedChecks) {
break;
}
if (ixNext >= ctTotalFeeds) {
break;
@scripting
scripting / checkDomains.js
Created March 24, 2026 16:20
Frontier script that finds out if files a folder of domains have moved
on checkDomains () {
«Changes
«3/24/26; 11:39:01 AM by DW
«Loop over all the domains that were on Palatka and see which ones still resolve to palatka's IP address.
«tcp.dns.getdottedid ("palatka.scripting.com")
«"161.35.120.52"
«tcp.dns.getdomainname ("161.35.120.52")
«"161.35.120.52"
local (domainsFolder = nodeEditorSuite.getAllServersFolder () + "palatka:pagepark:domains:");