Skip to content

Instantly share code, notes, and snippets.

View ConorSheehan1's full-sized avatar

Conor Sheehan ConorSheehan1

View GitHub Profile
@ConorSheehan1
ConorSheehan1 / sublime_ruby_regexps.md
Last active March 29, 2019 14:26
regular expressions for updating ruby syntax (tested using sublime-text-3 replace function)
@ConorSheehan1
ConorSheehan1 / pre-commit
Last active April 25, 2018 11:06
before commit, check if puppet files have valid syntax
#!/bin/sh
# this hook aborts commits which contain invalid puppet syntax
errors=0
# get all files in commit, use awk to get file name only, use grep to get puppet files only
files=$(git diff --cached --name-status | awk '$1 != "D" { print $2 }' | grep "\.pp")
# if you are committing .pp files
if [[ "$files" ]]; then
@ConorSheehan1
ConorSheehan1 / commit-msg
Last active April 25, 2018 11:06
check commit message contains link to trello card
#!/usr/bin/env bash
# this hook aborts commits which do not include a link to trello
INPUT_FILE=$1
START_LINE=`head -n1 $INPUT_FILE`
PATTERN="https:\/\/trello\.com\/"
if ! [[ "$START_LINE" =~ $PATTERN ]]; then
echo "Commit messages should include a link to the related trello card."
echo "To override this check add the --no-verify flag "
exit 1