Skip to content

Instantly share code, notes, and snippets.


Tab Atkins Jr. tabatkins

View GitHub Profile

XML-in-KDL (XiK)

This specification describes a canonical way to losslessly encode XML in KDL. While this isn't a very useful thing to want to do on its own, it's occasionally useful when using a KDL toolchain while speaking with an XML-consuming or -emitting service.

This is version 1.0.0 of XiK.

XML-in-KDL (XiK from now on) is a kdl microsyntax for losslessly encoding XML into a KDL document. XML and KDL, luckily, have very similar data models (KDL is almost a superset of XML), so it's quite straightforward to encode most XML documents into KDL.

XML has four types of nodes, corresponding to certain KDL constructs:

tabatkins /
Last active Jul 18, 2021
JSON-in-KDL specification


This specification describes a canonical way to losslessly encode JSON in KDL. While this isn't a very useful thing to want to do on its own, it's occasionally useful when using a KDL toolchain while speaking with a JSON-consuming or -emitting service.

JSON-in-KDL (JiK from now on) is a kdl microsyntax consisting of three types of nodes:

  • literal nodes, with _ as the nodename
  • array nodes, with array as the nodename
  • dict nodes, with dict as the nodename
tabatkins / hatetris.js
Created May 21, 2021
Unobfuscated version of HATETRIS's default AI
View hatetris.js
function construct(getNextStates) {
return function ai(currentState) {
const pieces = [
{name:"S", annoyance:7},
{name:"Z", annoyance:6},
{name:"O", annoyance:5},
{name:"I", annoyance:4},
{name:"L", annoyance:3},
{name:"J", annoyance:2},
{name:"T", annoyance:1},
tabatkins /
Last active Mar 24, 2021
Pipeline notes

Real world use-case: someone asking for Object.values()/etc to be installed as Symbol-keyed properties on Object.prototype, so they can have method chains working on arrays/iterators that produce an Object at some intermediate point, without having to go back and wrap an entire chunk of the method chain in a big wrapping Object.values().

That is, they're prefer not to have to write this code:

const x = Object.values(array.filter(x=>x).map(x=>f(x)).reduce(intoObjectSomehow)).map(y=>g(y))
View gist:a29f71075d0b31e014978983beb0078e
There's a reason people don't like to write HTML tables,
and it's because they don't write good HTML in the first place.
Case in point, taken from a spec I'm editting right this moment:
<table id="distinguishable-table" class="matrix data complex">
<th class="corner"></th>
tabatkins /
Last active Sep 16, 2021
Comparing the three pipeline proposals

We've been deadlocked for a while on the pipeline operator proposal, for a few reasons. Partially it's just low implementor interest, as this is fundamentally just syntactic sugar, but also because there are three competing proposals and the proponents of each haven't been convinced by the others yet.

In this essay I hope to briefly outline the problem space, summarize the three proposals, and talk about what's gained/lost by each of them. (Spoiler: they're all nearly identical; we're arguing over very small potatoes.)

tabatkins /
Last active Mar 16, 2021
Comparing Python's match statement with mine
tabatkins /
Last active Feb 4, 2021
Somewhat sorted list of apprentice weapon properties

Masterwork Properties

Masterwork properties can be applied to any masterwork weapon or suit of armor, provided you can spare the time and gold cost required to apply it. Each property entry details the property’s level and the type of equipment it can be applied to.

Unless otherwise noted, a piece of gear cannot have the same property more than once; for example, you cannot


Core Proposal real-world examples

Living Document. J. S. Choi, 2018-12.

WHATWG Fetch Standard

The [WHATWG Fetch Standard][] contains several examples of using the DOM fetch function, resolving its promises into values, then processing the values in various ways. These examples may become more easily readable with smart pipelines.