Skip to content

Instantly share code, notes, and snippets.

@camwest
camwest / settings.json
Created July 1, 2025 14:50
Claude Code Hooks Configuration - PreToolUse and PostToolUse hooks setup
{
"hooks": {
"PreToolUse": [
{
"matcher": "Bash",
"hooks": [
{
"type": "command",
"command": "./scripts/claude-branch-protection.sh"
}
@camwest
camwest / claude-code-quality.sh
Last active July 1, 2025 15:12
Claude Code Hook: Code Quality Check - Runs TypeScript and linting after file edits
#!/bin/bash
# Claude Code Hook: Code Quality Check
# Runs TypeScript check and lint fix after file modifications
echo "🔍 Running code quality checks..."
# Run TypeScript check
echo " → Type checking..."
npx tsc --noEmit
@camwest
camwest / claude-branch-protection.sh
Last active July 1, 2025 15:12
Claude Code Hook: Branch Protection - Prevents direct commits to main branch
#!/bin/bash
# Claude Code Hook: Branch Protection
# Prevents direct commits/pushes to main branch
# Get the git command from Claude tool input
COMMAND=$(echo "$CLAUDE_TOOL_INPUT" | jq -r '.command')
# Check for dangerous git operations on main branch
if echo "$COMMAND" | grep -q -E 'git\s+(commit|push.*\smain|push.*origin\s+main)'; then
@camwest
camwest / claude-branch-protection.sh
Created July 1, 2025 14:49
Claude Code Hook: Branch Protection - Prevents direct commits to main branch
#!/bin/bash
# Claude Code Hook: Branch Protection
# Prevents direct commits/pushes to main branch
# Get the git command from Claude tool input
COMMAND=$(echo "$CLAUDE_TOOL_INPUT" | jq -r '.command')
# Check for dangerous git operations on main branch
if echo "$COMMAND" | grep -q 'git.*commit\|git.*push.*main'; then
@camwest
camwest / machine.js
Created August 26, 2020 20:28
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
// - XState (all XState exports)
@camwest
camwest / machine.js
Created August 21, 2020 14:28
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
// - XState (all XState exports)
@camwest
camwest / machine.js
Last active August 20, 2020 21:15
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
// - XState (all XState exports)
Pyramid
Core App
investing -> Investing
data vault -> Data Vault
rewards -> Rewards
profile -> Profile
Investing
Data Vault
R1
iOS App
Logged Out
create account -> Create Account
login -> Logged In
sign in with apple -> Accept Terms
Create Account
enter credentials -> Validate Email
Validate Email
enter correct token -> Accept Terms
@camwest
camwest / machine.js
Last active August 1, 2019 17:58
Generated by XState Viz: https://xstate.js.org/viz
// See https://xstate.js.org/viz/?gist=759a3ee0b7d85087b18be566a1f40224 for a visualization.
// It may need to be updated. To do so just copy & paste and remove the `export` keywords.
const States = {
START_EMAIL_AUTH: "START_EMAIL_AUTH",
LOGIN_OR_CREATE: "LOGIN_OR_CREATE",
LOGIN: "LOGIN",
LOGGED_OUT: "LOGGED_OUT",
CREATE_ACCOUNT: "CREATE_ACCOUNT",
ACCEPT_TERMS: "ACCEPT_TERMS",