This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pyds: https://github.com/jrc03c/pyds | |
from numpy import log | |
from pyds import sort | |
alpha = "abcdefghijklmnopqrstuvwxyz " | |
quotes = "'\"‘’“”" | |
def clean(x): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { execSync } = require("node:child_process") | |
const { fg, fx } = require("@jrc03c/bash-colors") | |
const { indent, unindent, wrap } = require("@jrc03c/js-text-tools") | |
const express = require("express") | |
const fs = require("node:fs") | |
const path = require("node:path") | |
const process = require("node:process") | |
const watch = require("@jrc03c/watch") | |
const OUT_DIR = "_site" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let scrollY = 0 | |
// to disable scrolling: | |
scrollY = window.scrollY | |
document.body.style.position = "fixed" | |
document.body.style.top = `-${scrollY}px` | |
// to enable scrolling again: | |
document.body.style.position = "" | |
document.body.style.top = "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://developer.mozilla.org/en-US/docs/Web/HTML/Element | |
<a> | |
<abbr> | |
<address> | |
<area> | |
<article> | |
<aside> | |
<audio> | |
<b> | |
<base> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require("fs") | |
!(async () => { | |
const stream = fs.createWriteStream("path/to/file") | |
let canWrite = true | |
let counter = 0 | |
// optionally listen for errors | |
stream.on("error", error => { | |
throw error |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require("fs") | |
const readline = require("readline") | |
!(async () => { | |
const stream = fs.createReadStream("path/to/file") | |
const rl = readline.createInterface({ | |
input: stream, | |
crlfDelay: Infinity, | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 8" x 4.5" | |
plot.rcParams["figure.figsize"] = 8, 4.5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function deepSort(x, fn) { | |
fn = fn || ((a, b) => (a < b ? -1 : 1)) | |
if (typeof x === "object") { | |
if (x === null) return x | |
if (x instanceof Array) { | |
return x.map(v => deepSort(v, fn)).sort(fn) | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const ABOVE = "above" | |
const BELOW = "below" | |
const EXACTLY_ON = "exactly_on" | |
function getPointRelationToLine(point, pair) { | |
const [p1, p2] = pair | |
// if the pair have the same x-values, then they either lie on a | |
// vertical line or are identical | |
if (p2[0] - p1[0] === 0) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const process = require("process") | |
const watch = require("@jrc03c/watch") | |
function rebuild() { | |
console.log("-----") | |
console.log(`Rebuilding... (${new Date().toLocaleString()})`) | |
try { | |
// do stuff... | |
console.log("Done! 🎉") |
NewerOlder