Skip to content

Instantly share code, notes, and snippets.

View mikeschinkel's full-sized avatar

Mike Schinkel mikeschinkel

View GitHub Profile
@mikeschinkel
mikeschinkel / .readme.md
Last active November 1, 2026 09:36
Script to create and remove a RAM disk on macOS

How to Create a RAM Disk on macOS

This script creates a RAM disk either in a ./data subdirectory off the root of the current Git repo, or a ./data subdirectory of the current directory if not in a Git repo.

To Attach a RAM Disk

./ramdisk-macos.sh 

To Detatch the RAM disk

@mikeschinkel
mikeschinkel / tl-dr.md
Created October 3, 2026 22:52
TL-DR command for Claude Code
description Ask for action items from a wall of text

TL;DR — What from that wall of text is an action item that I NEED to know?

<?php
/*
Plugin Name: Instrument Hooks for WordPress
Description: Instruments Hooks for a Page. Outputs during the Shutdown Hook.
Version: 0.1
Author: Mike Schinkel
Author URI: http://mikeschinkel.com
*/
if (isset($_GET['instrument']) && $_GET['instrument']=='hooks') {
@mikeschinkel
mikeschinkel / README_for_reproducting_issue_using_JediTerm_with_BubbleTea_v2.md
Last active March 25, 2026 06:56
Example illustrating BubbleTea v2 optimizations producing invalid screen rendering with JetBrains GoLand's JediTerm.

jediterm-bug

Minimal reproduction of a rendering bug that affects Bubble Tea v2 applications running inside JetBrains GoLand (and all IntelliJ-based IDEs).

The Problem

GoLand's built-in terminal uses JediTerm, which does not correctly handle all ANSI escape sequences. Specifically, CBT (Cursor Backward Tab) sequences emitted by ultraviolet's differential renderer can cause invalid screen rendering when transitioning between layouts of different widths.

This program demonstrates the issue by toggling between two views recorded from a real Bubble Tea application:

@mikeschinkel
mikeschinkel / _how-to-self-correct-ai-slop.md
Last active March 20, 2026 16:42
This illustrates how to use Claude Code to clean up its own "AI slop."

This illustrates how to use Claude Code for development, allowing it to generate "AI slop" but then periodically using it to rearchitect and clean up the slop.

I directed Claude Code to generate both of these two (2) documents. The file rearchitecture_plan.md was created a while back when it was developing code with bugs that it could not fix so I asked it to review, critique, and identify areas for architectural improvement.

The file fix_plan.md was created after we worked on the project significantly more until it became unmaintainable again, so I pointed it at the refactor_plan.md and asked it to review the code again, and fix_plan.md was born.

And frankly, it got everything pretty much exactly right.

@mikeschinkel
mikeschinkel / .README.md
Last active September 8, 2025 03:34
Go json.Unmarshal() vs. PHP json_decode() performance a large JSON file

GoLang json.Unmarshal() vs. PHP json_decode()

To evaluate if Go json.Unmarshal() is faster or slower than PHP json_decode() for arbitrary JSON I decided to run a quick benchmark on my 2015 MacBook Pro (Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz).

I used this ~25Mb JSON file and ran the attached two program under Go 1.22 and PHP 8.3.2, respectively.

My benchmarks were very unscientific but I was just looking for orders of magnitude.

Here are the results from three different runs, each:

Go (avg 30.82)

@mikeschinkel
mikeschinkel / find-in-set.php
Last active July 27, 2025 14:49
Adds FIND_IN_SET support as a comparison operator for WordPress meta_query. Include this in a plugin, in the theme's functions.php file, or as a separate file that is loaded using require() or include() before your call to WP_Query. As @Otto42 points out, you might not want to use this in a plugin that you plan to distribute given the WordPress'…
<?php
/**
* Class Add_Find_In_Set_Compare_To_Meta_Query
*/
class Add_Find_In_Set_Compare_To_Meta_Query {
/**
*
*/
function __construct() {
@mikeschinkel
mikeschinkel / mv-jetbrains-ide-project.sh
Created March 31, 2025 20:45
Bash script to rename the directory a JetBrain's IDE project is contained in (I got tired of waiting for JetBrains to add this obviously needed feature to their actual IDE!)
#!/usr/bin/env bash
set -euo pipefail
# Check if both arguments are provided
if [ $# -ne 2 ]; then
echo "Rename a Jetbrains IDE project"
echo "Usage:"
echo " $(basename "$0") <old_project_name> <new_project_name> [<projects_dir default=~/Projects>]"
exit 1
@mikeschinkel
mikeschinkel / _LOGGER_FOR_GOLANG.md
Last active March 30, 2025 06:10
Go logging package that leverages slog.Default() for creating package-level loggers (Proof-of-concept)

This solution is built on top of Go's log/slog package and leverages slog.Default(). To use it a developer should declare a package variable logger in every package that is part of their Go project that needs to perform logging (e.g. a package containing only type, var and/or const declarations would usually not need a logger.go file.)

Add a logger.go file to every packages and then add this line to the file, updating it with the package's name:

var logger = logging.NewPackageLogger("<package_name>")    

This uses a small logging package you can find below which has a Logger type simply to embed slog.Log. This allows adding extra methods beyond that provided by slog.Logger and to preprocess calls to *slog.Logger if we later find that to be needed.

@mikeschinkel
mikeschinkel / resume.json
Last active March 24, 2025 22:55
Mike Schinkel's resume — Last updated 2025-03-24 — Also see github.com/mikeschinkel/resume for more recent updates
{
"meta": {
"theme": "kendall"
},
"basics": {
"name": "Mike Schinkel",
"label": "Senior Engineer specializing in Go, OpenAPI, Kubernetes, AWS, and CI/CD",
"photo": "https://www.gravatar.com/avatar/c988a2da603a19e827a39ab4d9186909?s=200&r=pg&d=mm",
"summary": "I am looking a long-term contract role working to enhance software products where my unique set of Go development, OpenAPI, Kubernetes AWS, and CI/CD skills and experience can have a big impact. And I will be really excited if the project I get to work on is open source.",
"location": {