Skip to content

Instantly share code, notes, and snippets.

@brecert
brecert / filename.txt
Last active February 28, 2023 20:26
naming description
contents
<!DOCTYPE html>
<html data-bs-theme="dark">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Bootstrap demo</title>
<link
href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"
rel="stylesheet"
integrity="sha384-GLhlTQ8iRABdZLl6O3oVMWSktQOp6b7In1Zl3/Jr59b6EGGoI1aFkw7cmDA6j6gD"
@brecert
brecert / mini-parser.js
Last active January 25, 2023 22:40
mini-parser.js
const TOKENS =
/(?<name>[\w_-]+)|(?:"(?<string>.+?)")|(?<whitespace>\s+)|(?<symbol>.)/g;
type Token = {
name?: string;
string?: string;
whitespace?: string;
symbol?: string;
};
// deno-lint-ignore-file no-unused-vars prefer-const no-cond-assign no-empty
import {
assert,
assertEquals,
assertExists,
assertInstanceOf,
equal,
} from "https://deno.land/[email protected]/testing/asserts.ts";
type LiteralT =
@brecert
brecert / part1.ts
Created December 8, 2022 16:14
day 08
const file = Deno.readTextFileSync('days/06/input.txt')
const map = file.split('\n').map(line => line.split('').map(char => parseInt(char)))
const cols = map[0].length
const rows = map.length
const visible = new Set<string>()
// top to bottom
for (let x = 0; x < cols; x++) {
let prev = -1
// Utils
type Fn<T = void> = () => T
type None = typeof None
const None = Symbol()
const $batched: Set<Fn> = new Set()
// The behavior for batches will be different from wires
// unsure why but it feels right
@brecert
brecert / examples
Last active November 7, 2022 15:59
chat markup
# Basic Formatting
**bold**
*italic* (friendly)
//italic//
__underline__
~~strikethrough~~
https://flems.io/#0=N4IgtglgJlA2CmIBcBmATAOgBwHYA0IAzvAgMYAu8UyIGphhIBAZhAo0gNqgB2AhmERJaAC3JhYTEKQD2PSvJoB6JQCp1AIwBO8eOtUqAOjwB6AAgCS5PrAiljZs+YBCM2FAeOnl67dJmAdz5CMxsdPigATzNmGQBXHig8M0IAawgABwyIHgBzTy9Ck2MpYjJyCDkOEABWJAAGEABfPF4BIVoAK0YCWXl4RWFm1pB+QRo6Bik+hXIaMQkzYE8NPlJU3K14xKQzAGIUQ4BuT1j5AFpmATZI3bA5GUIMtfgTnkdZWBktXYCRCEob2Mai8q3Wm22UF2th48D4WnOmwiEAG5AAFABOepQeC5ZIHFAAFhqZhq9QApPiAGxUnBoUkUgCUeAKZhhcIRSKgKPkaOxuOphKpDMp+ypNWFZPJjKOZgMKzWGy2CShbJyHMRWmRqMx-Lx+xqEpF1NpIplCvBysS50IEAAXvBdjUMDVSCIzABGFDwAAebyaxmMGhkUSWnjA8NyOV29TejmeMByuRjcbMnj+APgNuepEdZgyOlTZ3INvteddIlTCHIlARTzWSZTxiapRI8AolR41RwSEJHuaAF0mkA
# Basic Formatting
**bold**
*italic* (friendly)
//italic//
__underline__
~~strikethrough~~
@brecert
brecert / routes.swift
Last active September 12, 2022 14:03
struct TweetRoute: Route {
@EnviromentObject var db: Database
@Path var user: User
@Path var tweet: Tweet
var pattern: Pattern {
.GET
"user"
User.ID
"status"