Skip to content

Instantly share code, notes, and snippets.

View bensie's full-sized avatar

James Miller bensie

View GitHub Profile
@bensie
bensie / nginx.conf
Created January 10, 2012 20:15
Nginx static asset config
location ~ ^/(assets|images|javascripts|stylesheets|swfs|system)/ {
gzip_static on;
expires max;
add_header Cache-Control public;
}
@bensie
bensie / gist:1524813
Created December 27, 2011 19:03
Enable remote disk on any Mac
defaults write com.apple.NetworkBrowser EnableODiskBrowsing -bool true
defaults write com.apple.NetworkBrowser ODSSupported -bool true
@bensie
bensie / file-user.json
Created December 12, 2011 22:05
Sublime Settings
{
"color_scheme": "Packages/Color Scheme - Default/Twilight.tmTheme",
"font_size": 13.0,
"ensure_newline_at_eof_on_save": true,
"tab_size": 2,
"translate_tabs_to_spaces": true,
"trim_trailing_white_space_on_save": true
}
@bensie
bensie / Gemfile
Created August 10, 2011 20:09
savon ntlm
source "http://rubygems.org"
gem 'httpi', :git => 'git://github.com/bensie/httpi.git', :branch => 'ntlm'
gem 'savon'
@bensie
bensie / sinatra_basic_auth.rb
Created June 30, 2011 14:40
Sinatra authentication helpers
def auth
@auth ||= Rack::Auth::Basic::Request.new(request.env)
end
def current_user
@current_user
end
def authenticated?
request.env['REMOTE_USER']
@bensie
bensie / contact_db.rb
Created June 14, 2011 23:20
Week 4 Exercise
class Contact
attr_accessor :name
end
class Person < Contact
attr_accessor :title
@bensie
bensie / chef_bootstrap_rvm.erb
Created June 11, 2011 23:53
Chef Bootstrap With RVM and 1.9.2 (Ubuntu)
bash -c '
if [ ! -f /usr/bin/chef-client ]; then
apt-get update
apt-get install -y build-essential bison openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev autoconf libc6-dev
bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)
(
cat <<'EOP'
[[ -s "/usr/local/rvm/scripts/rvm" ]] && source "/usr/local/rvm/scripts/rvm" # This loads RVM into a shell session.
EOP
@bensie
bensie / week_3_solution.rb
Created June 8, 2011 14:46
Week 3 Exercise - Solution
class Person
attr_accessor :name, :title
def first_name
name.split[0]
end
def last_name
name.split[1]
@bensie
bensie / week3.rb
Created June 8, 2011 00:28
Week 3 Exercise
class Person
attr_accessor :name, :title
def first_name
name.split[0]
end
def last_name
name.split[1]
@bensie
bensie / gist:961706
Created May 8, 2011 21:37
rails master (3.1.pre) fail
/Users/jkmiller/.rvm/gems/ruby-1.9.2-p180/bundler/gems/rails-b3791da0318e/activesupport/lib/active_support/dependencies.rb:477:in `load_missing_constant': Admin is not missing constant Account! (ArgumentError)
from /Users/jkmiller/.rvm/gems/ruby-1.9.2-p180/bundler/gems/rails-b3791da0318e/activesupport/lib/active_support/dependencies.rb:181:in `block in const_missing'
from /Users/jkmiller/.rvm/gems/ruby-1.9.2-p180/bundler/gems/rails-b3791da0318e/activesupport/lib/active_support/dependencies.rb:179:in `each'
from /Users/jkmiller/.rvm/gems/ruby-1.9.2-p180/bundler/gems/rails-b3791da0318e/activesupport/lib/active_support/dependencies.rb:179:in `const_missing'
from /Users/jkmiller/.rvm/gems/ruby-1.9.2-p180/bundler/gems/rails-b3791da0318e/activesupport/lib/active_support/inflector/methods.rb:124:in `block in constantize'
from /Users/jkmiller/.rvm/gems/ruby-1.9.2-p180/bundler/gems/rails-b3791da0318e/activesupport/lib/active_support/inflector/methods.rb:123:in `each'
from /Users/jkmiller/.rvm/gems/ruby-1.9.2-p18