Skip to content

Instantly share code, notes, and snippets.

View alloy's full-sized avatar

Eloy Durán alloy

View GitHub Profile
module ActiveRecord
# When processing large numbers of records, it's often a good idea to do so in batches to prevent memory ballooning.
module Batches # :nodoc:
# Yields each record that was found by the find +options+. The find is performed by find_in_batches
# with a batch size of 1000 (or as specified by the +limit+ option).
#
# Example:
#
# Person.each(:conditions => "age > 21") do |person|
# person.party_all_night!
require 'time'
git = ARGV.shift
svn = ARGV.shift
class Git2SVN
def initialize(git, svn)
@git = git
@svn = svn
@repo = File.expand_path File.join(@svn, "repo")
require "irb"
IRB.init_config(__FILE__)
# Muchos hackos! I probably initialize IRB in the wrong way...
def IRB.CurrentContext
o = Object.new
def o.last_value
''
end
ARGF.close raises an IOError if called on a closed stream
ARGF.each_line returns self when passed a block
ARGF.each returns self when passed a block
Bignum#<=> returns 1 when self is Infinity and other is a Bignum
Bignum#<=> returns 1 when self is negative and other is Infinty
Bignum#<=> returns 1 when self is Infinity and other is a Bignum
Bignum#<=> returns 1 when self is negative and other is Infinty
File.join calls #to_path
Float#<=> returns 1 when self is Infinity and other is a Bignum
Float#<=> returns 1 when self is negative and other is Infinty
# encoding: utf-8
# move to 'active_support/multibyte/chars':
# require 'active_support/multibyte/exceptions'
# require 'active_support/multibyte/unicode_database'
module ActiveSupport #:nodoc:
module Multibyte
# A list of all available normalization forms. See http://www.unicode.org/reports/tr15/tr15-29.html for more
# information about normalization.
# Anon Test
MacRuby version 0.5 (ruby 1.9.0) [universal-darwin9.0, x86_64]
core:
false stats: 0 failures, 0 errors (5 examples, 17 expectations, 5 files)
file/constants stats: 0 failures, 0 errors (19 examples, 19 expectations, 1 files)
signal stats: 0 failures, 0 errors (3 examples, 3 expectations, 2 files)
hash stats: 0 failures, 0 errors (175 examples, 352 expectations, 50 files)
true stats: 0 failures, 0 errors (5 examples, 17 expectations, 5 files)
struct stats: 0 failures, 0 errors (53 examples, 110 expectations, 20 files)
dir stats: 0 failures, 0 errors (148 examples, 181 expectations, 27 files)
Subject: [fakutori-san] Gem Build System Failure
The gem build system failed with the following error:
Could not find gemspec at pickhost-cli.gemspec in [".gitignore", "MIT-LICENSE", "README.rdoc", "Rakefile", "VERSION.yml", "fakutori-san.gemspec", "lib", "rails", "test"]
The developers have been sent a copy of the error for debugging purposes.
A test from a RubyCocoa gist lib
require 'osx/cocoa'
require 'cgi'
class CocoaGist < OSX::NSObject
REQUEST_URL = OSX::NSURL.URLWithString('http://gist.github.com/gists')
TIMEOUT = 10
POLICY = 1 # NSURLRequestReloadIgnoringLocalCacheData
attr_accessor :delegate
attr_reader :connection, :response