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
class Conductor | |
include ActiveModel::Conversion | |
extend ActiveModel::Naming | |
include ActiveModel::Validations | |
class_attribute :object_names | |
def self.presents(*object_names) | |
self.object_names = object_names | |
object_names.each do |object_name| |
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
class SignUpPage | |
def initialize | |
current_path.should == sign_up_path | |
end | |
def with_email(email) | |
fill_in "Login", :with => email | |
end | |
def with_password(password, confirmation = password) |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<project version="4"> | |
<component name="ProjectModuleManager"> | |
<modules> | |
<module fileurl="file://$PROJECT_DIR$/custom_engine1/module1.iml" filepath="$PROJECT_DIR$/custom_engine1/custom_engine1.iml" /> | |
<module fileurl="file://$PROJECT_DIR$/custom_engine2/module2.iml" filepath="$PROJECT_DIR$/custom_engine2/custom_engine2.iml" /> | |
</modules> | |
</component> | |
</project> |
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
File: lib/tasks/bar.rake | |
class BarOutput | |
def self.banner text | |
puts '*' * 60 | |
puts " #{text}" | |
puts '*' * 60 | |
end | |
def self.puts string | |
puts string |
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
require 'rspec/core' | |
class VeryImportantQuestions | |
def self.really?(answer) | |
answer == 'Yes. I am telling you.' | |
end | |
def self.really_really?(answer) | |
answer == 'Yes. I am telling you.' ? 42 : nil | |
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
require 'rspec/core' | |
class TheClassThatIsTrueButNeverInTheSameWay | |
def initialize(truthiness) | |
@truthiness = truthiness | |
end | |
def truthy? | |
@truthiness ? Time.now : false | |
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
#lives in spec/support/object_creation_methods.rb | |
# Source: https://pivotallabs.com/users/jdean/blog/articles/1900-rolling-your-own-object-creation-methods-for-specs | |
module ObjectCreationMethods | |
def new_post(overrides = {}) | |
defaults = {:title => "Some title #{counter}"} | |
Post.new { |post| apply(post, defaults, overrides) } | |
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
<% if Rails.env != 'production' %> | |
document.addEventListener("DOMContentLoaded", function() { | |
$('body').append($('<div>').css({ | |
display: 'block', | |
position: 'fixed', | |
left: '20px', | |
top: '500px', | |
'-webkit-transform': 'rotate(-90deg)', | |
'-moz-transform': 'rotate(-90deg)', | |
'-o-transform': 'rotate(-90deg)', |
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
#Count the lines of Ruby code in your app | |
find . -iname "*.rb" -type f -exec cat {} \; | wc -l |
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
#Sort the Ruby files in your project by LOC | |
find . -iname "*.rb" -type f -exec wc -l {} \; | sort -rn |