Skip to content

Instantly share code, notes, and snippets.

@amateurhuman
amateurhuman / gist:2005745
Created March 9, 2012 09:03
Installing Rubinius 2.0.0-dev with rbenv

Installing rbx-2.0.0-dev with Ruby 1.9 support using rbenv can be a tad tricky. This is what I did to get up and running, you'll need another version of ruby already installed as well as rake.

The basic outline:

  1. Clone Rubinius HEAD from github
  2. Configure installation for rbenv and 1.9 support
  3. Install Rubinius
  4. Configure your $PATH to use Rubinius gems
  5. Start using Rubinius
@goosetav
goosetav / howto.md
Created November 1, 2012 21:01
prevent ttf fonts while running poltergeist

RE: teampoltergeist/poltergeist#44

Use Rack::SimpleEndpoint to prevent Poltergeist/PhantomJS from crashing on TTF fonts.

In config/environments/test.rb, add

require 'rack/contrib/simple_endpoint'
config.middleware.insert_after Rack::Runtime, Rack::SimpleEndpoint, /\.ttf$/ do |req, res, match|
  res.status = '403'

"I will not serve TTF fonts in test mode."

@mjtko
mjtko / howto.md
Created November 2, 2012 18:56 — forked from goosetav/howto.md
prevent ttf fonts while running poltergeist

RE: teampoltergeist/poltergeist#44

Use Rack::SimpleEndpoint to prevent Poltergeist/PhantomJS from crashing on TTF fonts.

Create config/initializers/middleware-deny-ttf-to-phantomjs-under-test.rb:

if Rails.env.test?
  require 'rack/contrib/simple_endpoint'
 Rails.application.config.middleware.insert_after Rack::Runtime, Rack::SimpleEndpoint, /\.ttf$/ do |req, res|
@msluyter
msluyter / graphite.md
Created September 17, 2012 22:38 — forked from diver-in-sky/graphite.md
Installing Graphite on OS X Mountain Lion -- note, did not work for me!

Install Python 2.7.3 (if needed)

brew install python

Install cairo & py2cairo

brew install cairo
brew install py2cairo
@rubiii
rubiii / how_it_works.md
Created December 2, 2012 11:14
MacVim-Formatter for RSpec
$ rspec --format MacVimFormatter --color spec
@grosser
grosser / resque_web.rb
Created September 13, 2011 15:08 — forked from skippy/resque_web.rb
Mountable resque-web for rails 3+ apps
# https://gist.github.com/1214052
require 'sinatra/base'
class ResqueWeb < Sinatra::Base
require 'resque/server'
use Rack::ShowExceptions
if CFG[:user].present? and CFG[:password].present?
Resque::Server.use Rack::Auth::Basic do |user, password|
user == CFG[:user] && password == CFG[:password]
@adomokos
adomokos / get_out_of_my_controller_spec.rb
Created September 7, 2011 19:38
The supporting code for my blog entry: "Get out of my Controller! And from Active Record, too!"
module ActiveRecord; class Base; end; end
# The AR Models Rails give you
class User < ActiveRecord::Base
# These fields are defined dynamically by ActiveRecord
attr_accessor :id, :full_name
end
class Discussion < ActiveRecord::Base
# These fields are defined dynamically by ActiveRecord
# (1) copy the newrelic rpm java client into #{RAILS_ROOT}/solr/newrelic
# (2) add a newrelic.yml in that directory with you API key
# (3) add this monkey patch in an initializer to load newrelic with the solr server
Sunspot::Server.class_eval do
def run
command = ['java']
command << "-Xms#{min_memory}" if min_memory
command << "-Xmx#{max_memory}" if max_memory
command << "-Djetty.port=#{port}" if port
command << "-Dsolr.data.dir=#{solr_data_dir}" if solr_data_dir
@nragaz
nragaz / all.god
Created July 12, 2010 03:16
God configs for starting Resque and Unicorn
PID_DIR = '/srv/myapp/shared/pids'
RAILS_ENV = ENV['RAILS_ENV'] = 'production'
RAILS_ROOT = ENV['RAILS_ROOT'] = '/srv/myapp/current'
BIN_PATH = "/home/rails/.rvm/gems/ree-1.8.7-2010.02/bin"
God.log_file = "#{RAILS_ROOT}/log/god.log"
God.log_level = :info
%w(unicorn resque).each do |config|
God.load "#{RAILS_ROOT}/config/god/#{config}.god"
@shapeshed
shapeshed / unicorn
Created September 16, 2011 10:12
Unicorn / Monit setup
#!/bin/sh
set -e
# Example init script, this can be used with nginx, too,
# since nginx and unicorn accept the same signals
# Feel free to change any of the following variables for your app:
TIMEOUT=${TIMEOUT-60}
APP_ROOT=/path/to/your/app/current
PID=$APP_ROOT/tmp/pids/unicorn.pid
ENVIRONMENT=production