This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source :rubygems | |
# Turbolinks and jQuery.turbolinks without Rails dependencies | |
gem 'turbolinks', :git => 'git://github.com/ronny/turbolinks.git', :branch => 'lite' | |
gem 'jquery-turbolinks', :git => 'git://github.com/ronny/jquery.turbolinks.git', :branch => 'lite' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'test_helper' | |
shared_examples_for 'An Adapter' do | |
describe '#read' do | |
before do | |
@adapter.write(@key = 'whiskey', @value = "Jameson's") | |
end | |
it 'reads a given key' do | |
@adapter.read(@key).must_equal(@value) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding: utf-8 | |
require 'rubygems' | |
require 'benchmark/ips' | |
require 'set' | |
TRUE_VALUES = [true, 1, '1', 't', 'T', 'true', 'TRUE'].to_set | |
def original value | |
if value.is_a?(String) && value.empty? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Add pessmistic locking support. Make sure you're inside a transaction. | |
# resource = MyResource.get(24) | |
# resource.lock! # write lock (FOR UPDATE) | |
# | |
# TODO: | |
# resource = MyResource.get_with_lock!(:write, 24) | |
# resource = MyResource.get_with_lock!(:read, 24) | |
# MyResource.all(:lock => :write) | |
module DataMapper |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rack' | |
require 'thin' | |
module Rack | |
module Test | |
class App | |
# Attempt to run a Rack app server instance in the same process as the a | |
# 'work' block. Came about because you can't see an unsaved DB transaction | |
# inside the Rack app if it happens in another process. | |
# |