This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ValidUserRequestHelper | |
def sign_in_as_a_valid_user | |
@user ||= FactoryGirl.create :user | |
post_via_redirect user_session_path, 'user[email]' => @user.email, 'user[password]' => @user.password | |
end | |
end | |
# spec_helper.rb | |
RSpec.configure do |config| | |
config.include ValidUserRequestHelper, :type => :request |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def sumproduct(a, b) | |
sum, i, n = 0, 0, a.size | |
while i < n | |
sum += a[i] * b[i] | |
i += 1 | |
end | |
sum | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Bad | |
<% user_presenter = UserPresenter.new(@user, self) %> | |
<%= user_presenter.name %> | |
<%= user_presenter.avatar %> | |
# Good | |
<% present @user do |user_presenter| %> | |
<%= user_presenter.name %> | |
<%= user_presenter.avatar %> | |
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<% [:notice, :error, :alert].each do |level| %> | |
<% unless flash[level].blank? %> | |
<div class="alert alert-<%= flash_class(level) %>"> | |
<a class="close" href="#">×</a> | |
<%= content_tag :p, flash[level] %> | |
</div> | |
<% end %> | |
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. | |
/Users/earlynovrock/.rvm/rubies/ree-1.8.7-2012.02/bin/ruby extconf.rb | |
Building libmemcached. | |
tar xzf libmemcached-0.32.tar.gz 2>&1 | |
Patching libmemcached source for mark-dead behavior. | |
patch -p1 -f < libmemcached-1.patch | |
patching file libmemcached-0.32/libmemcached/memcached_response.c | |
patching file libmemcached-0.32/libmemcached/memcached.c | |
patching file libmemcached-0.32/libmemcached/memcached.h |
NewerOlder