Skip to content

Instantly share code, notes, and snippets.

# Bash snippet to open new shells in most recently visited dir.
# Useful if you want to open a new terminal tab at the present
# tab's location.
#
# Put this in your .bashrc or whatever.
pathed_cd () {
if [ "$1" == "" ]; then
cd
else
@bordy
bordy / .bashrc
Created July 8, 2009 18:58 — forked from defunkt/.bashrc
# $ tweet Hi mom!
#
# Put this in ~/.bashrc or wherever.
# If it doesn't work, make sure your ~/.netrc is right
#
# (Thanks to @anildigital for curl-fu)
function tweet {
curl -n -d status="$*" http://twitter.com/statuses/update.xml &> /dev/null
echo "tweet'd"
# Notes on Deploying Rails with Passenger on Ubuntu 9.04 and ruby 1.9
ssh root@0.0.0.0
adduser deploy
adduser deploy sudo
visudo
# uncomment or add the line: %sudo ALL=NOPASSWD: ALL
#!/usr/bin/env ruby
v = RUBY_VERSION.match(/^1\.9/) ? "18" : "19"
%w{ruby irb gem erb ri rdoc}.each do |c|
system "sudo ln -fs /usr/local/bin/#{c+v} /usr/local/bin/#{c}"
end
system "ruby --version"
require 'rubygems'
require 'money'
require 'yaml'
class Array
def total_hashes
self.inject({}) do |totals, hsh|
hsh.each { |key, value| (totals[key] = totals[key] ? value + totals[key] : value) unless %w(String Hash Array).include?(value.class.to_s) } if hsh.is_a?(Hash)
totals
SSH_ENV=$HOME/.ssh/environment
function start_agent {
echo "Initializing new SSH agent..."
/usr/bin/ssh-agent | sed 's/^echo/#echo/' > ${SSH_ENV}
echo succeeded
chmod 600 ${SSH_ENV}
. ${SSH_ENV} > /dev/null
/usr/bin/ssh-add;
}

Rails Dev Stack on Snow Leopard

(from a scratch install). Kinda, I imported my user home (~) from a Time Machine backup.

Homebrew

sudo mkdir /usr/local
sudo chown -R `whoami` /usr/local
curl -L http://github.com/mxcl/homebrew/tarball/master | tar xz --strip 1 -C /usr/local
sass_dir = ask("Where would you like to keep your sass files within your project? (default: 'app/stylesheets')")
sass_dir = "app/stylesheets" if sass_dir.blank?
css_dir = ask("Where would you like Compass to store your compiled css files? (default: 'public/stylesheets')")
css_dir = "public/stylesheets" if css_dir.blank?
compass_command = "compass --rails . --css-dir=#{css_dir} --sass-dir=#{sass_dir} "
file 'vendor/plugins/compass/init.rb', <<-CODE
# This is here to make sure that the right version of sass gets loaded (haml 2.2) by the compass requires.

Deploying an app for the first time

Remotely:

sudo mkdir /var/www/dashboard.app
sudo chown -R deploy:deploy /var/www/dashboard.app/

Locally:

cap deploy:setup