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' | |
require 'minitest/autorun' | |
ActiveRecord::Base.establish_connection(adapter: :sqlite3, database: ":memory:") | |
ActiveRecord::Base.logger = Logger.new(STDOUT) | |
ActiveRecord::Schema.define do |
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
$x = null; | |
$x[0] = 1; | |
echo var_dump($x); | |
/* | |
array(1) { | |
[0]=> | |
int(1) | |
} | |
*/ |
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 WebGLCompiler | |
constructor: (@gl, @shaders) -> | |
createProgramWithShaders: (vertexShaderName, fragmentShaderName) -> | |
vertexShader = @_createShader(vertexShaderName) | |
fragmentShader = @_createShader(fragmentShaderName) | |
@_createProgram(vertexShader, fragmentShader) | |
_createShader: (shaderName) -> | |
shaderSource = @shaders["#{shaderName}.glsl"] |
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
@main = -> | |
canvas = document.getElementsByTagName("canvas")[0] | |
gl = canvas.getContext("webgl") || canvas.getContext("experimental-webgl") | |
compiler = new WebGLCompiler(gl, window.shaders) | |
program = compiler.createProgramWithShaders("main_vertex", "main_fragment") | |
gl.clearColor(1.0, 1.0, 1.0, 1.0) | |
gl.clear(gl.COLOR_BUFFER_BIT) | |
gl.useProgram(program) |
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
val swipe = List( | |
DownEvent(Seq(Vector2(0, 0))), | |
MoveEvent(Seq(Vector2(10, 5))), | |
MoveEvent(Seq(Vector2(15, 10))), | |
MoveEvent(Seq(Vector2(0, 0))), | |
UpEvent(Seq(Vector2(10, 5))) | |
) | |
val events = PublishSubject[MotionEvent] |
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| |
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
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' | |
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
def baz(x) | |
x + yield | |
end | |
def bar(&block) | |
baz(1, &block) | |
end | |
def foo(&block) | |
bar(&block) |