Skip to content

Instantly share code, notes, and snippets.


David Alexander davidalexander

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

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:

davidalexander / gist:1086437
Created Jul 16, 2011
Shell command to find size of folder
View gist:1086437
# single folder
du -sh [FOLDERNAME]/
# subfolders
du --max-depth=1 [FOLDERNAME]/ | sort -n -r
davidalexander /
Created Jul 16, 2011
Recursively Delete .svn Directories
find . -type d -name .svn -exec rm -rfv {} \;