Skip to content

Instantly share code, notes, and snippets.

View tomshaw's full-sized avatar
🎯
Focusing

Tom Shaw tomshaw

🎯
Focusing
View GitHub Profile
@RickMcKay777
RickMcKay777 / statusline.sh
Created June 23, 2026 17:01
Claude Status Bar
#!/bin/bash
# Claude Code custom status line — two lines:
# Line 1: folder + full path + git branch (if in a repo) + [model ctx:%] (left)
# Line 2: 5-hour and 7-day usage with color-coded bars + reset countdowns (right-aligned)
#
# Reads the JSON Claude Code pipes to it on stdin. Requires: jq, GNU sed, wc, date.
# Right-alignment uses the COLUMNS env var (Claude Code sets it on v2.1.153+).
#
# Install:
# 1. Save this file (e.g. ~/.claude/statusline.sh)
@disler
disler / README.md
Last active June 22, 2026 14:35
Four Level Framework for Prompt Engineering
PS1='\[\033]0;WSL2 Bash\W\007\]' # set window title
PS1="$PS1"'\n' # new line
PS1="$PS1"'\[\033[36m\]' # change to green
PS1="$PS1"'bash@bexgboost ' # user@host<space>
PS1="$PS1"'\[\033[31m\]' # change to brownish yellow
PS1="$PS1"'\W' # current working directory
source /usr/lib/git-core/git-sh-prompt
export PS1="${debian_chroot:+($debian_chroot)}\[\033[01;36m\]\u:\[\033[01;31m\]\w\[\033[33m\]\$(__git_ps1)\[\033[33m\]"
@tomshaw
tomshaw / content.js
Created September 26, 2019 11:01
Chrome extension scan web page and highlight key words.
// Thoroughly untested.
let searchTerms = ['law', 'software', 'news', 'health'];
let elems = document.querySelectorAll("h1, h2, h3, h4, h5, h6, li, p, a")
for (let i = 0, total = elems.length; i < total; i++) {
let element = elems[i];
if (element && element.innerText) {
let innerText = element.innerText;
for (let j = 0; j < searchTerms.length; j++) {
@bradtraversy
bradtraversy / docker-help.md
Last active June 1, 2026 10:57
Docker Commands, Help & Tips

Docker Commands, Help & Tips

Show commands & management commands

$ docker

Docker version info

/*
Problem:
['Tokyo', 'London', 'Rome', 'Donlon', 'Kyoto', 'Paris']
// YOUR ALGORITHM
'use strict';
// Dependencies
const gcloud = require('google-cloud', {
projectId: 'sara-bigquery',
keyfileName: 'keyfile.json'
});
const vision = gcloud.vision();
const fs = require('fs');
const async = require('async');
@ljharb
ljharb / array_iteration_thoughts.md
Last active June 8, 2026 11:52
Array iteration methods summarized

Array Iteration

https://gist.github.com/ljharb/58faf1cfcb4e6808f74aae4ef7944cff

While attempting to explain JavaScript's reduce method on arrays, conceptually, I came up with the following - hopefully it's helpful; happy to tweak it if anyone has suggestions.

Intro

JavaScript Arrays have lots of built in methods on their prototype. Some of them mutate - ie, they change the underlying array in-place. Luckily, most of them do not - they instead return an entirely distinct array. Since arrays are conceptually a contiguous list of items, it helps code clarity and maintainability a lot to be able to operate on them in a "functional" way. (I'll also insist on referring to an array as a "list" - although in some languages, List is a native data type, in JS and this post, I'm referring to the concept. Everywhere I use the word "list" you can assume I'm talking about a JS Array) This means, to perform a single operation on the list as a whole ("atomically"), and to return a new list - thus making it mu

@markhowellsmead
markhowellsmead / css-mixblendmode.js
Created September 28, 2016 14:35
Detect browser support for CSS' mix-blend-mode using JavaScript
if (typeof window.getComputedStyle(document.body).mixBlendMode === 'undefined') {
document.documentElement.className += " mix-blend-mode-no";
}
@tomshaw
tomshaw / Select.js
Created July 10, 2016 23:41
Basic React Select
"use strict";
var React = require('react');
var Select = React.createClass({
propTypes: {
name: React.PropTypes.string.isRequired,
label: React.PropTypes.string.isRequired,
onChange: React.PropTypes.func.isRequired,