Skip to content

Instantly share code, notes, and snippets.

View knowler's full-sized avatar

Nathan Knowler knowler

View GitHub Profile

Keybase proof

I hereby claim:

  • I am knowler on github.
  • I am knowler (https://keybase.io/knowler) on keybase.
  • I have a public key whose fingerprint is 68DB B663 00FD 3260 850E 2440 3B3A 57CE 9971 992F

To claim this, I am signing this object:

eject () {
if [ -z "$1" ]; then
echo "No drive specified."
else
dot_clean "/Volumes/$1"
diskutil unmount "$1"
fi
}
flacdown () {
mkdir -p converted
for input in "$@"
do sox -S $input -r 44100 -b 16 "converted/$(basename $input)"
done
}
mp3these () {
mkdir -p mp3-320
for input in "$@"
do sox -S $input -C 320 "mp3-320/${input%.*}.mp3"
done
}
theme() { cd $(wp theme path)/$(wp option get stylesheet | cut -d/ -f1) }
#!/bin/bash
# Regolith aka Un-Bedrock
# "But what if we need to hand it off to another agency?" No more!
# This script converts a Bedrock site to a normal WordPress structure.
# Run it from the root of a Bedrock project.
# Created by Nathan Knowler and Daniel Roe
echo "Converting Bedrock to a normal WordPress file structure..."
@knowler
knowler / app.css
Last active December 8, 2021 17:06
Potential future with ES Modules and Web Components (multi-file version)
main fancy-article::part(header) {
color: red;
}
aside fancy-article::part(header) {
color: blue;
}
@knowler
knowler / app.css
Last active December 8, 2021 17:07
Potential future with ES Modules and Web Components (single HTML-module version)
main fancy-article::part(header) {
color: red;
}
aside fancy-article::part(header) {
color: blue;
}
@knowler
knowler / fontsource-with-remix.md
Last active February 21, 2024 17:03
Fontsource with Remix (pre-1.7.3)

Fontsource with Remix

Fontsource is designed to work with projects that bundle their CSS. You import their stylesheet and the bundler will place the fonts in your build directory and the CSS file will have the correct URL for the @font-face src.

Remix doesn’t bundle CSS and so while you can import their CSS file and add it to your links, the URL to font will be incorrect. It is still possible to use Fontsource with Remix. We just need to create our own @font-face declaration with the correct URL to the font (ideally, one that benefits from Remix’s asset fingerprinting). There’s a bit of manual set up, but once that’s done, you can serve the font on your site and benefit from updates for the font.

  1. Install your font:
    npm install --save @fontsource/montserrat
@knowler
knowler / custom-element-expander.js
Last active November 10, 2023 19:49
deno run custom-element-expander.js
import {parseHTML} from "https://esm.sh/linkedom";
// This is just so IDEs use HTML syntax highlighting.
const html = String.raw;
const { window, document, customElements, HTMLElement } = parseHTML(html`
<!doctype html>
<html lang="en-ca">
<head>
<meta charset="utf-8">