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 NotesController < ApplicationController | |
def index | |
notes = requested_notes | |
respond_to do |format| | |
format.html do | |
render :index, locals: { notes: notes } | |
end | |
format.json do | |
render :index, locals: { notes: notes } if stale? notes | |
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
# transaction/truncation strategies won't work when you have a | |
# capybara feature and you must preserve what's already in the | |
# database | |
# | |
# Usage: | |
# include TrackedLet | |
# | |
# track(:foo) { User.create } | |
# track!(:foo) { User.create } | |
# specify { expect(track(User.create)).to be_persisted } |
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
foo://username:[email protected]:8042/over/there/index.dtb?type=animal&name=narwhal#nose | |
\_/ \_______________/ \_________/ \__/ \___/ \_/ \______________________/ \__/ | |
| | | | | | | | | |
| userinfo host port | | query fragment | |
| \________________________________/\_____________|____|/ \__/ \__/ | |
scheme | | | | | | | |
name authority | | | | | | |
| path | | interpretable as keys | |
| | | | |
| \_______________________________________________|____|/ \____/ \_____/ |
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
#!/usr/bin/env ruby | |
ENV['RAILS_ENV'] = 'test' | |
require 'benchmark' | |
rails_loading_time = Benchmark.measure { require './config/environment' } | |
puts "Rails env loaded in #{rails_loading_time}" | |
NUM_FORKS = 2 | |
test_groups = `find ./spec -type f -iname "*foobar*"`.split("\n").in_groups(NUM_FORKS).to_a |
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 'jekyll', '~> 2.0.0.alpha' | |
gem 'nokogiri' | |
gem 'redcarpet' | |
gem 'rouge' |
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
ruby-2.0.0-p353 |
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 'spec_helper' | |
describe SimplySettings do | |
before do | |
Rails.cache.clear | |
end | |
subject(:settings) { SimplySettings } |
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
RSpec.configure do |config| | |
config.around(:each) do |example| | |
# disabled by design | |
# example.call | |
end | |
end | |
__END__ | |
if i have the above rspec config in `spec_helper.rb` and i run a test |
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
#!/bin/bash | |
for path in `rbenv root`"/versions/"*; do | |
if [ -d "$path" ] && [ ! -h "$path" ]; then | |
export RBENV_VERSION="${path##*/}" | |
echo "=== Running 'rake spec' for $RBENV_VERSION ===" | |
rm -f Gemfile.lock | |
rbenv exec bundle install --local | |
rbenv exec rake spec | |
echo && echo |
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
#!/usr/bin/env ruby | |
# A simply utility to show character counts for each line of input and | |
# highlight lines longer than 80 characters. | |
# | |
# Written as an example for http://jstorimer.com/2011/12/12/writing-ruby-scripts-that-respect-pipelines.html | |
# | |
# Examples: | |
# | |
# $ hilong Gemfile |
NewerOlder