Skip to content

Instantly share code, notes, and snippets.

View davidalexander's full-sized avatar

David Alexander davidalexander

View GitHub Profile
@davidalexander
davidalexander / gist:1086441
Created July 16, 2011 15:23
Make links within a website root relative
<?php
function make_href_root_relative($input) {
return preg_replace('!http(s)?://' . $_SERVER['SERVER_NAME'] . '/!', '/', $input);
}
?>
@davidalexander
davidalexander / gist:1086440
Created July 16, 2011 15:20
VMware Fusion - Find Magic IP

VMware Fusion

Most of us (developers) already use virtualization in some form for testing, but in order to take advantage of this particular environment – MAMP with virtual hosts – we need to update the hosts file on the virtual machine so that it resolves the domains to the Mac's IP.

One catch: if you’re on a latop, chances are the Mac’s IP will change often. That’s why we need to get the secret IP the VM uses to talk to the Mac. Here’s how we find it:

Type ifconfig vmnet1 into a Terminal window. You should get a return like this:

vmnet1: flags=8863 mtu 1500 
@davidalexander
davidalexander / gist:1086437
Created July 16, 2011 15:17
Shell command to find size of folder
# single folder
du -sh [FOLDERNAME]/
# subfolders
du --max-depth=1 [FOLDERNAME]/ | sort -n -r
@davidalexander
davidalexander / remove_svn.sh
Created July 16, 2011 15:14
Recursively Delete .svn Directories
find . -type d -name .svn -exec rm -rfv {} \;