Skip to content

Instantly share code, notes, and snippets.

View nedmas's full-sized avatar

Tom Densham nedmas

View GitHub Profile
@nedmas
nedmas / gist:1287451
Created October 14, 2011 15:40
Just a simple bash script for adding new sites on an apache server
#!/bin/bash
while getopts ":h:p:a:d:l:" opt; do
case $opt in
h)
HOST="$OPTARG"
;;
p)
PORT="$OPTARG"
;;
@nedmas
nedmas / .bash_profile
Created November 10, 2011 16:16
Mac OS X Bash Profile
export PATH=~/bin:$PATH
export CLICOLOR=1
export LSCOLORS='Axfxcxdxbxegedabagacad'
parse_git_branch ()
{
if git rev-parse --git-dir >/dev/null 2>&1
then
gitver=$(git branch 2>/dev/null| sed -n '/^\*/s/^\* //p')
else
@nedmas
nedmas / .gitconfig
Created November 10, 2011 16:18
Git Global Configuration
[user]
name = Tom Densham
email = [email protected]
[core]
quotepath = false
excludesfile = /Users/tomdensham/.gitignore
[mergetool]
keepBackup = true
[alias]
l50 = "!git log --abbrev-commit --date=short --pretty=format:'%x00%h%x00%cd%x00%s%x00%an%x00%d' | gawk -F '\\0' '{ printf \"%s\\033[31m%s\\033[0m \\033[32m%s\\033[0m %-50s \\033[30;1m%s\\033[0m\\033[33m%s\\n\", $1, $2, $3, gensub(/(.{49}).{2,}/, \"\\\\1…\",\"g\",$4), $5, $6 }' | less -R"
@nedmas
nedmas / .gitignore
Created November 10, 2011 16:18
Git Global Ignore List
.DS_Store
# Thumbnails
._*
# Files that might appear on external disk
.Spotlight-V100
.Trashes
# It's better to unpack these files and commit the raw source because
@nedmas
nedmas / gist:2708724
Created May 16, 2012 08:35
A simple script to create directory hierarchies
#!/bin/bash
CONFIGDIR="$HOME/.skeleton"
WORKINGDIR=$(pwd)
if [ $# -lt 1 ]
then
echo "Usage : $0 [pattern]"
exit
fi
@nedmas
nedmas / local.xml
Created May 30, 2012 13:58
Magento Snippet - Set the Catalog Product Grid column count
<?xml version="1.0" encoding="UTF-8"?>
<layout>
<catalog_category_default translate="label">
<reference name="content">
<block type="catalog/category_view" name="category.products" template="catalog/category/view.phtml">
<block type="catalog/product_list" name="product_list" template="catalog/product/list.phtml">
<action method="setColumnCount"><columns>4</columns></action>
</block>
</block>
</reference>
@nedmas
nedmas / Message.php
Created June 20, 2012 15:23
Message class for FuelPHP by Frank de Jonge (FrenkyNet)
<?php
abstract class Message
{
protected static $messages = array();
public static function get($key, $default = null)
{
$return = \Arr::get(static::$messages, $key, $default);
\Arr::delete(static::$messages, $key);
@nedmas
nedmas / gist:3054247
Created July 5, 2012 15:08
Sql script for removing all sales and customer data from a Magento site.
# Magento CE 1.4.1.1
# Be sure to replace "" with your table prefix
SET FOREIGN_KEY_CHECKS=0;
##############################
# SALES RELATED TABLES
##############################
TRUNCATE `sales_flat_creditmemo`;
TRUNCATE `sales_flat_creditmemo_comment`;
@nedmas
nedmas / gist:3060155
Created July 6, 2012 13:30
Script to force enable color prompt on Ubuntu and other Linux distros.
#!/bin/bash
# Get the path for the .bashrc file from the prompt or set it as being in the users home dir.
BASHRC="${1:=~/.bashrc}"
# Use sed to remove the comment from the force color line in the .bashrc file.
sed -i 's/#force_color_prompt=yes/force_color_prompt=yes/g' $BASHRC
# BONUS: Uncomment to change the default color of the prompt.
#sed -i 's/1;32m/1;31m/g'
@nedmas
nedmas / .gitignore
Created July 12, 2012 15:15
Git Ignore List for a Silverstripe 2.4 Install
assets/*
!assets/.htaccess
!assets/error-404.html
!assets/error-500.html
!assets/web.config
_ss_environment.php
tools/phing-metadata