Skip to content

Instantly share code, notes, and snippets.

def prepare_analyzer()
saved_aggregate_data = rcov_load_aggregate_data($options.aggregate_file)
if(saved_aggregate_data[:coverage])
$rcov_code_coverage_analyzer = saved_aggregate_data[:coverage]
end
$rcov_code_coverage_analyzer.install_hook
end
module Tickle
extend self
def load_rails_environment(environment)
ENV["RAILS_ENV"] = environment
Object.const_set :RAILS_ENV, environment
require(File.join(RAILS_ROOT, 'config', 'environment'))
$: << "#{Rails.root}/test"
require "#{Rails.root}/test/test_helper"
input
-----
emacs - records
vim - columns
wow
windowd and linux
windows - records
macs
output
module Foo
def hello
puts "Hello from Foo"
end
end
module Bar
def self.included(base_klass)
base_klass.class_eval do
alias_method :old_hello, :hello
source 'http://rubygems.org'
# Bundle edge Rails instead:
gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'mysql'
# Use unicorn as the web server
# gem 'unicorn'
require 'monitor'
require 'set'
require 'active_support/core_ext/module/synchronization'
module ActiveRecord
# Raised when a connection could not be obtained within the connection
# acquisition timeout period.
class ConnectionTimeoutError < ConnectionNotEstablished
end
desc "Delete an user"
task :delete_user => :environment do
user_id = ENV['user_id']
email = ENV['email']
user = nil
if user_id
user = User.find(user_id)
elsif email
user = User.find_by_email(email)
- "gem install rails -v 2.0.2"
- "gem install gettext"
- "gem instal httpclient -v 2.1.2"
- "gem install log4r"
- "gem install ruport -v 1.6.1"
- "gem install ruport-util -v 0.14"
- "gem install acts_as_reportable -v 1.1.1"
- "gem install aws-s3 -v 0.6.2"
- "gem install cmdparse -v 2.0.2"
- "gem install color -v 1.4.0"
/Users/gnufied/.rvm/scripts/utility: line 255: /Users/gnufied/.rvm/bin/./jruby-1.5.2: No such file or directory
[2010-10-10 11:24:50] /Users/gnufied/.rvm/bin/./ruby-1.9.2-p0 configure --prefix=/Users/gnufied/.rvm/rubies/rbx-head --skip-system
/Users/gnufied/.rvm/scripts/utility: line 255: /Users/gnufied/.rvm/bin/./ruby-1.9.2-p0: No such file or directory
[2010-10-10 11:27:21] /Users/gnufied/.rvm/wrappers/./ruby-1.9.2-p0/ruby ./configure --prefix=/Users/gnufied/.rvm/rubies/rbx-head --skip-system
/Users/gnufied/.rvm/scripts/utility: line 282: /Users/gnufied/.rvm/wrappers/./ruby-1.9.2-p0/ruby: No such file or directory
user_addons = profile.charges.where(:parent_id => nil)
total_charge = 0
user_addons.each do |user_addon|
addon_history = user_addon.children.where(["timestamp > ", Time.beginning_of_the_month]).order(:version).asc
unless addon_history.blank?
duration_in_use = 0
last_active_timestamp = Time.beginning_of_the_month
addon_history.each do |record|
if(record.active?)
duration_in_use += record.updated_at - last_active_timestamp