Skip to content

Instantly share code, notes, and snippets.

View mkcny's full-sized avatar

Michael Cooney mkcny

View GitHub Profile
@mkcny
mkcny / vagrant-ssh.sh
Last active March 8, 2016 01:38
bash function to ssh to a vagrant box, starting the VM if necessary
alias vagrant-ssh='ssh -o ConnectTimeout=1 vagrant'
function v() {
vagrant-ssh $*
exit_code=$?
if [ $exit_code -eq 255 ]
then
vagrant up
vagrant-ssh $*
#!/bin/bash
# This is the wrong way!
set -e
php_files=$(git diff --cached --name-only --diff-filter=ACMRTUXB | grep "\.php$")
for file in $php_files
do
@mkcny
mkcny / gist:1503080
Created December 20, 2011 20:15
pre-commit hook to check for PHP syntax errors
for i in `git diff --cached --name-only | grep "\.php$"`
do
git show :$i | php -l > /dev/null 2>&1
if [ $? != 0 ]
then
echo "Syntax errors in "$i
echo "run 'git commit -n' to ignore this warning"
exit 1
fi
done