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
| match cache.entry(sql) { | |
| Occupied(entry) => Ok(entry.get().clone()), | |
| Vacant(entry) => { | |
| let statement = try!(Statement::prepare(&self.raw_connection, entry.key())); | |
| Ok(entry.insert(CachedStatement::new(statement)).clone()) | |
| } | |
| } |
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
| mod embedded_migrations { | |
| struct EmbeddedMigration { | |
| version: &'static str, | |
| up_sql: &'static str, | |
| }; | |
| impl Migration for EmbeddedMigration { | |
| fn version(&self) -> &str { | |
| self.version | |
| } |
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
| [master][/tmp/qoiwjefoiqwejfoiqwjfoiqwejfioqewjioqfew] cat ~/.rspec | |
| --colour | |
| --order random | |
| --profile 5 | |
| [master][/tmp/qoiwjefoiqwejfoiqwjfoiqwejfioqewjioqfew] ruby -v | |
| ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-darwin14] | |
| [master][/tmp/qoiwjefoiqwejfoiqwjfoiqwejfioqewjioqfew] ber -fd | |
| Randomized with seed 44318 |
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
| bytes | sip | farm | xx | horner | fnv | |
|---|---|---|---|---|---|---|
| 1 | 55 | 40 | 66 | 66 | 1000 | |
| 2 | 100 | 74 | 117 | 133 | 1000 | |
| 4 | 190 | 142 | 222 | 235 | 2000 | |
| 8 | 363 | 210 | 533 | 470 | 2666 | |
| 16 | 640 | 347 | 1000 | 800 | 2285 | |
| 32 | 1103 | 307 | 1684 | 1280 | 2000 | |
| 64 | 1306 | 524 | 2909 | 2206 | 1254 | |
| 128 | 1600 | 636 | 4266 | 3657 | 927 | |
| 256 | 1729 | 785 | 6095 | 5019 | 920 |
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
| scalaVersion := "2.11.6" | |
| libraryDependencies ++= Seq( | |
| "com.chuusai" %% "shapeless" % "2.1.0" | |
| ) |
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 baz(x) | |
| x + yield | |
| end | |
| def bar(&block) | |
| baz(1, &block) | |
| end | |
| def foo(&block) | |
| bar(&block) |
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
| unless File.exist?('Gemfile') | |
| File.write('Gemfile', <<-GEMFILE) | |
| source 'https://rubygems.org' | |
| gem 'rails', github: 'rails/rails' | |
| gem 'arel', github: 'rails/arel' | |
| gem 'sqlite3' | |
| GEMFILE | |
| system 'bundle' | |
| 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
| diff --git a/activerecord/lib/active_record/core.rb b/activerecord/lib/active_record/core.rb | |
| index d957bd1..60d3002 100644 | |
| --- a/activerecord/lib/active_record/core.rb | |
| +++ b/activerecord/lib/active_record/core.rb | |
| @@ -130,7 +130,7 @@ module ActiveRecord | |
| return super if ids.first.kind_of?(Symbol) | |
| return super if block_given? || | |
| primary_key.nil? || | |
| - default_scopes.any? || | |
| + !default_scopes.all?(&:cacheable?) || |
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
| unless File.exist?('Gemfile') | |
| File.write('Gemfile', <<-GEMFILE) | |
| source 'https://rubygems.org' | |
| gem 'rails', github: 'rails/rails' | |
| gem 'arel', github: 'rails/arel' | |
| gem 'sqlite3' | |
| gem 'benchmark/ips' | |
| GEMFILE | |
| system 'bundle' |
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
| ENV['BUNDLE_GEMFILE'] = File.expand_path('../../rails/Gemfile', __FILE__) | |
| require_relative '../rails/load_paths' | |
| require 'active_record' | |
| require 'active_support/all' | |
| # This connection will do for database-independent bug reports. | |
| ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: ':memory:') | |
| ActiveRecord::Schema.define do | |
| create_table :users, force: true do |t| |