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
class String | |
def force_valid_encoding | |
find_encoding(Encoding.list.to_enum) | |
end | |
def safe_encode(name) | |
force_valid_encoding | |
encode(name, :undef => :replace, :invalid => :replace, :replace => "") | |
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 CustomDatabase | |
extend ActiveSupport::Concern | |
included do | |
store_in database: custom_database | |
end | |
module ClassMethods | |
def custom_database |
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
connection = ActiveRecord::Base.connection | |
connection.tables.each do |table| | |
columns = connection.columns(table).collect(&:name).select {|x| x.ends_with?("_id" || x.ends_with("_type"))} | |
indexed_columns = connection.indexes(table).collect(&:columns).flatten.uniq | |
unindexed = columns - indexed_columns | |
unless unindexed.empty? | |
puts "#{table}: #{unindexed.join(", ")}" | |
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
require "benchmark" | |
Benchmark.bm do |bm| | |
string = "1232wrodsfds123123" | |
bm.report("named char") do | |
10000000.times do | |
string =~ /[:digit:]/ | |
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
+----------------------+-------+-------+---------+---------+-----+-------+ | |
| Name | Lines | LOC | Classes | Methods | M/C | LOC/M | | |
+----------------------+-------+-------+---------+---------+-----+-------+ | |
| Library | 23212 | 9182 | 160 | 1174 | 7 | 5 | | |
| Specs | 64589 | 48395 | 189 | 117 | 0 | 411 | | |
+----------------------+-------+-------+---------+---------+-----+-------+ | |
| Total | 87801 | 57577 | 349 | 1291 | 3 | 42 | | |
+----------------------+-------+-------+---------+---------+-----+-------+ |
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
/Users/durran/work/origin/lib/origin.rb:2: [BUG] gc_sweep(): unknown data type 0x0(0x7ff83cd95ad0) | |
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin11.2.0] | |
-- Control frame information ----------------------------------------------- | |
c:0020 p:---- s:0064 b:0064 l:000063 d:000063 CFUNC :require | |
c:0019 p:0011 s:0060 b:0060 l:000059 d:000059 TOP /Users/durran/work/origin/lib/origin.rb:2 | |
c:0018 p:---- s:0058 b:0058 l:000057 d:000057 FINISH | |
c:0017 p:---- s:0056 b:0056 l:000055 d:000055 CFUNC :require | |
c:0016 p:0092 s:0052 b:0052 l:000051 d:000051 TOP /Users/durran/work/origin/spec/spec_helper.rb:5 | |
c:0015 p:---- s:0050 b:0050 l:000049 d:000049 FINISH |
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
Finished in 55.62 seconds | |
7407 examples, 0 failures, 3 pending | |
rake 48.13s user 2.03s system 82% cpu 1:00.78 total |
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
@mode ➜ mongoid rvm:(-ruby-1.9.3@mongoid) git:(master) git shortlog -s -n | |
3153 Durran Jordan | |
113 Jacques Crocker | |
57 Chris Griego | |
51 Hans Hasselberg | |
49 Bernerd Schaefer | |
42 Dave Ott and Durran Jordan | |
41 Cyril Mougel | |
37 brainopia | |
31 Durran Jordan and Tim Pope |
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
#<ActiveSupport::Callbacks::Callback:0x007fe6fd1e6748 @klass=Document, @kind=:around, @chain=[#<ActiveSupport::Callbacks::Callback:0x007fe6fd3306f8 @klass=Document, @kind=:around, @chain=[#<ActiveSupport::Callbacks::Callback:0x007fe6fd3306f8 ...>], @per_key={:if=>[], :unless=>[]}, @options={:prepend=>true, :if=>[], :unless=>[]}, @raw_filter=#<StateMachine::Machine:0x007fe6fd33d5d8 @integration=StateMachine::Integrations::Mongoid, @name=:status, @attribute=:status, @events=#<StateMachine::EventCollection:0x007fe6fd33a5b8 @machine=#<StateMachine::Machine:0x007fe6fd33d5d8 ...>, @nodes=[#<StateMachine::Event name=:status_progress transitions=[:waiting_assignment => :in_progress]>], @index_names=[:name, :qualified_name], @indices={:name=>{:status_progress=>#<StateMachine::Event name=:status_progress transitions=[:waiting_assignment => :in_progress]>}, :name_to_s=>{"status_progress"=>#<StateMachine::Event name=:status_progress transitions=[:waiting_assignment => :in_progress]>}, :name_to_sym=>{:status_progress=>#<S |
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
http://travis-ci.org/#!/mongoid/mongoid/jobs/720136 | |
http://travis-ci.org/#!/mongoid/mongoid/jobs/720137 | |
http://travis-ci.org/#!/mongoid/mongoid/jobs/720138 | |
Only affects MRI, the JRuby output is fine for me... | |