Skip to content

Instantly share code, notes, and snippets.

View bradylove's full-sized avatar

Brady Love bradylove

  • Pivotal
  • Highlands Ranch, CO
View GitHub Profile
@dominickm
dominickm / wiggle.css
Created September 2, 2012 23:43
Wiggle Sample for Coder Radio
@-webkit-keyframes wiggle {
0% {
-webkit-transform:rotate(4deg);
}
50% {
-webkit-transform:rotate(-4deg);
}
100% {
-webkit-transform:rotate(4deg);
}
@pauljamesrussell
pauljamesrussell / spec_helper.rb
Created November 9, 2011 23:15
RSpec matcher for ensuring a model is accepting nested attributes for an association, and accepting/rejecting the right values.
# Use: it { should accept_nested_attributes_for(:association_name).and_accept({valid_values => true}).but_reject({ :reject_if_nil => nil })}
RSpec::Matchers.define :accept_nested_attributes_for do |association|
match do |model|
@model = model
@nested_att_present = model.respond_to?("#{association}_attributes=".to_sym)
if @nested_att_present && @reject
model.send("#{association}_attributes=".to_sym,[@reject])
@reject_success = model.send("#{association}").empty?
end
model.send("#{association}").clear
config.action_mailer.smtp_settings = {
:user_name => "esparkman@sandscreativewoodworks.com",
:password => "mypassword",
:domain => "sandscreativewoodworks.com",
:address => "smtp.gmail.net",
:port => 587,
:authentication => :plain,
:enable_starttls_auto => true
@nu7hatch
nu7hatch / spec_helper.rb
Created October 17, 2010 21:46
Testing standard input with RSpec
...
module Helpers
# Replace standard input with faked one StringIO.
def fake_stdin(*args)
begin
$stdin = StringIO.new
$stdin.puts(args.shift) until args.empty?
$stdin.rewind
yield
@matthutchinson
matthutchinson / fakeout.rake
Created February 10, 2010 16:49
fakeout.rake - a simple/configurable rake task that generates some random fake data for the app (using faker) at various sizes
# a simple/configurable rake task that generates some random fake data for the app (using faker) at various sizes
# NOTE: requires the faker or ffaker gem
# sudo gem install faker - http://faker.rubyforge.org
# OR
# sudo gem install ffaker - http://github.com/EmmanuelOga/ffaker
require 'faker'
class Fakeout