Skip to content

Instantly share code, notes, and snippets.

Avatar

Conrad Buck conartist6

  • Boulder, CO
View GitHub Profile
@conartist6
conartist6 / data-structure
Last active Mar 22, 2022
@iter-tools/regex data structure
View data-structure
┌───────────────┐
│ Expression │
│ root: true │
│ globalIdx: 1 │
└───────┬───────┘
parentSeq │ ▲
│ │ expr
┌──────────────┐ ┌───────┴─┴─────┐
│ State │ │ State │
│ type: cont │ │ type: success │
@conartist6
conartist6 / json-tokenizer.js
Created Mar 20, 2022
Peekerate json tokenizer
View json-tokenizer.js
import peekerate from '@iter-tools/peekerate';
export function* tokenize(input) {
const peekr = peekerate(input);
while (!peekr.done) {
const char = peekr.value;
if (char === '"') {
// yields three tokens: " content "
yield* tokenizeString(peekr);
@conartist6
conartist6 / json-tokenizer.js
Last active Mar 20, 2022
No-lib json tokenizer
View json-tokenizer.js
const t = {
token: (value) => ({ type: 'token', value }),
literal: (value) => ({ type: 'literal', value }),
};
const escapes = {
'"': '"',
'\\': '\\',
b: '\b',
f: '\f',
n: '\n',
@conartist6
conartist6 / json-parser.js
Last active Apr 19, 2022
A human-friendly json parser with parserate
View json-parser.js
import parserate from '@iter-tools/parserate';
const t = {
token: (value) => ({ type: 'token', value }),
literal: (value) => ({ type: 'literal', value }),
};
const escapes = {
'"': '"',
'\\': '\\',
@conartist6
conartist6 / resume.md
Last active Jan 26, 2022
Conrad Buck - A resume for humans
View resume.md

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

@conartist6
conartist6 / error_parser.ne
Last active Oct 9, 2021
Basic moo/nearley parser for JS errors
View error_parser.ne
@{%
const lexer = moo.states({
error: {
CausedBy: { match: /^\s*[cC]ause(?:d [bB]y)?:/, value: () => "Caused by:" },
At: { match: /^[ \t]*at /, push: "frame", value: () => "at " },
Space: /[ \t]+/,
Newline: { match: "\n", lineBreaks: true },
// Any line ending with file:line:col is a stack frame
// file:line:col may be wrapped in parens, or may be the literal 'native'
@conartist6
conartist6 / babel-parse-auto.js
Created Mar 6, 2021
Infer babel settings from file type
View babel-parse-auto.js
const recast = require('recast');
const babylon = require('@babel/parser');
function getParseCallOptions({ parse, ...parseOptions }) {
return { parse, parseOptions };
}
function getPrintCallOptions({ print, ...printOptions }) {
return { print, printOptions };
}
@conartist6
conartist6 / bracket.txt
Last active Feb 27, 2021
Battlebots Bracket 2021
View bracket.txt
Battlebots Bracket 2021
B is a buy, where the result was known when the bracket was made
(1) HYDRA BLOODSPORT (2)
(32) HYPERSHOCK GRUFF (31)
B (HYDRA) BLOODSPORT
B (GIGABYTE) TANTRUM
(16) MALICE FUSION (15)
(17) GIGABYTE TANTRUM (18)
@conartist6
conartist6 / visitor.ts
Last active Jan 10, 2021
Regex AST Visitor
View visitor.ts
import { AST as T } from 'regexpp';
export type Expression = T.Pattern | T.Group | T.CapturingGroup | T.LookaroundAssertion;
export type Visit<R> = (node: T.Node) => R;
export interface Visitors<R> {
RegExpLiteral?: (node: T.RegExpLiteral, visit: Visit<R>) => R;
Pattern?: (node: T.Pattern, visit: Visit<R>) => R;
Alternative?: (node: T.Alternative, visit: Visit<R>) => R;
@conartist6
conartist6 / whatsapp_TOS_2020.diff
Last active Jan 5, 2021
Changes in the whatsapp 2020 terms of service
View whatsapp_TOS_2020.diff
2c2,4
< WhatsApp Inc. (“WhatsApp,” “our,” “we,” or “us”) provides messaging, Internet calling, and other services to users around the world. Please read our Terms of Service so you understand what’s up with your use of WhatsApp. You agree to our Terms of Service (“Terms”) by installing, accessing, or using our apps, services, features, software, or website (together, “Services”).
---
> If you live in the European Region, WhatsApp Ireland Limited provides WhatsApp to you under this Terms of Service and Privacy Policy.
>
> WhatsApp LLC (“WhatsApp,” “our,” “we,” or “us”) provides messaging, Internet calling, and other services to users around the world. Please read our Terms of Service so you understand what’s up with your use of WhatsApp. You agree to our Terms of Service (“Terms”) by installing, accessing, or using our apps, services, features, software, or website (together, “Services”).
56c58
< Forum and Venue. If you are a WhatsApp user located in the United States or Canada, the “Special Arbitration Provi