Skip to content

Instantly share code, notes, and snippets.

@simonsmith
simonsmith / harness.md
Last active August 28, 2026 10:36
LLM model rules - one for the web ui and one for the harness (codex, claude code)

Global working guidelines

Communication

  • Use plain, direct language in explanations, questions, updates, and handoffs.
  • Prefer familiar words. Briefly define technical terms inline on first use.
  • Lead with the answer or action. No preamble, no restating the request.
  • Do not use validation phrases, praise, or agreement-as-filler in any phrasing. The point is substance, not enumerated banned strings.
  • Do not use em dashes or exclamation marks anywhere, including code comments, commit messages, and PR text.
  • No trailing questions, summaries, or offers of more help.
@simonsmith
simonsmith / user.js
Created December 17, 2025 15:20
User.js for Firefox - based on Betterfox
//
/* You may copy+paste this file and use it as it is.
*
* If you make changes to your about:config while the program is running, the
* changes will be overwritten by the user.js when the application restarts.
*
* To make lasting changes to preferences, you will have to edit the user.js.
*/
/****************************************************************************
import {useEffect, useRef, RefObject} from 'react';
import {detectDevice} from '../../Atoms';
const styles = {
'touch-action': 'none',
overflow: 'hidden',
'overscroll-behavior': 'none',
};
const iosStyles = {
@simonsmith
simonsmith / git-info.sh
Created July 4, 2025 13:33
Output Git information into JSON
#!/bin/bash
# Function to escape JSON strings
escape_json() {
echo "$1" | sed 's/\\/\\\\/g; s/"/\\"/g' | sed ':a;N;$!ba;s/\n/\\n/g'
}
# Get git information
BRANCH=$(git symbolic-ref HEAD 2>/dev/null | sed 's/refs\/heads\///' || echo "unknown")
COMMIT_ID=$(git rev-parse HEAD 2>/dev/null || echo "unknown")
@simonsmith
simonsmith / retry.test.ts
Last active January 17, 2024 22:22
Retries a Promise until it resolves or the retries are exceeded
import {retry} from './retry';
jest.spyOn(global, 'setTimeout');
test('retries a function and increases the backoff for each failure', async () => {
const rejectingFunc = jest.fn(
(() => {
let failCount = 5;
return () => {
if (failCount === 0) {
import {useState} from 'react';
export const requestStatus = {
IDLE: 'IDLE',
PENDING: 'PENDING',
REJECTED: 'REJECTED',
FULFILLED: 'FULFILLED',
};
export const useRequestStatus = () => {
@simonsmith
simonsmith / fetchScript.ts
Last active December 2, 2025 13:41
Simple script loader
const scripts = new Map<string, Promise<unknown>>();
export function fetchScript(
src: string,
additionalScriptAttrs: Record<string, string> = {}
): Promise<unknown> {
if (scripts.has(src)) {
// TypeScript cannot narrow down type with `has`
// https://github.com/microsoft/TypeScript/issues/13086
return scripts.get(src) as Promise<unknown>;
const tape = require('tape');
const test = require('tape-css')(tape);
const h = require('hyperscript');
const getStyle = require('computed-style');
const $ = selector => document.querySelector(selector);
const styles = require('./my-component.css');
const dom = () => (
h('div.MyComponent',
@simonsmith
simonsmith / example.js
Created March 16, 2015 00:23
Compiling SUIT with gulp and postcss
var gulp = require('gulp');
var bemLinter = require('postcss-bem-linter');
var atImport = require('postcss-import');
var cssnext = require('cssnext');
var postcss = require('gulp-postcss');
var concat = require('gulp-concat');
var notify = require('gulp-notify');
var stylus = require('gulp-stylus');
gulp.task('css', function() {