Skip to content

Instantly share code, notes, and snippets.

@galfert
galfert / gist:40988
Created December 28, 2008 16:39 — forked from peterc/gist:33337
# SUPER DARING APP TEMPLATE 1.0
# By Peter Cooper
# Link to local copy of edge rails
inside('vendor') { run 'ln -s ~/dev/rails/rails rails' }
# Delete unnecessary files
run "rm README"
run "rm public/index.html"
run "rm public/favicon.ico"
@galfert
galfert / railslove.rb
Created December 28, 2008 16:40 — forked from bumi/railslove.rb
# RAILSLOVE.com template
#
# with help and ideas from:
# http://gist.github.com/33337 By Peter Cooper
# http://github.com/jeremymcanally/rails-templates/tree/master/suspenders.rb Suspenders by Thoughtbot Nathan Esquenazi
if yes?("symlink local rails copy to vendor?")
path = ask("what's the directory of your local rails copy?")
inside('vendor') { run "ln -s #{path} rails" }
@galfert
galfert / deploy.rb
Created February 21, 2009 11:19 — forked from defunkt/deploy.rb
# deploy to staging from your current topic branch, with ease
set :branch, "origin/#{`git branch`.scan(/^\* (\S+)/)}"
@galfert
galfert / httpdump
Created April 4, 2009 10:29 — forked from peterc/httpdump
# Monitor HTTP requests being made from your machine with a one-liner..
# Replace "en1" below with your network interface's name (usually en0 or en1)
sudo tcpdump -i en1 -n -s 0 -w - | grep -a -o -E "Host\: .*|GET \/.*"
# OR.. to be able to use as "httpdump" from anywhere, drop this into ~/.bash_profile:
# (again replace "en1" with correct network interface name)
alias httpdump="sudo tcpdump -i en1 -n -s 0 -w - | grep -a -o -E "Host\: .*|GET \/.*""
# All the above tested only on OS X.
@galfert
galfert / bash_profile_git_branch.sh
Created June 13, 2009 09:13
Show the git branch in bash prompt
function parse_git_branch {
ref=$(git symbolic-ref HEAD 2> /dev/null) || return
echo "("${ref#refs/heads/}")"
}
GREEN="\[\033[01;32m\]"
WHITE="\[\033[00m\]"
BLUE="\[\033[01;34m\]"
YELLOW="\[\033[0;33m\]"
// only outputs if console available and does each argument on its own line
function log() {
if (window && window.console && window.console.log) {
var i, len;
for (i=0, len=arguments.length; i<len; i++) {
console.log(arguments[i]);
}
}
}
[user]
name = Scott Chacon
email = schacon@gmail.com
[alias]
serve = !git daemon --reuseaddr --verbose --base-path=. --export-all ./.git
unstage = reset HEAD
lol = log --pretty=oneline --abbrev-commit --graph --decorate
branches = !git-branches
st = status
[gui]
@galfert
galfert / gist:2040501
Created March 14, 2012 23:55
Bash prompt (GIT & RVM)
RED="\[\033[0;31m\]"
YELLOW="\[\033[0;33m\]"
GREEN="\[\033[0;32m\]"
BLUE="\[\033[0;34m\]"
LIGHT_RED="\[\033[1;31m\]"
LIGHT_GREEN="\[\033[1;32m\]"
WHITE="\[\033[1;37m\]"
LIGHT_GRAY="\[\033[0;37m\]"
PURPLE="\[\033[0;35m\]"
CYAN="\[\033[0;36m\]"
/* remoteStorage.js 0.7.1 remotestorage.io, MIT-licensed */
/**
* almond 0.1.4 Copyright (c) 2011, The Dojo Foundation All Rights Reserved.
* Available via the MIT or new BSD license.
* see: http://github.com/jrburke/almond for details
*/
// a().then(b).then(c).then(function() {
@galfert
galfert / app.js
Last active December 15, 2015 16:49
remoteStorage with Ember.js
// tell the app to not start the router right away when there is an access_token param
if (window.location.hash.match(/#access_token=.+/)) {
App.deferReadiness();
}
remoteStorage.claimAccess({ tasks: 'rw' }).then(function() {
remoteStorage.on('ready', function() {
// now we can start the router
App.advanceReadiness();
});