Homebrew is a great little package manager for OS X. If you haven't already, installing it is pretty easy:
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
#!/bin/bash | |
# Creator: Phil Cook | |
# Modified: Andy Miller | |
# | |
# >>> IMPORTANT: Moved to: https://github.com/rhukster/sphp.sh | |
# >>> Kept here for legacy purposes | |
# | |
osx_major_version=$(sw_vers -productVersion | cut -d. -f1) | |
osx_minor_version=$(sw_vers -productVersion | cut -d. -f2) | |
osx_patch_version=$(sw_vers -productVersion | cut -d. -f3) |
<?php | |
// -- Only one caveat : The results must be ordered so that an item's parent will be processed first. | |
// -- Simulate a DB result | |
$results = array(); | |
$results[] = array('id' => 'a', 'parent' => '', 'name' => 'Johnny'); | |
$results[] = array('id' => 'b', 'parent' => 'a', 'name' => 'Bobby'); | |
$results[] = array('id' => 'c', 'parent' => 'b', 'name' => 'Marky'); | |
$results[] = array('id' => 'd', 'parent' => 'a', 'name' => 'Ricky'); |
<?php | |
# Git branch output in PHP | |
exec('git symbolic-ref HEAD', $output); | |
$branch = end(explode('/', $output[0]))); |