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
| def object_report(type = nil) | |
| if type | |
| puts "number of (#{type}) objects in memory = #{ObjectSpace.each_object(type).count}" | |
| else | |
| puts "number of objects in memory = #{ObjectSpace.each_object.count}" | |
| end | |
| end | |
| def full_report | |
| # report |
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 Person | |
| attr_reader :name | |
| def initialize(name) | |
| @name = name | |
| end | |
| end | |
| Human = Person | |
| alex = Human.new 'alex' |
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
| #!/usr/bin/env ruby | |
| # Usage: ./script/vcr-response-summary | |
| # This script counts all of the response status codes recorded | |
| # in vcr cassettes, prints out a summary, and shows the files that | |
| # have error responses. | |
| output = `grep -rnie 'code: *' spec/fixtures/vcr_cassettes`.chomp | |
| lines = output.split("\n") |
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
| [ | |
| { | |
| "title": "Some title", | |
| "body": "blah blah", | |
| "slug": "some-title", | |
| "created_at": "2013-04-11T15:46:17-07:00", | |
| "author": { | |
| "name": "Joe Author" | |
| } | |
| "comments": [ |
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 'forwardable' | |
| module Things | |
| def name | |
| @name | |
| end | |
| end | |
| class Blah | |
| def name |
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
| module ActionView::Template::Handlers | |
| class Bldr | |
| # @return [String] the rendered template string | |
| def self.call(template, opts = {}) | |
| source = if template.source.empty? | |
| File.read(template.identifier) | |
| else | |
| template.source | |
| 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
| rescue_from(ActiveRecord::RecordNotFound) do |not_found_exception| | |
| render :json => {status: 404, error_code: "not found", message: not_found_exception.message}, :status => 404 | |
| 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
| rvm use 1.9.3-p125 do gem uninstall -a psych | |
| rvm use 1.9.3-p125 do gem install psych -v=1.3.4 | |
| rvm use 1.9.3-p125 | |
| bundle install |
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
| #!/usr/bin/env ruby | |
| # Usage: ./script/pull-request | |
| # | |
| # Run this script after you've pushed your local branch to origin and you're | |
| # ready to create a PR. | |
| # install hub if not in user's $PATH | |
| if `which hub`.chomp == '' | |
| puts "`hub` not found, installing..." |
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
| diff --git a/lib/bldr/node.rb b/lib/bldr/node.rb | |
| index 2d3fa5f..9e19f87 100644 | |
| --- a/lib/bldr/node.rb | |
| +++ b/lib/bldr/node.rb | |
| @@ -23,11 +23,22 @@ module Bldr | |
| @parent = opts[:parent] | |
| @views = opts[:views] | |
| @locals = opts[:locals] | |
| + | |
| + copy_ivars_from_parent(opts[:parent]) if opts[:parent] |