Skip to content

Instantly share code, notes, and snippets.

View 7hunderbird's full-sized avatar
👶
Since 1976.

Tyler Bird 7hunderbird

👶
Since 1976.
View GitHub Profile
# To restart passenger with capistrano, use this:
namespace :deploy do
task :start, :roles => :app do
run "touch #{current_release}/tmp/restart.txt"
end
task :stop, :roles => :app do
# Do nothing.
end
#!/bin/bash
# path of MoinMoin shared files
SHARE=/usr/local/share/moin
# path to target instance location
INSTANCE=$1
# should be nice
USER=nginx
# Bundler Integration
# http://github.com/carlhuda/bundler/blob/master/lib/bundler/capistrano.rb
require 'bundler/capistrano'
# Application Settings
set :application, "youstack"
set :user, "deploy"
set :password, "FANCYpants"
set :deploy_to, "/home/#{user}/#{application}"
set :rails_env, "production"
namespace :tail do
desc "Tail the Rails production log for this environment"
task :production_logs, :roles => :app do
run "tail -f #{shared_path}/log/#{rails_env}.log" do |channel, stream, data|
puts # for an extra line break before the host name
puts "#{channel[:server]} -> #{data}"
break if stream == :err
end
end
desc "Tail the Mongrel logs this environment"
@7hunderbird
7hunderbird / newrelic_rpm-notice
Created April 6, 2011 22:34
A notice given to developers when installing the 2.14.1 version of the newrelic_rpm gem.
PLEASE NOTE:
Developer Mode is now a Rack middleware.
RPM Developer Mode is no longer available in Rails 2.1 and earlier.
However, starting in version 2.12 you can use Developer Mode in any
Rack based framework, in addition to Rails. To install developer mode
in a non-Rails application, just add NewRelic::Rack::DeveloperMode to
your middleware stack.
Installing ri documentation for builder-2.1.2...
ERROR: While generating documentation for builder-2.1.2
... MESSAGE: Unhandled special: Special: type=17, text="<!-- HI -->"
... RDOC args: --ri --op /Users/tbird/.rvm/gems/ruby-1.8.7-p334@rails31/doc/builder-2.1.2/ri --title Builder -- Easy XML Building --main README --line-numbers lib CHANGES Rakefile README doc/releases/builder-1.2.4.rdoc doc/releases/builder-2.0.0.rdoc doc/releases/builder-2.1.1.rdoc --title builder-2.1.2 Documentation --quiet
@7hunderbird
7hunderbird / gist:1018132
Created June 10, 2011 02:18
warning message, what does this really mean?
[demo_app (master)]$ rake -T
WARNING: Global access to Rake DSL methods is deprecated. Please include
... Rake::DSL into classes and modules which use the Rake DSL methods.
WARNING: DSL method DemoApp::Application#task called at /Users/tbird/.rvm/gems/ruby-1.8.7-p334/gems/railties-3.0.7/lib/rails/application.rb:215:in `initialize_tasks'
rake about # List versions of all Rails frameworks and the environment
rake db:create # Create the database from config/database.yml for the current Rail...
rake db:drop # Drops the database for the current Rails.env (use db:drop:all to ...
rake db:fixtures:load # Load fixtures into the current environment's database.
rake db:migrate # Migrate the database (options: VERSION=x, VERBOSE=false).
rake db:migrate:status # Display status of migrations
@7hunderbird
7hunderbird / get_upc.rb
Created December 9, 2011 20:29
This will take a UPC number and return the Title.
require 'rubygems'
require 'nokogiri'
require 'open-uri'
puts "Give me a UPC code:"
upc = gets.chomp
url = "http://www.upcdatabase.com/item/" + upc
doc = Nokogiri::HTML(open(url))
@7hunderbird
7hunderbird / gist:2065819
Created March 17, 2012 22:20
Engines Checklist
rails plugin new my_engine --full --mountable
Engines Checklist
* Copy and namespace models, views, controllers, and helpers
* Copy routes
* Copy tests, add :use_route # so your test know which route to hit.
* Configure defaults
* Add dependencies to your gemspec
* Require your dependencies # because bundler doesn't boot strap them, etc.
run "cd #{current_path} && bundle exec rake db:migrate" do |channel, stream, data|
puts # line break
puts "#{channel[:server]} -> #{data}"
break if stream == :err
end