Skip to content

Instantly share code, notes, and snippets.

View conartist6's full-sized avatar

Conrad Buck conartist6

View GitHub Profile
@conartist6
conartist6 / resume.md
Last active March 1, 2023 15:02
Conrad Buck - A resume for humans

This is my resume for humans! It is meant to be read, not parsed, and that is on purpose. My goal here is to start conversations, so you are welcome to email me any questions or comments.

Conrad Buck

conartist6@gmail.com
https://github.com/conartist6
https://burningpotato.com
Remote, Eastern Time

I consider myself to be foremost a linguist and a champion of developer experience. I am always considering how it should be possible to express technical concepts with readable code, how to uphold and combine the fundamental principles of development, and what the next step is on the path to much larger goals. I hope that you will read the code I have written and find it unremarkable, but I hope that you understand also that this reflects what I believe is an exceptional ability to reach into many, many different projects, languages, and disciplines to triage and fix bugs, build missing functionality, and most importantly to make the right

function /*1*/ foo /*2*/ (/*3*/) /*4*/ {/*5*/} /*6*/
@conartist6
conartist6 / index.js
Last active January 28, 2023 00:00
ReadOnlyMap
const _ = Symbol('private');
class ReadOnlyMap {
constructor(map) {
this[_] = map;
}
static from(entries) {
return new ReadOnlyMap(new Map(entries));
}
@conartist6
conartist6 / ranges.js
Last active January 22, 2023 18:10
Tokenizer ranges
class Tokenizer {
constructor(source) {
this.source = source;
this.result = null; // result is a token, i.e. a stack of tokens
this.pathRangesByToken = new WeakMap();
this.prevTokensByToken = new WeakMap();
}
ownTokensFor(path) {
const { prevTokensByToken, pathRangesByToken } = this;
@conartist6
conartist6 / json-parser.js
Last active January 17, 2023 17:33
A human-friendly json parser with parserate
import parserate from '@iter-tools/parserate';
const t = {
token: (value) => ({ type: 'token', value }),
literal: (value) => ({ type: 'literal', value }),
};
const escapes = {
'"': '"',
'\\': '\\',
@conartist6
conartist6 / parse-grammar.js
Last active December 4, 2022 21:35
Parser spitballing
import { Grammar } from '@cst-tokens/grammar';
import { objectEntries } from '@cst-tokens/helpers/iterable';
import { eat, match } from '@cst-tokens/helpers/commands';
import { capture, ref, PN } from '@cst-tokens/helpers/shorthand';
// 2-+2+-2
/*
$capture = '2';
$node = { type: 'Digit', value: $caputure };
$capture = '-';
@conartist6
conartist6 / bench.js
Created November 26, 2022 03:37
Common empties microbenchmark
console.time('new Set');
for (let i = 0; i < 1_000_000; i++) {
new Set();
}
console.timeEnd('new Set');
console.time('new Map');
for (let i = 0; i < 1_000_000; i++) {
new Map();
}
@conartist6
conartist6 / index.js
Created November 7, 2022 22:33
splitWhen for trusted destructuring
export class Coroutine {
constructor(generator) {
this.generator = generator[Symbol.iterator]();
this.current = this.generator?.next();
}
get value() {
return this.current.value;
}
@conartist6
conartist6 / output.md
Last active September 15, 2022 22:21
cst-tokens alpha output

Input:

if (foo) {
  // comment
}

Traversal log

@conartist6
conartist6 / index.js
Last active June 12, 2022 11:32
sync vs async for loops
function* range(end) {
for (let i = 0; i < end; i++) {
yield i;
}
}
const a = Array.from(range(65536));
module.exports['for await..of values from one chunk'] = {
fn: async function(deferred) {