Skip to content

Instantly share code, notes, and snippets.

View jaredh159's full-sized avatar

Jared Henderson jaredh159

View GitHub Profile
@jaredh159
jaredh159 / table.md
Created April 24, 2024 13:32
table thoughts
  • [options="foo,bar"] is equiv to [%foo%bar]
  • there are both cell specifiers and column specifiers, cell specifier wins if sets same value w/ col spec
@jaredh159
jaredh159 / delete.md
Created April 16, 2024 15:58
delete flp bursty downloads

overview of download activity

this shows how many downloads are normal, in 4/2024, this was 15-75 downloads per day.

should be easy to spot outliers (like 4343 on 4/12/24).

WITH DailyCounts AS (
    SELECT
        DATE(created_at) AS day_start,
@jaredh159
jaredh159 / indirect.swift
Last active April 18, 2024 14:35
swift @indirect property wrapper
@dynamicMemberLookup
@propertyWrapper
enum Indirect<T> {
indirect case wrapped(T)
var wrappedValue: T {
get { switch self { case .wrapped(let x): return x } }
set { self = .wrapped(newValue) }
}
@jaredh159
jaredh159 / dual-boot.md
Created September 29, 2023 16:01
add dual boot macos
  1. go to disk utility, then choose "View" -> Show all Devices"
  2. right click the container in the sidebar, and add an APFS volume, named for the OS
  3. get an installer for the OS you want, from the App store, or from somewhere else...
  4. launch the installer, and when it asks you to choose the disk, choose the new partition
Process: SwiftUIHelloWorld [1982]
Path: /Users/USER/Desktop/SwiftUIHelloWorld.app/Contents/MacOS/SwiftUIHelloWorld
Identifier: com.catalina-compat.SwiftUIHelloWorld
Version: 1.0 (1)
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: SwiftUIHelloWorld [1982]
User ID: 501
Date/Time: 2023-08-18 12:09:02.420 -0400
@jaredh159
jaredh159 / dork.rs
Created June 2, 2023 11:33
asciidork rust snippets while prototyping
// #[macro_use]
macro_rules! block_struct {
($name: ident, $context: ident) => {
#[derive(Debug, PartialEq, Eq)]
pub struct $name {
pub blocks: Vec<Block>,
}
impl $name {
fn new() -> Self {
@jaredh159
jaredh159 / strict.tsx
Created December 7, 2022 14:33
react strict mode use effect double request workaround
function useVerifySignup(reqState: RequestState['state'], token: string): void {
const dispatch = useDispatch();
useEffect(() => {
// necessary because the API request is not idempotent, you can only verify once
// and react strict mode tries to force effects be idempotent for future versions
// https://github.com/facebook/react/issues/24502#issuecomment-1118846544
let isStrictModeDevRemount = false;
async function verify(): Promise<void> {
@jaredh159
jaredh159 / Makefile
Created November 5, 2022 19:10
gertie ts-watch old way
ts-oldwatch:
$(CONCURRENTLY) \
-n dash/app,dash/amb,dash/cmp,dash/dtm,dash/key,dash/typ,dash/utl,mark/app,mark/cmp,docs/app,shar/cmp,shar/dtm,shar/twd,strybook \
-c cyan.dim,red.dim,green.dim,blue.dim,gray,magenta.dim,yellow.dim,cyan,red,green,blue,magenta,#f80 \
"pnpm tsc --noEmit --project dash/app --watch --preserveWatchOutput" \
"pnpm tsc --noEmit --project dash/ambient --watch --preserveWatchOutput" \
"pnpm tsc --noEmit --project dash/components --watch --preserveWatchOutput" \
"pnpm tsc --noEmit --project dash/datetime --watch --preserveWatchOutput" \
"pnpm tsc --noEmit --project dash/keys --watch --preserveWatchOutput" \
"pnpm tsc --noEmit --project dash/types --watch --preserveWatchOutput" \
@jaredh159
jaredh159 / createAsyncThunk.ts
Created August 30, 2022 18:26
CreateAsyncThunk typed fn
import {
AnyAction,
ThunkAction as LibThunkAction,
createAsyncThunk as libCreateAsycThunk,
AsyncThunkPayloadCreator,
AsyncThunkOptions,
createAction,
nanoid,
ThunkDispatch,
Action,