Skip to content

Instantly share code, notes, and snippets.

@jiskanulo
jiskanulo / pre-commit
Last active August 29, 2015 14:17
Git pre-commit hook: php syntax check
#!/bin/bash
CURRENT_DIR="$(pwd)"
HAS_ERROR=""
for file in $(git status -s | grep -E '^[AMU].*\.php$' | awk '{print $2}' | sort | uniq); do
if [ "$(php -l $(pwd)/$file 2>&1 | grep 'Parse error')" != "" ]; then
HAS_ERROR="1"
echo "Syntax errors found: $file" >&2
fi
@jiskanulo
jiskanulo / phpinfo.php
Last active April 12, 2016 11:15
phpinfo
<?php
// validate client ip address
$allow_ips = [
'::1',
'10.0.2.2',
'127.0.0.1',
'192.168.33.1',
];
@jiskanulo
jiskanulo / gist:a11987953d743b44da1b
Created March 20, 2015 08:49
What will be displayed?
<?php
$key = 0;
switch($key) {
case 'one': echo 'one'; break;
case 'two': echo 'two'; break;
case 'three': echo 'tree'; break;
default: echo 'other'; break;
}
LANG=en_US.UTF-8
LC_CTYPE=en_US.UTF-8
USER=vagrant
LOGNAME=vagrant
HOME=/home/vagrant
PATH=/usr/local/bin:/usr/local/sbin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
MAIL=/var/mail/vagrant
SHELL=/usr/bin/zsh
SSH_CLIENT=10.0.2.2 50247 22
SSH_CONNECTION=10.0.2.2 50247 10.0.2.15 22
noaliases off
allexport off
noalwayslastprompt off
alwaystoend on
noappendhistory off
autocd on
autocontinue off
noautolist off
noautomenu off
autonamedirs on
1='cd +1'
2='cd +2'
3='cd +3'
4='cd +4'
5='cd +5'
6='cd +6'
7='cd +7'
8='cd +8'
9='cd +9'
_=sudo
@jiskanulo
jiskanulo / my-env.plugin.zsh
Created May 9, 2014 02:04
oh-my-zsh plugin for my env file loader
function import_setting()
{
[ -f $1 ] && . $1
}
for f in $HOME/.zsh.d/* ; do
import_setting $f
done
if [ $commands[brew] ]; then
@jiskanulo
jiskanulo / install_oh_my_zsh_plugins.sh
Last active August 29, 2015 13:59
install my custom oh-my-zsh plugins
#!/bin/bash
function git_clone()
{
[ -z "$ZSH" ] && return
url=https://gist.github.com/$1.git
name=$2
path=$ZSH/custom/plugins/$name
@jiskanulo
jiskanulo / tig-completion.bash
Created April 17, 2014 04:53
tig oh-my-zsh plugin
##
# bash completion support for tig
#
# Copyright (C) 2007-2010 Jonas fonseca
# Copyright (C) 2006,2007 Shawn Pearce
#
# Based git's git-completion.sh: http://repo.or.cz/w/git/fastimport.git
#
# The contained completion routines provide support for completing:
#
@jiskanulo
jiskanulo / cdd
Created April 17, 2014 04:49
cdd oh-my-zsh plugin
# vim: ft=sh
# https://github.com/m4i/cdd
if [ -z "$CDD_FILE" ]; then
CDD_FILE=~/.cdd
fi
export CDD_FILE
if [ -z "$CDD_AUTO" ]; then
CDD_AUTO=1