Skip to content

Instantly share code, notes, and snippets.

View hoverlover's full-sized avatar

Chad Boyd hoverlover

View GitHub Profile
// Mixins ---------------------------------------------------------------
=placeholder
&::-webkit-input-placeholder
@children
&:-moz-placeholder
@children
&.placeholder
@children
@chrisyoung
chrisyoung / slow cucumber test fix
Created March 4, 2011 00:57
Increase the java heap size to speed up your culerity/cucumber tests
My culerity/cucumber tests were running at 30 minutes, now just six. JRuby was limiting the allocated memory to 512mb (or something). I increased this to a gigabyte and now everything flies:
>> JRUBY_INVOCATION="jruby -J-Xmx1024m" cucumber
More Info:
http://viralpatel.net/blogs/2009/01/jvm-java-increase-heap-size-setting-heap-size-jvm-heap.html
@capitalist
capitalist / this_works.rb
Created December 22, 2010 21:38
View specs for controllers that use decent_exposure
#in my spec helper
def expose(name, &block)
exhibitionist = Module.new
exhibitionist.send(:define_method, name, &block)
view.extend exhibitionist
end
# in my view spec
describe "dashboard/index.html.haml" do
it 'renders' do
@dnagir
dnagir / rspec-syntax-cheat-sheet.rb
Created November 5, 2010 09:29
RSpec 2 syntax cheat sheet by example
# RSpec 2.0 syntax Cheet Sheet by http://ApproachE.com
# defining spec within a module will automatically pick Player::MovieList as a 'subject' (see below)
module Player
describe MovieList, "with optional description" do
it "is pending example, so that you can write ones quickly"
it "is already working example that we want to suspend from failing temporarily" do
pending("working on another feature that temporarily breaks this one")
@zhengjia
zhengjia / capybara cheat sheet
Created June 7, 2010 01:35
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@hoverlover
hoverlover / enumerable_constants.rb
Created May 25, 2010 16:02
Module to facility the enumeration of constants
# This module should be used for situations where enumerating over constant values is desired.
# This facilitates keeping the code DRY by keeping the constant values defined in one place, and
# still having the ability to enumerate over them wherever they are needed.
#
# Example use cases:
#
# * defining constants for possible field values in an AR object and including this module to
# provide access to the values in a 'validates_inclusion_of' validation
# * defining constants for select box values in a view and including this module to allow them to be
# enumerated over in the select tag
@celldee
celldee / heart_monitor.rb
Created August 11, 2009 15:55
Testing heartbeat monitoring with RabbitMQ and Bunny
require 'bunny' # Change this to point to the test version of bunny.rb otherwise you will probably be asking for the gem
require 'timeout'
b = Bunny.new(:logging => true, :heartbeat => 30) # Set heartbeat to 30 seconds
# Create a new heartbeat frame
hb = Qrack::Transport::Heartbeat.new()
b.start
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.