Skip to content

Instantly share code, notes, and snippets.

# encoding: utf-8
def λ(&block)
block
end
I = λ { |x| x }
I.(3) # => 3
##### Pointless: #####
# Bad:
Foo.new.tap do |foo|
foo.bar = "<3"
end
# Good:
foo = Foo.new
foo.bar = "<3"
class A
def foo
"<3"
end
end
class B < A
def foo
# super will still call A#foo, even after the method is aliased
super * 2
$ ruby ~/Desktop/test.rb
Active Record 3.0.10
-- create_table(:foos)
-> 0.6120s
-- create_table(:bars)
-> 0.0008s
size: 0
count: 0
length: 0
gem 'rails', '3.1.1.rc2'
require 'active_record'
puts "Active Record #{ActiveRecord::VERSION::STRING}"
ActiveRecord::Base.establish_connection(
:adapter => 'sqlite3',
:database => ':memory:'
)
$ bundle exec rspec spec/integration/
..............................................................................F..................................................................................................................................................................................................................................................................................................................................................................................................
Failures:
1) Capybara::Session with poltergeist driver it should behave like session it should behave like check#check unchecking should not change an already unchecked checkbox
Failure/Error: @session.uncheck('form_pets_cat')
Capybara::Poltergeist::DeadClient:
The PhantomJS client died while processing {"name":"visible","args":[1]}
Shared Example Group: "check" called from
page = require('webpage').create()
page.content =
"<html>
<body>
<div id='foo' style='width: 100px; height: 400px;'></div>
</body>
</html>"
page.onConsoleMessage = (message) ->
#!/usr/bin/env ruby
# Used to convert Rails CHANGELOGs to Markdown format.
# Usage: convert_changelog_to_markdown.rb CHANGELOG > CHANGELOG.md
text = File.read(ARGV[0])
processed = ''
def fixup_line(line)
conversions = {}
Encoding.list.each do |from|
Encoding.list.each do |to|
if from != to
begin
Encoding::Converter.new(from, to)
rescue Encoding::ConverterNotFoundError
else
conversions[from.to_s] ||= []
$ gdb /usr/local/bin/ruby
GNU gdb (GDB) Fedora (7.3.1-45.fc15)
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...