Skip to content

Instantly share code, notes, and snippets.

@baldowl
baldowl / gist:771629
Created January 9, 2011 12:05
Using OS X's Directory Service instead of /etc/hosts
# Adding a host record.
sudo dscl . -create /Hosts/www.example.com ip_address 10.1.2.3
# Removing that same host record.
sudo dscl . -delete /Hosts/www.example.com
require 'chef'
require 'chef/node'
class Opscode
class Backup
attr_accessor :backup_dir
def initialize(backup_dir, config_file)
@backup_dir = backup_dir
Chef::Config.from_file(config_file)
@agibralter
agibralter / environment.rb
Created June 9, 2010 17:06
2.3.x cookie header hack
RAILS_GEM_VERSION = '2.3.8' unless defined? RAILS_GEM_VERSION
require File.join(File.dirname(__FILE__), 'boot')
Rails::Initializer.run do |config|
# ...
config.after_initialize do
ActionController::Dispatcher.middleware.insert_before(ActionController::Base.session_store, RackRailsCookieHeaderHack)
end
end
if defined?(PhusionPassenger)
PhusionPassenger.on_event(:starting_worker_process) do |forked|
if forked
# Rails cache_store
Rails.cache.instance_variable_get(:@data).reset if Rails.cache.class == ActiveSupport::Cache::MemCacheStore
# Reset the session_store, value could be nil depending on how you set it up
ActionController::Base.session_options[:cache].reset
# Reset the cache_fu connection (if used)