Skip to content

Instantly share code, notes, and snippets.

View davidianbonner's full-sized avatar

David Ian Bonner davidianbonner

  • Glasgow, UK
View GitHub Profile
@davidianbonner
davidianbonner / EmptyIfValidation.php
Created July 1, 2017 12:26
Laravel empty_if (empty_if) validation
<?php
use Illuminate\Support\Arr;
use Illuminate\Support\Facades\Validator;
/*
* Custom rule
*/
Validator::extend('empty_if', function ($attribute, $value, $parameters, $validator) {
// Get the value of the specified field to check against
# Capistrano Laravel 4 Deployment Tasks
# Watts Martin (layotl at gmail com)
# https://gist.github.com/chipotle/5506641
# updated 14-Aug-2013
# Assumptions:
#
# - You are using a .gitignore similar to Laravel's default, so your
# vendor directory and composer(.phar) are *not* under version control
# - Composer is installed as an executable at /usr/local/bin/composer
#!/usr/bin/env bash
if [ $EUID -ne 0 ]; then
echo "You must be root: \"sudo ngxvhost\""
exit 1
fi
# May need to run this as sudo!
# I have it in /usr/local/bin and run command 'ngxvhost' from anywhere, using sudo.
@davidianbonner
davidianbonner / AutoLaunch.scpt
Created May 6, 2013 10:59
iTerm2 Launch Script to open three sessions and run initial commands
-- iTerm2 Launch Script
-- Location: ~/Library/Application\ Support/iTerm
launch "iTerm"
tell application "iTerm"
activate
-- Unfortunately we need this to fix a bug in which
-- an initial window session always opened
require 'formula'
class TmuxForIterm2 < Formula
url 'http://iterm2.googlecode.com/files/tmux-for-iTerm2-20130319.tar.gz'
#SHA1 'f14a0bad6991b9e3380d5c3a6057e09f62597d1f'
homepage 'http://code.google.com/p/iterm2/wiki/TmuxIntegration'
depends_on 'libevent'
def install