This file contains 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/ruby | |
require "rubygems" | |
gem "rb-inotify" | |
require "rb-inotify" | |
notifier = INotify::Notifier.new | |
event_handler = proc do | |
puts "change detected, running CI" |
This file contains 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
buildView: function() { | |
let window = windowUtils.getMostRecentBrowserWindow(); | |
let doc = window.document; | |
let content = doc.getElementById("appcontent"); | |
let splitter = doc.createElementNS(XUL_NS, 'splitter'); | |
splitter.setAttribute("resizeafter","closest") | |
splitter.setAttribute("resizebefore","closest") |
This file contains 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
import java.util.ArrayList; | |
import java.util.List; | |
import java.util.concurrent.CompletableFuture; | |
import java.util.concurrent.ScheduledExecutorService; | |
import java.util.concurrent.ScheduledThreadPoolExecutor; | |
import java.util.concurrent.TimeUnit; | |
import org.openjdk.jmh.annotations.Benchmark; | |
import org.openjdk.jmh.annotations.BenchmarkMode; | |
import org.openjdk.jmh.annotations.Measurement; |
This file contains 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 "cancan/model_adapters/active_record_adapter" | |
class CanCan::ModelAdapters::ActiveRecordAdapter | |
# disable the error when multiple conditions with scopes are used | |
def override_scope | |
return false | |
end | |
# convert where-clauses from relations into sql strings which will be merged by the cancan merge_conditions logic |
This file contains 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 "cancan/model_adapters/active_record_adapter" | |
class CanCan::ModelAdapters::ActiveRecordAdapter | |
# use squeel's symbol-predicates to convert all joins into outer joins | |
# see https://github.com/ryanb/cancan/issues/374 | |
def clean_joins(joins_hash) | |
joins = [] | |
joins_hash.each do |name, nested| | |
name = name.outer if nested.is_a? Hash | |
joins << (nested.empty? ? name : {name => clean_joins(nested)}) |
This file contains 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 "cancan/model_adapters/active_record_adapter" | |
class CanCan::ModelAdapters::ActiveRecordAdapter | |
def merge_conditions(sql, conditions_hash, behavior) | |
conditions_hash = Squeel::Nodes::Literal.new(conditions_hash) if conditions_hash.is_a? String | |
if conditions_hash.blank? | |
Squeel::Nodes::Literal.new(behavior ? true_sql : false_sql) | |
else | |
case sql |
This file contains 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 'active_record' | |
class ReferencedModelA < ActiveRecord::Base; end | |
class ReferencedModelB < ActiveRecord::Base; end | |
class ReferencedModelC < ActiveRecord::Base; end | |
class ModelA < ActiveRecord::Base | |
has_many :referenced_model_a | |
end |
This file contains 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
# encoding: UTF-8 | |
require "cancan/model_adapters/active_record_adapter" | |
class CanCan::Rule | |
def unmergeable? | |
false | |
end | |
end |
This file contains 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 Mhmr::DescendantsTracker | |
def descendants_and_self | |
[self].concat self.descendants | |
end | |
end | |
ActiveSupport::DescendantsTracker.send(:include,Mhmr::DescendantsTracker) | |
jruby: |
This file contains 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
### ruby 1.9.3 + railsexpress patches + GC tuning + -march=native -O3 | |
time ruby script/rails r 'Post.count' | |
real 0m1.008s | |
user 0m0.820s | |
sys 0m0.180s | |
### jruby 1.7.2-dev 2012-12-12 + java 64bit 1.8.0-ea-b67 hotspot 25.0-b11 |
OlderNewer