Skip to content

Instantly share code, notes, and snippets.

@jimweirich
jimweirich / output
Created December 27, 2012 14:55
Experimental version of RSpec/Given that handles should-less assertions (i.e. plain Ruby conditions).
1) Natural Assertions
Failure/Error: Then { foo + bar == 2 }
Then expression failed at /Users/jim/working/git/rspec-given/examples/failing/sample_spec.rb:6
expected: 3
to equal: 2
false <- foo + bar == 2
3 <- foo + bar
1 <- foo
2 <- bar
# ./lib/rspec/given/extensions.rb:64:in `_rg_evaluate'
Capybara.add_selector :record do
xpath { |record| XPath.css("#" + ActionController::RecordIdentifier.dom_id(record)) }
match { |record| record.is_a?(ActiveRecord::Base) }
end
@chendo
chendo / 0-readme.md
Created November 13, 2012 03:33
Fast require patch for 1.9.3-p327

A daily glance at what's happening in a high velocity codebase, thanks to @defunkt:

https://github.com/your/repo/compare/master@{yesterday}...master

Bookmark, share, and enjoy.

@garybernhardt
garybernhardt / gist:3180009
Created July 26, 2012 03:05
An excerpt from GCC's reload.c
static int
find_reusable_reload (rtx *p_in, rtx out, enum reg_class rclass,
enum reload_type type, int opnum, int dont_share)
{
rtx in = *p_in;
int i;
/* We can't merge two reloads if the output of either one is
earlyclobbered. */
if (earlyclobber_operand_p (out))
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active May 11, 2026 16:00
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@tomykaira
tomykaira / rack.md
Created May 19, 2012 17:17
Brief Introduction to Rack -- from codereading activity

Brief Introduction to Rack

@tomy_kaira

Rack

Specification

for communication between Server and Ruby WAF

@joshsusser
joshsusser / silence_assets.rb
Created April 17, 2012 22:34
put in config/initializers to silence asset logging in Rails development mode
if Rails.env.development?
Rails.application.assets.logger = Logger.new('/dev/null')
Rails::Rack::Logger.class_eval do
def call_with_quiet_assets(env)
previous_level = Rails.logger.level
Rails.logger.level = Logger::ERROR if env['PATH_INFO'] =~ %r{^/assets/}
call_without_quiet_assets(env)
ensure
@steveclarke
steveclarke / capybara.md
Created April 10, 2012 17:32
RSpec Matchers

Capybara

save_and_open_page

Matchers

have_button(locator)
@them0nk
them0nk / rspec_rails_cheetsheet.rb
Created March 23, 2012 03:39
Rspec Rails cheatsheet (include capybara matchers)
#Model
@user.should have(1).error_on(:username) # Checks whether there is an error in username
@user.errors[:username].should include("can't be blank") # check for the error message
#Rendering
response.should render_template(:index)
#Redirecting
response.should redirect_to(movies_path)