Skip to content

Instantly share code, notes, and snippets.

View faceleg's full-sized avatar

Michael Robinson faceleg

  • Auckland, New Zealand
View GitHub Profile
app.run([
function() {
/**
* Cause a full page load on every route change.
*/
$rootScope.$on('$locationChangeStart', function($event, changeTo, changeFrom) {
if (changeTo == changeFrom) {
return;
}
@faceleg
faceleg / .gitconfig
Created August 22, 2013 03:08
Git config colours
[color]
ui = auto
[color "branch"]
current = yellow reverse
local = yellow
remote = green
[color "diff"]
" Use Vim settings, rather then Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
set nocompatible
" NeoBundleInitialisation {{{
if has('vim_starting')
set runtimepath+=~/.vim/bundle/neobundle.vim/
endif
call neobundle#rc(expand('~/.vim/bundle/'))
@faceleg
faceleg / dump_db.sh
Last active May 4, 2016 22:32
Dump tables, triggers and routines to separate files
#!/bin/bash
# MySQL executables
MYSQL="/usr/bin/mysql"
MYSQLDUMP="/usr/bin/mysqldump"
# Other executables
GZIP="$(which gzip)"
# Validate arguments
@faceleg
faceleg / largest_files.sh
Created May 13, 2013 22:21
Find largest files or directories in the current directory. Warning: this command can render the machine unresponsive while processing.
for X in $(du -s * | sort -nr | cut -f 2); do du -hs $X ; done | head -n 20
@faceleg
faceleg / convert_db_name.sh
Created May 13, 2013 21:32
Export a database and change the name used in all tables, triggers and routines
#!/bin/bash
if [ $# != 4 ]; then
echo "Usage: $0 <database_name> <new_database_name> <mysql_username> <mysql_password>"
exit 1;
fi
DATABASE_NAME=$1
NEW_DATABASE_NAME=$2
USERNAME=$3
PASSWORD=$4
HOMEBREW_MAKE_JOBS=1 VERBOSE=1 brew install ekg2 2>&1 ⏎
==> Downloading http://pl.ekg2.org/ekg2-0.3.1.tar.gz
Already downloaded: /Library/Caches/Homebrew/ekg2-0.3.1.tar.gz
tar xf /Library/Caches/Homebrew/ekg2-0.3.1.tar.gz
==> ./configure --disable-debug --disable-dependency-tracking --prefix=/usr/local/Cellar/ekg2/0.3.1 --without-python --without-perl --with-readline=/usr/local/Cellar/readline/6.2.4 --without-gtk --enable-unicode false
./configure --disable-debug --disable-dependency-tracking --prefix=/usr/local/Cellar/ekg2/0.3.1 --without-python --without-perl --with-readline=/usr/local/Cellar/readline/6.2.4 --without-gtk --enable-unicode false
configure: WARNING: you should use --build, --host, --target
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-saf
@faceleg
faceleg / mod_pagespeed
Last active December 15, 2015 12:09
Example mod_pagespeed configuration
ModPagespeed on
AddOutputFilterByType MOD_PAGESPEED_OUTPUT_FILTER text/html
ModPagespeedFileCachePath "/var/mod_pagespeed/www.website.com/cache/"
ModPagespeedGeneratedFilePrefix "/var/mod_pagespeed/www.website.com/cache/"
ModPagespeedEnableFilters combine_css,rewrite_css,inline_css
ModPagespeedEnableFilters combine_javascript,rewrite_javascript,inline_javascript
ModPagespeedEnableFilters extend_cache
ModPagespeedEnableFilters inline_images,recompress_images,resize_images
@faceleg
faceleg / countries-alphabetised.js
Created February 3, 2013 20:21
Alphabetised array of countries
[
'Afghanistan', 'Albania', 'Algeria', 'American Samoa' , 'Andorra', 'Angola', 'Anguilla',
'Antarctica', 'Antigua and Barbuda', 'Antilles, Netherlands', 'Argentina', 'Armenia',
'Aruba', 'Australia', 'Austria', 'Azerbaijan', 'Bahamas', 'Bahrain', 'Bangladesh',
'Barbados', 'Belarus', 'Belgium', 'Belize', 'Benin', 'Bermuda' , 'Bhutan', 'Bolivia',
'Bosnia and Herzegovina', 'Botswana', 'Brazil', 'British Indian Ocean Territory',
'British Virgin Islands' , 'Brunei Darussalam', 'Bulgaria', 'Burkina Faso', 'Burundi',
'Cambodia', 'Cameroon', 'Canada', 'Cape Verde', 'Cayman Islands' , 'Central African Republic',
'Chad', 'Chile', 'China', 'Christmas Island', 'Cocos (Keeling) Islands', 'Colombia',
'Comoros', 'Congo', 'Cook Islands', 'Costa Rica', 'Cote D\'Ivoire', 'Croatia', 'Cuba',