Skip to content

Instantly share code, notes, and snippets.

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

Tim Millwood timmillwood

🏠
Working from home
View GitHub Profile
@timmillwood
timmillwood / gist:3932121
Created October 22, 2012 15:38
sinatra redirect
before do
if ['www.millwoodonline.com', 'millwoodonline.com', 'millwoodonline.co.uk'].include? request.host
redirect "http://www.millwoodonline.co.uk" + request.path
end
end
@timmillwood
timmillwood / dcmc-git.sh
Created October 11, 2012 09:58
script to migrate DC git repo to MC
#!/bin/bash
dc_git="$1"
mc_git="$2"
git clone --mirror ${dc_git} dc
cd dc
git remote add mc ${mc_git}
git push --mirror mc
cd ..
@timmillwood
timmillwood / drupal-quick-dump.sh
Last active October 28, 2019 07:49 — forked from webbj74/drupal-quick-dump.sh
Script to dump Drupal database structure, but exclude data from massive/unneeded tables.
#!/bin/bash
# usage: drupal-quick-dump user host database
USER="$1"
HOST="$2"
DB="$3"
DATE=`date +%Y%m%d`
# Get User Password
echo "Please provide the password for ${USER} on db ${DB} hosted at ${HOST}:"
@timmillwood
timmillwood / gist:3775799
Created September 24, 2012 12:50
PHP for Developers - Exercise: Creating Classes
// index.php
<?php
function __autoload($classname) {
$filename = "./". $classname .".php";
include_once($filename);
}
$article = new Article('My Article', 'This is my article\'s body, it even escapes <strong>HTML</strong>');
@timmillwood
timmillwood / bashrc
Created July 29, 2012 21:16
function for opening files and folders in geany
function geany {
if [ -d $1 ]; then
cd $1;
for FILE in `dir -d *`; do
(/usr/bin/geany $FILE &);
done
else
for ARG in "$@"
do
(/usr/bin/geany $ARG &);