Skip to content

Instantly share code, notes, and snippets.

View b-mandelbrot's full-sized avatar

b-mandelbrot

View GitHub Profile
def self.setup_rails_for_action_cache_options
::ActionController::Caching::Actions::ActionCacheFilter.class_eval do
def initialize(*actions, &block)
if [].respond_to?(:extract_options!)
@options = actions.extract_options!
@actions = actions.inject(@options.except(:cache_path)) do |hsh, action|
action.is_a?(Hash) ? hsh.merge(action) : hsh.merge(action => { :ttl => nil })
end
@options.slice!(:cache_path)
else
#--
# Copyright (C)2008 Ilya Grigorik
# You can redistribute this under the terms of the Ruby license
#
# Modifications by Vinicius B. Fuentes
#++
require 'rubygems'
require 'optparse'
require 'ruport'
@b-mandelbrot
b-mandelbrot / Folder Preferences
Created May 8, 2011 01:10 — forked from chrisyour/Folder Preferences
Show hidden files and hidden folders (except .git) in your TextMate project drawer
# Want to show hidden files and folders in your TextMate project drawer? Simple, just modify the file and folder patterns in TextMate's preferences.
# Instructions:
# Go to TextMate > Preferences...
# Click Advanced
# Select Folder References
# Replace the following:
# File Pattern
@b-mandelbrot
b-mandelbrot / Folder Preferences
Created May 8, 2011 01:10 — forked from chrisyour/Folder Preferences
Show hidden files and hidden folders (except .git) in your TextMate project drawer
# Want to show hidden files and folders in your TextMate project drawer? Simple, just modify the file and folder patterns in TextMate's preferences.
# Instructions:
# Go to TextMate > Preferences...
# Click Advanced
# Select Folder References
# Replace the following:
# File Pattern
@b-mandelbrot
b-mandelbrot / redis_pubsub_demo.rb
Created July 7, 2011 19:38 — forked from tobym/redis_pubsub_demo.rb
Redis PubSub demo with EventMachine (chat service)
# Author: Pieter Noordhuis
# Description: Simple demo to showcase Redis PubSub with EventMachine
#
# Requirements:
# - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby
# - a browser with WebSocket support
#
# Usage:
# ruby redis_pubsub_demo.rb
#
require 'usb'
require 'betabrite'
###
# Get a betabrite sign:
#
# http://www.betabrite.com/
# http://www.amazon.com/Brite-Prism-Moving-Message-Display/dp/B000MQAI72
#
# Install gems:
@b-mandelbrot
b-mandelbrot / resque_web.monit
Created November 16, 2011 21:13 — forked from guilherme/resque_web.monit
monit configuration for resque web
check process resque-web with pidfile /var/www/app/shared/resque_web/resque_web.pid
group resque
start program = "/bin/env RAILS_ENV=production /var/www/app/current/app/workers/run_resque_web.sh start" as uid deploy gid deploy
stop program = "/bin/env RAILS_ENV=production /var/www/app/current/app/workers/run_resque_web.sh stop" as uid deploy and gid deploy
if failed host localhost port 5678 with timeout 10 seconds then restart
if 3 restarts within 5 cycles then timeout
@b-mandelbrot
b-mandelbrot / 0-readme.md
Created January 30, 2012 11:26 — forked from burke/0-readme.md
ruby-1.9.3-p0 cumulative performance patch.

Patched ruby 1.9.3-p0 for 30% faster rails boot

What is?

This script installs a patched version of ruby 1.9.3-p0 with patches to make ruby-debug work again (#47) and boot-time performance improvements (#66 and #68), and runtime performance improvements (#83 and #84).

Huge thanks to funny-falcon for the performance patches.

class PostsController < ActionController::Base
def create
Post.create(post_params)
end
def update
Post.find(params[:id]).update_attributes!(post_params)
end
private
@b-mandelbrot
b-mandelbrot / gist:2933626
Created June 14, 2012 23:22 — forked from spovich/gist:1848409
Installing ruby-debug with ruby-1.9.3-p125
# Install with:
# bash < <(curl -L https://raw.github.com/gist/1848409)
#
# Reference: http://blog.wyeworks.com/2011/11/1/ruby-1-9-3-and-ruby-debug
echo "Installing ruby-debug with ruby-1.9.3-p125 ..."
curl -OL http://rubyforge.org/frs/download.php/75414/linecache19-0.5.13.gem
curl -OL http://rubyforge.org/frs/download.php/75415/ruby-debug-base19-0.11.26.gem