Skip to content

Instantly share code, notes, and snippets.

View BookOfGreg's full-sized avatar

Greg Myers BookOfGreg

  • Scotland
View GitHub Profile
@BookOfGreg
BookOfGreg / Reverse polymorphic association.
Last active February 17, 2017 14:52
Migrations and test code for reverse polymorphic association.
unless File.exist?('Gemfile')
File.write('Gemfile', <<-GEMFILE)
source 'https://rubygems.org'
gem 'rails', '~> 5.0.1'
gem 'sqlite3'
GEMFILE
system 'bundle install'
end
@BookOfGreg
BookOfGreg / god_nginx.rb
Created December 3, 2012 21:02
Nginx God Config
God.watch do |w|
w.name = "nginx"
w.interval = 60.seconds
w.start = "/usr/local/nginx/sbin/nginx"
w.stop = "/usr/local/nginx/sbin/nginx -s stop"
w.start_grace = 10.seconds
w.restart_grace = 10.seconds
# determine the state on startup
w.transition(:init, { true => :up, false => :start}) do |on|