Skip to content

Instantly share code, notes, and snippets.

View wesolowski's full-sized avatar
😄
The future starts today, not tomorrow.

Rafał Wesołowski wesolowski

😄
The future starts today, not tomorrow.
View GitHub Profile
<?php
$ip = (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR'];
if($ip === '###IP###') {
dump(__FUNCTION__ .' / '. __FILE__ .' / '. __LINE__);
}
@wesolowski
wesolowski / pre-commit
Created May 23, 2014 10:58
Git Hook | Pre Commit - PHP Lint (Smoke Test)
#!/bin/bash
git diff --cached --name-status --diff-filter=ACMR | while read STATUS FILE; do
if [[ "$FILE" =~ ^.+(php|inc)$ ]]; then
php -l "$FILE" 1> /dev/null
if [ $? -ne 0 ]; then
echo "Aborting commit due to files with syntax errors" >&2
exit 1
fi
fi
@wesolowski
wesolowski / .bashrc
Created April 22, 2014 07:40
My bashrc file
# Configure colors, if available.
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
c_reset='\[\e[0m\]'
c_user='\[\e[1;33m\]'
c_path='\[\e[0;33m\]'
c_git_cleancleann='\[\e[0;36m\]'
c_git_dirty='\[\e[0;35m\]'
else
c_reset=
c_user=