Skip to content

Instantly share code, notes, and snippets.

View carltondickson's full-sized avatar
🏠
Working from home

Carlton carltondickson

🏠
Working from home
  • Carlton Dickson Development Ltd.
  • London
View GitHub Profile
@carltondickson
carltondickson / gist:27fc62d1725ec373678c
Created January 2, 2015 09:53
Get and track a new remote branch
git fetch
git branch --track branch-name origin/branch-name
# From http://stackoverflow.com/a/11262780/682754
@carltondickson
carltondickson / gist:1716a457a11fa5158860
Last active August 29, 2015 14:13
GIt prompt messages
# in-prompt git branch indicator
parse_git_branch() {
# ref http://pastie.textmate.org/170118
# ref http://www.bramschoenmakers.nl/en/node/511
# ref http://tldp.org/HOWTO/Bash-Prompt-HOWTO/x329.html
#also see http://henrik.nyh.se/2008/12/git-dirty-prompt
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/' -e 's/\(............\)..*/\1…/' -e 's/\(..*\)/[\1]/' -e 's/^\[master\]$/\x1b[41m&\x1b[0m/' -e 's/^\[test\]$/\x1b[45m&\x1b[0m/' -e 's/^\[demo\]$/\x1b[44m&\x1b[0m/'
}
PS1="\w \$(parse_git_branch)$ "
@carltondickson
carltondickson / gist:3f0dc856eebc7a76a8d3
Created January 19, 2015 16:59
git diff between two commits in same file
# https://stackoverflow.com/questions/3338126/git-how-to-diff-the-same-file-between-two-different-commits-on-the-same-branch/3338145#3338145
git diff old_commit_id..now_commit_id file.php
# Head request and show headers only
curl -I www.acooke.org
curl --head www.acooke.org
@carltondickson
carltondickson / gist:aa923e1c07f6023805f7
Created February 18, 2015 10:14
Doctrine - Reverse engineer single table
/** @var \Doctrine\DBAL\Connection $connection */
$config = $connection->getConfiguration();
// for excluding an specific table
$config->setFilterSchemaAssetsExpression('/^(?!table_name_to_exclude).*$/');
When we try to generate Entities from database, with:
$config->setFilterSchemaAssetsExpression('/^(recipes|ingredients).*$/');
# Source: https://coderwall.com/p/jofhdw/doctrine-tell-which-tables-to-work-with
@carltondickson
carltondickson / gist:dd291d5897d770c554c7
Last active August 29, 2015 14:15
Log MySQL output to file without restart - FILE and TABLE approach
# http://stackoverflow.com/a/20485975/682754
# Log to file
#### Turn on and configure
SET global log_output = 'FILE';
SET global general_log_file='/tmp/mysql_general.log';
SET global general_log = 1;
#### Turn off
@carltondickson
carltondickson / .bash_alias
Last active May 16, 2016 12:46
Bash aliases
# ALIASES
## APACHE
alias apache-restart='sudo service apache2 restart'
alias apache-reload='sudo service apache2 reload'
## PHP
alias cdd-command='/usr/bin/php /var/www/commands/app/app.php'
## GIT
@carltondickson
carltondickson / gist:28a90ccfed2f6b697aba
Created March 12, 2015 11:53
Undo commit and push to the wrong branch
# Credit to http://www.iarp.ca/hobby/computing/36-git-committed-and-pushed-to-the-incorrect-branch
# Ensure you're in the branch that you commited to by accident.
git checkout master
# Reset the branch back one commit.
git reset --soft HEAD^
# Stash the changes
git stash
@carltondickson
carltondickson / gist:b746545af495ecb91715
Last active October 15, 2015 08:50
On demand xdebug and profiling settings - Requires browser plugin "Xdebug helper"
zend_extension=xdebug.so
xdebug.default_enable=0
xdebug.idekey="PHPSTORM"
xdebug.remote_enable=1
xdebug.remote_connect_back=1
xdebug.remote_autostart=0
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
@carltondickson
carltondickson / gist:c4be6fe89197cc2c8c86
Created March 13, 2015 11:39
Turn on xdebug via the CLI
# Assuming the following xdebug.ini is used
zend_extension=xdebug.so
xdebug.default_enable=0
xdebug.idekey="PHPSTORM"
xdebug.remote_enable=1
xdebug.remote_connect_back=1
xdebug.remote_autostart=0
xdebug.remote_port=9000