Skip to content

Instantly share code, notes, and snippets.

View stewart's full-sized avatar
🆗
Computer

Andrew Stewart stewart

🆗
Computer
View GitHub Profile
@anaisbetts
anaisbetts / gist:2606426
Created May 6, 2012 00:02 — forked from rtomayko/gist:2601550
Open beautiful git-scm.com manual pages w/ git help
# The new git-scm.com site includes man pages designed for pleasant viewing in a web browser:
#
# http://git-scm.com/docs
#
# The commands below can be used to configure git to open these pages when
# using `git help <command>' from the command line. Just enter the config
# commands in your shell to modify your ~/.gitconfig file.
# Create a new browser command and configure help -w to use it.
git config --global browser.gitscm.cmd "/bin/sh -c 'open http://git-scm.com/docs/\$(basename \$1 .html)' --"
@jlong
jlong / uri.js
Created April 20, 2012 13:29
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
<!DOCTYPE html>
<!-- Helpful things to keep in your <head/>
// Brian Blakely, 360i
// http://twitter.com/brianblakely/
-->
<head>
<!-- Disable automatic DNS prefetching.
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'
}
function check_git_changes {
var=`git status 2> /dev/null | sed -e '/(working directory clean)$/!d' | wc -l`
if [ $var -ne 1 ]; then
tput setaf 1 # red
else
tput setaf 2 # green
fi