Skip to content

Instantly share code, notes, and snippets.

begin
require 'rcov/rcovtask'
Rcov::RcovTask.new do |t|
t.libs << "test"
dot_rakes =
t.rcov_opts = [
'-xRakefile', '-xrakefile', '-xpublish.rf',
'-xlib/rake/contrib', '-x/Library',
'--text-report',
>> m "a string"
% * + < << <= <=> == === =~ > >= [] []= __id__ __send__
all? any?
between?
capitalize capitalize! casecmp center chomp chomp! chop chop! class clone collect concat count crypt
delete delete! detect display downcase downcase! dump dup
each each_byte each_line each_with_index eigenclass empty? entries eql? equal? extend
find find_all freeze frozen?
grep gsub gsub!
hash hex
(setq jw-cc-style
'((c-hanging-comment-starter-p . nil)
(c-hanging-comment-ender-p . nil)
(c-offsets-alist . ((string . -1000)
(topmost-intro . 0)
(topmost-intro-cont . 0)
(inline-open . 0)
(substatement . +)
(substatement-open . 0)
(member-init-intro . 0)
class Parent
def x
@@x
end
end
class Son < Parent
def xs
@@x
end
puts (?:==?????:?:)
# Switch to Ruby 1.8.7
rvm use 1.8.7
# Print out the ruby version
ruby -v
# But the output of this is:
#
# $ ./tryrvm
# <i> Now using ruby 1.8.7 p249 </i>
Spec::Runner.configure do |config|
config.mock_with :flexmock
end
class Foo
attr_accessor :bar
def initialize(style)
@bar = Bar.new(style)
end
end
# This is a simplified snippet of code representing the line number
# reporting problem. Running the following using rspec yields (in
# part):
# 1)
# 'something should be true' FAILED
# expected false to be true
# line_spec.rb:20:in `block in Then'
#
@jimweirich
jimweirich / gist:392685
Created May 6, 2010 20:48
re library version of the regexml example
# This is the regexml URL matching example rewritten to use the Ruby Re library.
#
# Regexml: http://code.google.com/p/regexml/
# Re library: http://github.com/jimweirich/re
URL_PATTERN =
re.any("A-Z", "a-z").one_or_more.capture(:scheme) +
re(":") +
re("//").optional +
re.any("0-9", "A-Z", "a-z", "-@.").one_or_more.capture(:host) +
#!/usr/bin/env ruby"
require 'rake/clean'
require 'rake/testtask'
task :default => :test
Rake::TestTask.new(:test) do |t|
t.warning = true
t.verbose = false