Skip to content

Instantly share code, notes, and snippets.

Eric Van Johnson ericvanjohnson

Block or report user

Report or block ericvanjohnson

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:dc2694e9a3074062eea0e2b5d7f024a3
<?php
/**
* Content from http://en.wikipedia.org/wiki/List_of_HTTP_status_codes
**/
return array(
100 => 'Continue',
101 => 'Switching Protocols',
102 => 'Processing', // WebDAV; RFC 2518
200 => 'OK',
@ericvanjohnson
ericvanjohnson / HeyFocus.sh
Created Nov 22, 2017
Launch focus using ZSH
View HeyFocus.sh
#!/bin/bash
# Started using Focus https://heyfocus.com/
# But I wanted to launch it from the command line
# They had bash commands but I use ZSH so I wrote this script
# It lauches with the BASH shell and allows optional times to pass
open focus://focus?minutes=${1:-15}
# Make file executable
@ericvanjohnson
ericvanjohnson / replace_php_short_tags.sh
Created Sep 21, 2017 — forked from ma2thieu/replace_php_short_tags.sh
replace php short tags (<?) with long one (<?php)
View replace_php_short_tags.sh
#!/bin/bash
# first short tags with something that is not a letter after
find . -iname "*.php" -print0 | xargs -0 -I{} sed -i -r 's/(<\?)([^a-zA-Z])/\1php\2/g' '{}'
# then short tags at end of line
find . -iname "*.php" -print0 | xargs -0 -I{} sed -i -r 's/<\?$/<\?php/g' '{}'
@ericvanjohnson
ericvanjohnson / CakePHP-Presentation-Notes.md
Last active Jun 19, 2017
Notes from CakePHP Lightning Talk at SDPHP June 14, 2017
View CakePHP-Presentation-Notes.md

Create New Cake Project

composer create-project --prefer-dist cakephp/app bookmarker

Start CakePHP Internal Server

bin/cake server
@ericvanjohnson
ericvanjohnson / nginx.conf
Created Mar 24, 2017 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
View nginx.conf
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
View ideavimrc
let mapleader = ','
set ignorecase smartcase
"set hlsearch
set showmode
set scrolloff=5
set history=1000
set surround
set incsearch
set relativenumber
View shocm.md

My spot

Latest Shows

PHPUgly - Episode 44

recorded January 5th, 2017

Sound Cloud | Video

Topics

@ericvanjohnson
ericvanjohnson / php pre-commit hook with linting
Last active Feb 14, 2016 — forked from johncongdon/php
php linting pre-commit hook
View php pre-commit hook with linting
#!/usr/local/bin/php
<?php
# PHP LINTING
$output = array();
$return = 0;
exec('git rev-parse --verify HEAD 2> /dev/null', $output, $return);
$against = $return == 0 ? 'HEAD' : '4b825dc642cb6eb9a060e54bf8d69288fbee4904';
exec("git diff-index --diff-filter=ACMRTUXB --cached --name-only {$against}", $output);
@ericvanjohnson
ericvanjohnson / pre-commit
Last active Feb 14, 2016 — forked from ronanguilloux/pre-commit
phplint + phpcs + php-cs-fixer PHP-related pre-commit git hook (needs to add squizlabs/php_codesniffer & fabpot/php-cs-fixer to your composer.json)
View pre-commit
#!/bin/sh
# @source: https://gist.github.com/ronanguilloux/11f6a788358577474ab4
# @link http://tech.zumba.com/2014/04/14/control-code-quality/
PROJECT=`php -r "echo dirname(dirname(dirname(realpath('$0'))));"`
STAGED_FILES_CMD=`git diff --cached --name-only --diff-filter=ACMR HEAD | grep \\\\.php`
# Determine if a file list is passed
@ericvanjohnson
ericvanjohnson / .bashrc
Created Jan 13, 2016 — forked from Kindari/.bashrc
Forward Prompt to remote servers
View .bashrc
SSH_FORWARD_PROMPT=true
export PS1="\n[\[\e[32m\]\t\[\e[m\] \[\e[31m\]\u\[\e[m\]@\[\e[36m\]\H\[\e[m\]][\[\e[32m\]\$?\[\e[m\]]\[\e[33m\]\`/usr/sbin/getenforce\`\[\e[m\]\n\w:\!> "
function ssh_forward_prompt()
{
env ssh -A "$@" -t "PS1='$PS1' bash -l"
}
if [ "$SSH_FORWARD_PROMPT" = true ] ; then
You can’t perform that action at this time.