This file contains hidden or 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 'json' | |
require 'octokit' | |
require 'time' | |
def log | |
file = './github_api_latest_release.json' | |
File.open(file, 'a+') { |f| f << yield } | |
end |
This file contains hidden or 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 Thing | |
if ENV['DEFINE_NESTED_CLASS'] | |
class SpecificThing | |
def identify | |
'nested' | |
end | |
end | |
end | |
end |
This file contains hidden or 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 CustomError < StandardError | |
def initialize(e = nil) | |
super e | |
set_backtrace e.backtrace if e | |
end | |
end | |
def run | |
r = Runner.new | |
r.fail |
This file contains hidden or 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 ThingsController < ApplicationController | |
respond_to :html, :json | |
before_filter { @thing = {one: 1, two: 2} } | |
# /things/a -> renders template at things/a.html.erb | |
# /things/a.json -> renders @thing.to_json | |
def a | |
respond_with @thing | |
end |
This file contains hidden or 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
# Using Rails 2.2.2 and RSpec + RSpec-Rails 1.1.11, | |
# | |
# The specs below all pass when I run: | |
# $ ./script/spec spec/controllers/admin/status_controller_spec.rb | |
# | |
# But when I run: | |
# $ rake spec | |
# all three fail with: | |
# | |
# 1) |