Skip to content

Instantly share code, notes, and snippets.

@fabrizioc1
fabrizioc1 / rspec_performance_test.rb
Last active December 22, 2015 00:00 — forked from danbronsema/rspec performance test
rspec performance test
context 'performance' do
before do
require 'benchmark'
@posts = []
@users = []
8.times do |n|
user = Factory.create(:user)
@users << user
aspect = user.aspects.create(:name => 'people')
connect_users(@user, @aspect0, user, aspect)
class Player
def initialize
@max_health = 20
@last_health = @max_health
@taking_damage = false
@directions = [:backward, :forward]
@current_direction = :forward
@reached_wall = false
end
@fabrizioc1
fabrizioc1 / oracle_timeout_fix.rb
Created September 30, 2011 04:55 — forked from defunkt/connection_fix.rb
Oracle "not connected to ORACLE" fix
# If your workers are inactive for a long period of time, they'll lose
# their Oracle connection.
#
# This hack ensures we re-connect whenever a connection is
# lost. Because, really. why not?
#
# Stick this in RAILS_ROOT/config/initializers/connection_fix.rb (or somewhere similar)
#
# From:
# http://coderrr.wordpress.com/2009/01/08/activerecord-threading-issues-and-resolutions/
@fabrizioc1
fabrizioc1 / gemspec
Created September 2, 2011 16:19 — forked from defunkt/gemspec
Quickly create a gemspec.
#!/usr/bin/env ruby
# Usage: gemspec [-s] GEMNAME
#
# Prints a basic gemspec for GEMNAME based on your git-config info.
# If -s is passed, saves it as a GEMNAME.gemspec in the current
# directory. Otherwise prints to standard output.
#
# Once you check this gemspec into your project, releasing a new gem
# is dead simple:
#