Skip to content

Instantly share code, notes, and snippets.

View tomatrow's full-sized avatar

AJ Caldwell tomatrow

View GitHub Profile
@tomatrow
tomatrow / download.fish
Created June 20, 2025 21:50
download learn me a bitcoin pdfs
#!/usr/bin/env fish
set index 0
cat pages.txt | while read --line url
set name (echo "$url" | string replace "https://learnmeabitcoin.com/assets/pdf/" "" | string replace --all "/" "_" | string trim --chars "_")
curl "$url" > "$index"_"$name.pdf"
set index (math "$index + 1")
end
@tomatrow
tomatrow / Collection.svelte.ts
Last active June 19, 2025 01:37
Reactive Pocketbase Collection
import { type RecordService, type RecordModel, type RecordSubscribeOptions } from "pocketbase"
import { createSubscriber } from "svelte/reactivity"
export class Collection<M extends RecordModel = RecordModel> {
#recordService: RecordService<M>
#records = $state<Record<string, M>>({})
#subscribe: () => void
constructor(recordService: RecordService<M>, options?: RecordSubscribeOptions) {
this.#recordService = recordService
@tomatrow
tomatrow / rcWidget.js
Created February 4, 2022 19:24 — forked from milesw/rcWidget.js
rcWidget.js
import 'core-js/es6/array';
import 'core-js/es6/object';
import 'core-js/es6/string';
// Global options
import defaults from './_config';
// general helper functions
import Helper from './_helpers';
// general pricing and currency functions
import Pricing from './_pricing';
// throttle and debounce manager
@tomatrow
tomatrow / request.ts
Created October 8, 2021 04:57
Svelte Kit Request
import type { RequestHandler } from "@sveltejs/kit"
import { browser } from "$app/env"
export type Method = "get" | "put" | "post" | "patch" | "delete"
export type UnpackHandler<Handler> = Handler extends (RequestHandler<infer Locals, infer Input, infer Output>) ? { locals: Locals, input: Input, output: Output }: unknown
export interface RequestConfig {
method?: Method
body?: any
@tomatrow
tomatrow / RewriteLoader.svelte
Last active June 11, 2021 22:24
Kind of does does rewrites for SvelteKit
<script context="module" lang="ts">
import type { Load, LoadInput, LoadOutput } from "@sveltejs/kit"
export interface Route {
id: any
load: Load
}
export function rewriteLoad(routes: Route[]): Load {
return async input => {
@tomatrow
tomatrow / Route.svelte
Last active December 4, 2020 08:47 — forked from RedHatter/Route.svelte
Single file router for svelte.
<script>
import UrlPattern from 'url-pattern'
import location, { navigate, noMatch } from './location.js'
export let path
export let component = undefined
export let redirect = undefined
$: pattern = new UrlPattern(path)
$: router = {
@tomatrow
tomatrow / braket-border.scss
Created February 15, 2020 23:52
Braket Border SCSS Style
// for the headings in sidebars
$braket-border-opposites: (
left: right,
right: left,
top: bottom,
bottom: top
);
@mixin braket-border-child($direction, $border-width, $length) {
content: "";
@tomatrow
tomatrow / index.html
Created February 15, 2020 03:58
Sharp Shadowed Button
<div class="button">Title</div>
@tomatrow
tomatrow / .gitignore
Last active June 8, 2018 03:24
Convert CalCoast statements to something ledger can use.
statements
name date gender period grams ethnicity
0 1 50 25 10 15
conrad 2 girl pm 3175.15 greek
nic 2 girl am 3373.59 nic
alisha 2 girl pm 3685.44 white
brad 3 boy am 4592.62 greek
aj 4 girl am 2409.71 asian