Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
# Git Worktree Setup Script for Conductor
# Sets up a new git workspace for the askyourteam repo (https://github.com/askyourteam-nz/askyourteam)
# under Conductor (https://docs.conductor.build/).
# This script should be run from within a new git worktree directory
# It symlinks necessary files and directories from the main worktree
# This allows us to use git worktrees, sharing the folders from the main directory that
# are not under version control (e.g. node_modules).
@jcdarwin
jcdarwin / list-review-comments.md
Created July 29, 2025 05:03
Claude Code custom command: List PR review comments

List review comments for the current branch's PR

Find review comments for a specific user on the current branch's PR.

Usage

/ayt/list-review-comments [username]

If no username is provided, defaults to "jcdarwin".

@jcdarwin
jcdarwin / gtm-inline-script-csp-hash.md
Last active March 30, 2025 08:52
How to generate the CSP hash for the script loaded by https://www.googletagmanager.com/gtm.js?id=GTM-KSNK298

What is this?

This is how to generate a hash for use in a script-src CSP header

Why do we need this?

When https://www.googletagmanager.com/gtm.js?id=GTM-KSNK298 loads an inline script, it doesn't correctly include a nonce on the inline script, and so we get a CSP violation and the inline script cannot run.

Hence we need to generate a hash of the inline script and include it in our script-src CSP header.

@jcdarwin
jcdarwin / .vim
Created May 14, 2016 05:21
Our .vim file
" Use Vundle for plugin management
" https://github.com/VundleVim/Vundle.vim
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
@jcdarwin
jcdarwin / .extra
Last active May 14, 2016 06:05
Our .extra file, used with mathiasbynens dotfiles: https://github.com/mathiasbynens/dotfiles
#####################################################
# Paths
#####################################################
# Add paths for epub_tools
export PATH=$PATH:/scripts/epub_tools:/scripts/epub_tools/epub_tools:/scripts/epub_tools/epubcheck:/scripts/epub_tools/epubify:/scripts/epub_tools/epubify_toc:/scripts/epub_tools/epubinfo:/scripts/epub_tools/generate_ncx:/scripts/epub_tools/kindlegen.mac:/scripts/epub_tools/kindlestrip:/scripts/epub_tools/manifester:/scripts/epub_tools/mobi_unpack:/scripts/epub_tools/mobify:/scripts/epub_tools/mobify_toc:/scripts/epub_tools/sequence_ncx
# Add paths for PHP ind PEAR in AMPPs
export PATH=/Applications/AMPPS/php/lib/pear:$PATH
export PATH=/Applications/AMPPS/php/bin:$PATH
@jcdarwin
jcdarwin / Vagrantfile
Created February 28, 2016 08:59
Vagrant file for installing Dokku on an EC2 instance
Vagrant::configure('2') do |config|
config.vm.define :dokku, autostart: false do |box|
box.vm.box = 'trusty'
box.vm.box_url = 'https://github.com/mitchellh/vagrant-aws/raw/master/dummy.box'
box.vm.hostname = 'dokku.me'
box.vm.provider :aws do |aws, override|
aws.access_key_id = ENV['AWS_ACCESS_KEY_ID']
aws.secret_access_key = ENV['AWS_SECRET_ACCESS_KEY']
aws.keypair_name = 'aws'
@jcdarwin
jcdarwin / New Mac README.md
Last active December 11, 2015 07:01
A README.md file describing how we set up our environment on a new Mac.

What is this?

This is a description of how we've setup our home directory on this machine.

Dotfiles

We use Mathias Bynen's dotfiles to give us a number of default settings.

@jcdarwin
jcdarwin / microsoft word find and replace
Last active August 29, 2015 14:24
Find and replace in Microsoft Word, using wildcards (Word's form of regular expressions), to join lines with a lowercase character either side of the line break
Find and replace in Microsoft Word, using wildcards (Word's form of regular expressions), to find something like:
going
home
to
going home
In the Find box:
@jcdarwin
jcdarwin / analytics.listener.bookmarklet
Last active August 29, 2015 14:21
Bookmarklet to listen for 'analytics' events and report them to the console
// Bookmarklet to listen for 'analytics' events and report them to the console.
// Created with http://chriszarate.github.io/bookmarkleter/
<a href="javascript:void%20function(){jQuery%26%26jQuery(document).bind(%22analytics%22,function(n){console.log('I%20just%20saw%20an%20%22analytics%20event:%20%22',n)})}();">Drag this link to your browser bookmarks bar</a>
@jcdarwin
jcdarwin / inline_svg_image
Created March 22, 2015 22:26
A function to create SVG data urls for Ruby SASS
# The following goes in your config.rb
module Sass::Script::Functions
def inline_svg_image(path)
real_path = File.join(Compass.configuration.images_path, path.value)
svg = data(real_path)
encoded_svg = CGI::escape(svg).gsub('+', '%20')
data_url = "url('data:image/svg+xml;charset=utf-8," + encoded_svg + "')"
Sass::Script::String.new(data_url)
end