Skip to content

Instantly share code, notes, and snippets.

View andrewwheal's full-sized avatar

Andrew Wheal andrewwheal

  • Cognitran Ltd
  • Rugby, Warwickshire
  • 01:41 (UTC)
View GitHub Profile
@andrewwheal
andrewwheal / vhosts.conf
Last active December 25, 2015 12:19
Nginx vhost conf snippet for FuelPHP Example only, not guaranteed to work exactly as is.
server {
listen 80;
server_name example.com;
root /path/to/public;
location / {
try_files $uri /index.php?uri=$uri;
}
@andrewwheal
andrewwheal / .gitconfig
Created October 15, 2013 16:52
Git word diff alias
wdiff = diff --color-words --word-diff-regex='[^[:space:]\\(\\)/<>{}\",_-]+'
@andrewwheal
andrewwheal / 001_db_stuff.php
Last active August 29, 2015 13:56
FuelPHP v1 Migration Examples/Suggestions
<?php
namespace Fuel\Migrations;
class Db_Stuff
{
public function up()
{
// Try/catch so that we can provide a nicer error message and gracefully fall out of the migration
@andrewwheal
andrewwheal / post-receive
Last active August 29, 2015 13:56
Git post-receive hook
if [ $(basename $(pwd)) == ".git" ]; then
cd ..
export GIT_DIR=.git
fi
git checkout $(git rev-parse master)
git reset --hard HEAD --
git submodule update --init --recursive
ant
* {
-webkit-filter: grayscale(100%);
-moz-filter: grayscale(100%);
-ms-filter: grayscale(100%);
-o-filter: grayscale(100%);
filter: grayscale(100%);
filter: url(grayscale.svg); /* Firefox 4+ */
filter: gray; /* IE 6-9 */
}
@andrewwheal
andrewwheal / git-commands.md
Last active July 10, 2024 14:00
git-commands

moving branches

  • git branch -f <branch> [<destination>]
  • git hoist <branch> [<destination>]
  • git ff [<destination>]
  • git catchup [<branch>] [<remote>]

updating submodules

  • git subup

diff all the things

@andrewwheal
andrewwheal / Fuel CRUD Controller.php
Created September 2, 2014 11:48
PhpStorm File Templates
<?php
#if (${NAMESPACE})
namespace ${NAMESPACE};
#end
class Controller_${NAME} extends \Controller_Template {
public function action_index() {
@andrewwheal
andrewwheal / JavaScript.xml
Created September 2, 2014 11:50
PhpStorm Live Tempates
<?xml version="1.0" encoding="UTF-8"?>
<templateSet group="JavaScript">
<template name="ready" value="$(function() {&#10;&#9;$END$&#10;})" description="HOJS says do this" toReformat="true" toShortenFQNames="true">
<context>
<option name="HTML_TEXT" value="false" />
<option name="HTML" value="false" />
<option name="XSL_TEXT" value="false" />
<option name="XML" value="false" />
<option name="CSS_PROPERTY_VALUE" value="false" />
<option name="CSS_DECLARATION_BLOCK" value="false" />
@andrewwheal
andrewwheal / cdup.func.sh
Created September 16, 2014 15:29
cdup bash function
cdup() {
p=${1}
if [[ $p = -* ]]; then
c="cd "
while [[ $p -lt 0 ]]; do
c=$c"../"
let p=p+1
done
$c
else
@andrewwheal
andrewwheal / git-tidy-branches
Created December 17, 2014 11:02
git tidy-branches
#!/bin/bash
KEEP=$@
branches=$(git branch | grep -v "*" | grep -v "detached" | grep -v "no branch")
if [ "$KEEP" != "" ]; then
for notthis in $KEEP; do
branches=$(echo "$branches" | grep -vE "$notthis")
done