Skip to content

Instantly share code, notes, and snippets.

View hoverlover's full-sized avatar

Chad Boyd hoverlover

View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@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
@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
@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')
@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")
@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
@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
// Mixins ---------------------------------------------------------------
=placeholder
&::-webkit-input-placeholder
@children
&:-moz-placeholder
@children
&.placeholder
@children
@nathos
nathos / fancy-hover-mixin.sass
Last active September 25, 2015 17:47
Compass fancy-hover - snazzy-looking image replacement hovers with an animated opacity ramp. Now using Compass sprites so you don't have to do the dirty work! See the demo at http://nathos.github.com/fancy-hovers/
@mixin fancy-hover($sprite_dir, $off_state, $hover_state, $speed: 0.3s)
$sprites: sprite-map("#{$sprite_dir}/*.png")
$width: image-width(sprite_file($sprites, $off_state))
$height: image-height(sprite_file($sprites, $off_state))
@include hide-text
width: $width
height: $height
background: sprite($sprites, $off_state) no-repeat
display: block
position: relative
@Gregg
Gregg / gist:968534
Created May 12, 2011 13:54
Code School Screencasting Framework

Screencasting Framework

The following document is a written account of the Code School screencasting framework. It should be used as a reference of the accompanying screencast on the topic.

Why you should care about screencasting?

You're probably aren't going to take the time to read this document if you're not interested, but there are a lot of nice side effects caused by learning how to create quality screencasts.

  1. Communicating more effectively - At Envy Labs we produce screencasts for our clients all the time. Whether it's demoing a new feature or for a presentation for an invester, they're often much more effective and pleasent than a phone call or screen sharing.