Skip to content

Instantly share code, notes, and snippets.

View davestevens's full-sized avatar

Dave Stevens davestevens

View GitHub Profile
@afeld
afeld / gist:5704079
Last active November 27, 2023 15:43
Using Rails+Bower on Heroku
@17twenty
17twenty / fizzbuzz.c
Last active February 11, 2021 14:01
Shortest FizzBuzz in C. Implicit declaration of printf but libc is linked against any way so nyeh.
main(i){for(;i++<100;)printf(i%3?i%5?"%d\n":"Buzz\n":i%5?"Fizz\n":"FizzBuzz\n",i);}
@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)
@cpetschnig
cpetschnig / i18n_lookup.rb
Created January 11, 2012 13:32
Log failed I18n lookups in Rails
class I18n::Backend::Simple
module Implementation
protected
def lookup(locale, key, scope = [], options = {})
init_translations unless initialized?
keys = I18n.normalize_keys(locale, key, scope, options[:separator])
keys.inject(translations) do |result, _key|