$ git diff HEAD^..HEAD
diff --git a/example.rb b/example.rb
index 9c145d2..a5d3df4 100644
--- a/example.rb
+++ b/example.rb
@@ -2,7 +2,7 @@ class Example
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
# List of IDs of entities to be processed | |
ids = ("a".."z").to_a | |
# Break in groups of 5 (or any other number) | |
groups = ids.each_slice(5) | |
# Make sure that exceptions will spread. | |
# By default the are silenced within threads | |
# so you want know why your program crashed. | |
Thread.abort_on_exception = true |
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
heroku run rails c --no-tty --app APP < FILE_PATH > OUTPUT_PATH |
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 'rubygems' | |
require 'pp' | |
#require 'ap' # Awesome Print | |
class Object | |
# expects [ [ symbol, *args ], ... ] | |
def recursive_send(*args) | |
args.inject(self) { |obj, m| obj.send(m.shift, *m) } | |
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
# support/setup.rb | |
def in_browser(name) | |
old_session = Capybara.session_name | |
Capybara.session_name = name | |
yield | |
ensure | |
Capybara.session_name = old_session | |
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
=Navigating= | |
visit('/projects') | |
visit(post_comments_path(post)) | |
=Clicking links and buttons= | |
click_link('id-of-link') | |
click_link('Link Text') | |
click_button('Save') | |
click('Link Text') # Click either a link or a button | |
click('Button Value') |
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
$ heroku pg:backups capture --app {app name} | |
$ curl -o latest.dump `heroku pg:backups public-url --app {app name}` | |
$ pg_restore --verbose --clean --no-acl --no-owner -h localhost -U {myuser} -d {mydb} latest.dump |
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 "rails_helper" | |
# In this example I'm testing a module that introduces some | |
# AR validations to the model. Using shoulda matchers, as I | |
# normally would in a model spec, works just fine :-) | |
describe "Scopable concern" do | |
before do | |
Temping.create :parent_model do | |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
# Commented lines mean that this would be the assumption unless otherwise is not specified | |
# so: | |
# unless validates_as: is specified, it is validated as a :string | |
# unless required: true is specified, it is required: false | |
module CollectionJson | |
module Spec | |
definition do | |
defines :href, validates_as: :url | |
NewerOlder