This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## | |
# Start daemons. | |
config.after_initialize do | |
unless $0.match(/rake/) or (defined? DaemonMemcache and DaemonMemcache.instance.running?) | |
DaemonMemcache.instance.start rescue nil | |
at_exit do | |
DaemonMemcache.instance.stop rescue nil | |
end | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'singleton' | |
begin | |
require 'daemon_controller' | |
rescue LoadError | |
raise('FATAL: sudo gem install FooBarWidget-daemon_controller -s http://gems.github.com') | |
end | |
## | |
# sudo port install memcached | |
class DaemonMemcache |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# == WHAT | |
# Simple script for growl notifications in irssi | |
# | |
# == WHO | |
# Nate Murray 2008 | |
# | |
# == CONFIG | |
# /SET growl_on_regex [regex] | |
# /SET growl_channel_regex [regex] | |
# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Module for re-running commands from the history in irb and its ilk (script/console) | |
# Usage: | |
# history => view the history | |
# history 7 => rerun line 7 in the history | |
# history /foo/ => rerun the last line in the history matching /foo/ | |
# | |
# Just add this code into your ~/.irbrc. | |
# NOTE: Readline support is required for this to work. | |
module HistoryRepeats | |
class << self |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### lib/ruby_ext.rb | |
Net::SMTP.class_eval do | |
def initialize_with_timeouts(*args) | |
initialize_without_timeouts(*args) | |
@open_timeout = Emailer::OpenTimeout | |
@read_timeout = Emailer::ReadTimeout | |
end | |
alias_method_chain :initialize, :timeouts | |
end | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### lib/tasks/app.rake | |
begin | |
require 'vlad' | |
Vlad.load :scm => :git, :web => :apache | |
rescue LoadError | |
puts $! | |
end | |
### Extending 'vlad:update' with 'gems:geminstaller' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :spec do | |
desc "Report uncovered view templates." | |
task :missing_view_templates => :environment do | |
EXTENSION = ENV['extention'] || 'haml' | |
APP_VIEWS_DIR = File.join('app', 'views') | |
SPEC_VIEWS_DIR = File.join('spec', 'views') | |
Dir[File.join(Rails.root, "#{APP_VIEWS_DIR}/**/*.html.#{EXTENSION}")].each do |file| | |
file.match(%r{^#{File.join(Rails.root, APP_VIEWS_DIR)}/(.*)\.html.#{EXTENSION}$}) | |
puts $1 unless File.exists?(File.join(Rails.root, SPEC_VIEWS_DIR, "#{$1}.html.#{EXTENSION}_spec.rb")) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## | |
# Rack configuration for use with Phusion Passenger. | |
# | |
# Updated with Blake's suggestions from: http://gist.github.com/98711 | |
log = File.new('log/sinatra.log', 'a') | |
$stdout.reopen(log) | |
$stderr.reopen(log) | |
require 'YOUR_APPLICATION' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CONTENT_TYPES = {:html => 'text/html', :css => 'text/css', :js => 'application/javascript'} | |
before do | |
request_uri = case request.env['REQUEST_URI'] | |
when /\.css$/ : :css | |
when /\.js$/ : :js | |
else :html | |
end | |
content_type CONTENT_TYPES[request_uri], :charset => 'utf-8' | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
get '/:stylesheet.css' do | |
sass params[:stylesheet].to_sym | |
end | |
OlderNewer