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
| # Run this file with ruby --enable-frozen-string-literal test.rb | |
| # and then without the frozen string literal option and see the difference | |
| class Foo | |
| def initialize(v) | |
| @v = v | |
| end | |
| attr_accessor :v |
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 'benchmark/ips' | |
| def tell_ape_with_block(&block) | |
| tell_ape_block(&block) | |
| end | |
| def tell_ape_block(&block) | |
| block.call | |
| 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
| # Gets around the difficulty of passing params with | |
| # nested hashes as as of Rails 5.0, ActionController::Parameters | |
| # no longer inherits from Hash. | |
| # | |
| # By default checks the params hash for the attributes contained in attrs | |
| # and returns a hash containing the same values | |
| def permit_params(params, attrs) | |
| whitelisted_params = HashWithIndifferentAccess.new | |
| attrs.each do |attr| |
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
| <head> | |
| <meta charset="utf-8"> | |
| <meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
| <!-- This one here!--> | |
| <meta name="description" content=""> | |
| <meta name="fragment" content="!"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no"> | |
| <base href="/index.html"> |