Skip to content

Instantly share code, notes, and snippets.

View searls's full-sized avatar
💚

Justin Searls searls

💚
View GitHub Profile
@searls
searls / auto_commit.sh
Last active February 21, 2026 19:45
I got sick of trying to figure out the best time to commit code between me and Claude. I simultaneously found bugs in Claude's checkpoint and rewind system. So now I just auto-commit on every turn with the title being whatever claude just said and the body being whatever my prompt was. (I also often want to go back and replay my prompts when Cla…
#!/bin/bash
# Auto commits after each Claude turn if:
# - A STOP hook is configured that runs this script
# - A <repo_root>.claude/auto_commit.json file has key "enabled" set to `true`
set -euo pipefail
INPUT=$(cat)
# Find git root; bail if not a repo
GIT_ROOT=$(git rev-parse --show-toplevel 2>/dev/null) || exit 0
@searls
searls / scrapple_RESULT.md
Created February 17, 2026 21:24
scrapple vs xcode mcp

NavigationSplitViewVisibility is the type that controls sidebar (and content column) visibility in a NavigationSplitView. You create a @State property of this type and pass a Binding to the split view initializer.

Declaration

struct NavigationSplitViewVisibility

Usage pattern

@searls
searls / plus_1ify_icloud_contacts_phone_numbers
Created January 16, 2026 04:40
A script to normalize all of your North American phone numbers to start with a +1 so that iOS/iMessage is less confused when you add an overseas SIM card. Requires an app password to iCloud
#!/usr/bin/env python3
from __future__ import annotations
import argparse
import base64
import datetime as dt
import getpass
import os
import re
import sys
@searls
searls / SUMMARY.md
Created November 17, 2025 20:12
Rails 8.1 breaks tests if you have MT_NO_PLUGINS set. Which a certain @tenderlove told me to always set!!

Rails 8.1, Minitest plugins, and "0 runs"

Problem statement

After upgrading Rails from 8.0.x to 8.1.x, running system tests like

CI=true bin/rails test:system
CI=true bin/rails test test/system/login_test.rb -v
import Foundation
import FoundationModels
// Phase 1: Define a structure to model a dynamic set of prompts that could be driven by arbitrary data (e.g. flat JSON file, fetched over HTTP, etc)
struct EducationalPromptSet {
let type: String
let instructions: String
let name: String
let description: String
import Foundation
import FoundationModels
// Phase 1: Define a structure to model a dynamic set of prompts that could be driven by arbitrary data (e.g. flat JSON file, fetched over HTTP, etc)
struct EducationalPromptSet {
let type: String
let instructions: String
let name: String
let description: String
@searls
searls / cursor_troubleshooting_postgresql_conne.md
Created June 15, 2025 09:07
The single most valuable thing I've had cursor do is unfuck up homebrew postgres for me

Troubleshooting PostgreSQL connection issues

Exported on 6/15/2025 at 18:07:29 GMT+9 from Cursor (1.1.2)


User

ugh my tests were hanging so i rebooted and now pg won't connect

psql: error: connection to server on socket "/tmp/.s.PGSQL.5432" failed: No such file or directory

@searls
searls / kamesame_synonym_detection.md
Created June 12, 2025 07:20
I kinda forgot how I implemented synonym detection in KameSame (other than to know it was the MAIN THING the app had to do and performantly), so I asked Cursor to explain it

Understanding KameSame synonym detection

Exported on 6/12/2025 at 16:19:24 GMT+9 from Cursor (1.0.0)


User

Explain how KameSame does synonym detection when a user answers a question with a valid response but not the one we're looking for. can you please produce a report explaining this at a conceptual level and then back it up with progressively deeper technical dives?

I remember that while this is driven through the UI, it runs all the way down to the design of the database views, which i believe i even materialized for speed so that every night when the dictionaries are updated the synonym query is faster. i'll need you to check me on that stuff though b/c it's been 6+ years since i did this. provide receipts!

@searls
searls / assembles_rich_text_facets.rb
Created January 27, 2025 21:18
Example code for working with the bluesky API and the bskyrb gem. Copyright Searls LLC, 2025. All rights reserved. Not open source, only made available for your viewing pleasure. For a license to use this code, e-mail fuckyoupayme@searls.co
class Platforms::Bsky::AssemblesRichTextFacets
# Name of the game here is to take something output by IdentifiesPatternRanges
# (which exists to identify unbreakable tokens) and use the embedded metadata
# about which of these things are hashtags and links to construct the rich text
# facet hash that bluesky wants in order to render links and hashtags
def assemble(pattern_ranges)
pattern_ranges.map { |range|
if range[:type] == :tag
facet_for_tag(range)
elsif range[:type] == :link
@searls
searls / identifies_pattern_ranges.rb
Last active January 28, 2025 11:47
Truncating content to fit into a tweet-like post without accidentally truncating in the middle of a URL or a hashtag is… not fun?
class Platforms::TruncatesContent::IdentifiesPatternRanges
HASHTAG_PATTERN = /\B#\p{L}[\p{L}\p{M}\p{Nd}_]*/
# Ripped outta this https://github.com/amogil/url_regex/blob/master/lib/url_regex.rb
URL_PATTERN_STRING = '
# scheme
(?:(?:https?|ftp)://)?
# user:pass authentication
(?:\S+(?::\S*)?@)?