Skip to content

Instantly share code, notes, and snippets.

View joshnesbitt's full-sized avatar

Josh Nesbitt joshnesbitt

View GitHub Profile

Copy this script to ".git/hooks/post-checkout" in your repository and make it executable:

chmod +x .git/hooks/post-checkout

Tweak it at will. I'm refreshing the bundle and restarting the app server because the Gemfile is different on my "hosted" branch than on other branches.

# Before
ret = {}
DefaultPackage.all.each do |package|
ret.merge({package.name.to_sym => package.get_products_wearing})
end
ret
rails_root = "/data/github/current"
20.times do |num|
God.watch do |w|
w.name = "dj-#{num}"
w.group = 'dj'
w.interval = 30.seconds
w.start = "rake -f #{rails_root}/Rakefile production jobs:work"
w.uid = 'git'
require 'rubygems'
require 'sinatra'
require 'redis'
# To use, simply start your Redis server and boot this
# example app with:
# ruby example_note_keeping_app.rb
#
# Point your browser to http://localhost:4567 and enjoy!
#
module Configuration
def self.attributes
@attributes
end
def self.configure
base = ConfigBlock.new
yield base
@joshnesbitt
joshnesbitt / newpost.rb
Created February 1, 2010 14:46 — forked from jrk/newpost.rb
#!/usr/bin/env ruby
require Dir
unless ARGV[0]
puts 'Usage: newpost "the post title"'
exit(-1)
end
blog_root = "/Users/jrk/proj/blog"
@joshnesbitt
joshnesbitt / license
Created January 27, 2010 13:49 — forked from defunkt/license
#!/bin/sh
echo "Copyright (c) `date +%Y` Josh Nesbitt
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
\"Software\"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
[alias]
up = !sh -c 'git pull && git log --pretty=format:\"%Cred%ae %Creset- %C(yellow)%s %Creset(%ar)\" HEAD@{1}..'
# 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