putnam hill moments a place for my stuff

pre-commit

a pre-commit git hook to ensure html files being committed do not contain localhost links
#!/usr/bin/env bash

# A hook script to verify what is about to be committed. Called by "git commit"
# with no arguments. The hook should exit with non-zero status after issuing an
# appropriate message if it wants to stop the commit. To learn more about this
# hook, see pre-commit.sample

# check for rendered html files have been served locally
while read -r file; do
	egrep -iq '\bhttps?://(localhost|127\.0\.0\.1)\b' "$file" && {
		# run again with --color to show the local links
		egrep -Hi --color '\bhttps?://(localhost|127\.0\.0\.1)\b' "$file"
		echo 'localhost ref(s) detected, try jekyll build'
		exit 1
	}
done < <(git diff --name-only --cached --diff-filter=ACMR '*.html')
exit 0