Skip to content

Instantly share code, notes, and snippets.

View james2doyle's full-sized avatar

James Doyle james2doyle

View GitHub Profile
@james2doyle
james2doyle / subl
Created August 12, 2026 21:51
Fix large fonts on GNOME desktop in Sublime Text 4
#!/bin/sh
# replaces what was originally in /usr/bin/subl
# change GDK_DPI_SCALE=0.9 based on how you want to scale. 1 is 100%
# you can then use a Linux preferences to change the "ui_scale" up to say 1.1 to even it out
exec env GDK_SCALE=1 GDK_DPI_SCALE=0.9 /opt/sublime_text/sublime_text "$@"
@james2doyle
james2doyle / maclike.json
Created August 8, 2026 23:42
Input-remapper-2 config for mac-like keyboard navigation. Ctrl is remapped to LeftMeta. Put in $XDG_CONFIG_HOME/input-remapper-2/presets/{YOUR_DEVICE}/Maclike.json
[
{
"input_combination": [
{"type": 1, "code": 125, "origin_hash": "4790f6e20b87c369dcfe985187897b13"},
{"type": 1, "code": 105, "origin_hash": "4790f6e20b87c369dcfe985187897b13"}
],
"target_uinput": "keyboard",
"output_symbol": "KEY_HOME",
"name": "Ctrl+Left (start of line)",
"mapping_type": "key_macro"
@james2doyle
james2doyle / slim-build.md
Created June 20, 2026 05:03
Opencode "slim-build" agent. Save to ~/.config/opencode/agents/slim-build.md

description: Efficient building system that efficiently makes changes to the code temperature: 0.2 permission: bash: allow edit: allow write: allow read: allow grep: allow glob: allow

@james2doyle
james2doyle / slim-plan.md
Last active June 20, 2026 05:07
Opencode "slim-plan" agent. Save to ~/.config/opencode/agents/slim-plan.md

description: Efficient planning system that gathers details and outlines technical design temperature: 0.2 permission: bash: ask edit: deny write: deny read: allow grep: allow glob: allow

@james2doyle
james2doyle / Dockerfile
Last active February 15, 2026 20:08
A dockerfile image that sets up Opencode with Oh-My-Opencode alongside Bun and PNPM
# Build the image with: docker build -t super-opencode .
# Run the container with: docker run -it --volume="$PWD:/app" --workdir="/app" super-opencode
# Use the official Node.js image based on Debian Bullseye (slim version for smaller size)
FROM node:24.13.1-bullseye-slim
# Set the working directory inside the container to /app
WORKDIR /app
# Install system dependencies required for building and running various tools
@james2doyle
james2doyle / alpine.extras.js
Last active December 24, 2025 17:15
A few magic properties and directives for Alpine.js
/**
* Alpine.js magic property to confirm a change.
*
* Usage: @click="$confirm('Are you sure?').then(copied = true)"
*
* @returns {(message: string) => Promise<void>} - A function that takes the text to display as an argument.
*/
Alpine.magic('confirm', () => {
return (message) => {
return new Promise((resolve, reject) => {
@james2doyle
james2doyle / sanity-rest-api-collection.json
Created December 5, 2025 18:32
Full collection for Sanity.io REST HTTP API including Query, Assets, and comprehensive Mutation/Patch examples.
{
"info": {
"_postman_id": "b3e3e3e3-3e3e-3e3e-3e3e-3e3e3e3e3e3e",
"name": "Sanity HTTP API (Complete + Patches)",
"description": "Full collection for Sanity.io HTTP API including Query, Assets, and comprehensive Mutation/Patch examples.",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "Query",
@james2doyle
james2doyle / generate-deep-slug-urls.groq
Created October 10, 2025 22:06
Generate nested URLs using Groq functions in Sanity
// since the argument variable can only be referenced once, we need this function repeated
fn ex::p($p) = $p->{"c":url.current};
fn ex::pp($p) = $p->{"c": ex::p(parentPage).c};
fn ex::ppp($p) = $p->{"c": ex::pp(parentPage).c};
// will output `level-4/level-3/level-2/level-1`
// usage: { "href": ex::slug(@) }
fn ex::slug($d) = $d{"slug":array::join(
array::compact([
ex::ppp(parentPage).c,
ex::pp(parentPage).c,
@james2doyle
james2doyle / minimal.css
Created October 7, 2025 16:24
Minimal amount of CSS for a plain HTML page to look good. From https://thecascade.dev/article/least-amount-of-css/
/* @see https://thecascade.dev/article/least-amount-of-css/ */
html {
color-scheme: light dark;
}
body {
font-family: system-ui;
font-size: 1.25rem;
line-height: 1.5;
}
@james2doyle
james2doyle / print-with-chrome.sh
Created October 1, 2025 16:13
An example of printing headless with Google Chrome from the CLI
/path/to/chrome --headless \
--disable-gpu \
--no-pdf-header-footer \
--hide-scrollbars \
--print-to-pdf-margins="0,0,0,0" \
--print-to-pdf \
--window-size=1280,720 \
https://example.com