Skip to content

Instantly share code, notes, and snippets.

The Self-Modifying XSL Paradigm

Overview

This document describes a radical approach to web development where the system that serves the website is also the system that documents, tests, and modifies itself. Built on XSL transformations and an XML database, it eliminates the traditional boundaries between code, content, documentation, and development tools.

Core Concept

Instead of having separate systems for:

  • Serving web pages
/**
* Copyright (c) 2024 Mikael Brockman <https://github.com/mbrock>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
// transcription-client.js
class TranscriptionClient {
constructor(options = {}) {
this.language = options.language || 'en-US';
this.websocketUrl = options.websocketUrl || this._getDefaultWebsocketUrl();
this.onTranscript = options.onTranscript || (() => {});
this.onInterimTranscript = options.onInterimTranscript || (() => {});
this.onError = options.onError || console.error;
@mbrock
mbrock / tbl.ttl
Created November 21, 2024 01:50
Tim Berners-Lee Invents Formal Beer Ontology After Too Many Belgian Triples
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix bfo: <http://purl.obolibrary.org/obo/bfo.owl#> .
@prefix mfo: <http://purl.obolibrary.org/obo/mfo.owl#> .
@prefix sfo: <http://timbl.org/ontologies/scent-flavor#> .
@prefix beer: <http://www.semanticbeer.org/ontology/> .
@prefix time: <http://www.w3.org/2006/time#> .
// MIT license (c) Mikael Brockman
class TypeWriter extends HTMLElement {
limit = 0
blind = new Range()
timer?: number
scout = new MutationObserver(() => {
this.update()
if (!this.timer) this.proceed()
})

Prolog Philosophy and Best Practices

Pure Predicates and Referential Transparency

Focus on the referentially transparent, pure predicates.

Delight in unification and backtracking.

Rejoice in logical domain modelling relations.

document.addEventListener('DOMContentLoaded', function() {
let mediaRecorder;
let audioChunks = [];
let isRecording = false;
const recordBtn = document.getElementById('recordBtn');
const transcriptionEl = document.getElementById('transcription');
let token = localStorage.getItem('apiToken');
if (!token) {
token = prompt('Please enter your OpenAI API token:');
@mbrock
mbrock / hole-mode.el
Last active May 30, 2024 07:03
hole mode for emacs
;;; hole-mode.el --- fill holes with GPT-4 -*- lexical-binding: t -*-
;; Author: Mikael Brockman <[email protected]>
;; Version: 1.0
;;; Commentary:
;; This package provides a minor mode for filling holes in code with AI.
;;
;; It is designed to work with the `llm' command-line tool, which is a
@mbrock
mbrock / swash.js
Created October 26, 2023 11:03
swa.sh
// swa.sh - a tool, for naught
// Copyright (C) 2023 Mikael Brockman
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
@mbrock
mbrock / roam-telegram.js
Last active September 21, 2021 18:21
Roam Telegram integration PoC
// I made this in like one hour while baby was napping.
// It's a proof of concept, but I hope to improve it soon.
// In particular, I really want to grab photos from Telegram.
//
// Make a page in your Roam called [[Telegram Bot]].
//
// Put two nodes in there:
//
// API Key:: <key you get from Telegram's bot system>
// Last Update ID::