Skip to content

Instantly share code, notes, and snippets.


Emanuele Vicentini baldowl

View GitHub Profile
baldowl / app.rb
Created Apr 13, 2010
View app.rb
before do
cache_control :public, :max_age => 31557600
get '/' do
send_file(File.join(settings.public, 'index.html'), :disposition => nil)
get '/*' do
send_file(File.join(settings.public, params[:splat]), :disposition => nil)
baldowl / .gitattributes
Created Apr 25, 2010
Setting up Git for Xcode
View .gitattributes
# Better to treat them as binary files.
*.pbxproj -crlf -diff -merge
*.pbxuser -crlf -diff -merge
*.xib -crlf -diff -merge
baldowl / thin_recipe.rb
Created Jun 9, 2010
Keep-alive vs. Mongrel; saved by Thin
View thin_recipe.rb
set :thin_conf, "#{current_path}/config/thin_cluster.yml"
namespace :deploy do
%w(star stop restar).each do |action|
task action.to_sym, :roles => :app do
run "thin -c #{deploy_to}/current -C #{thin_conf} #{action}"
baldowl / Additions to rb_main.rb
Created Jun 17, 2010
Using Bundler08 Instead Of Standaloneify
View Additions to rb_main.rb
require 'vendor/gems/environment'
baldowl / god.rb
Created Jun 24, 2010 — forked from defunkt/god.rb
How to avoid untracked rake processes
View god.rb
rails_root = "/data/github/current"
20.times do |num| do |w|
w.dir = rails_root
w.env = {'RAILS_ENV' => 'production'} = "dj-#{num}" = 'dj'
w.interval = 30.seconds
baldowl / Pinging Google with a POST request
Created Sep 17, 2010
Pinging Google With A Service Hook
View Pinging Google with a POST request
curl -d "payload=testinggithubservicehooks" \
baldowl / before_migrate.rb
Created Nov 8, 2010
Using Chef and Bundler Together
View before_migrate.rb
# Drop it in config/deploy/
# It's evaluated inside the deploy resource's context.
# It assumes Gemfile and Gemfile.lock are present and satisfy Bundler's
# requirements for the --deployment option.
current_release_directory = release_path
running_deploy_user = new_resource.user
bundler_depot = new_resource.shared_path + '/bundle'
baldowl / rack-test-default-host.rb
Created Dec 6, 2010
Coercing Cucumber And Webrat To Cooperate
View rack-test-default-host.rb
Scenario: Deleting a user
When I go to the users page
And follow "Delete" for the 2nd user
Then I should be on the users page
And should not see "user2"
baldowl / gist:771629
Created Jan 9, 2011
Using OS X's Directory Service instead of /etc/hosts
View gist:771629
# Adding a host record.
sudo dscl . -create /Hosts/ ip_address
# Removing that same host record.
sudo dscl . -delete /Hosts/
baldowl / gist:796353
Created Jan 26, 2011
Interactive fog session: how to get a bunch of signed URLs for European buckets with fog 0.4.1
View gist:796353
require 'active_support/time'
bucket = {|d| d.key == 'my_bucket'}
files = {|f| f.content_length > 0 &&
f.key =~ %r{client-name.*\.zip}}
expiration =
signed_urls = {|f| f.url(expiration)}
fixed_signed_url = do |su|
su.sub(%r{s3\.(.*)/my_bucket}, "my_bucket.s3.#{$1}")
You can’t perform that action at this time.