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
[nwiger@pdsd65-31-27:mongo]$ irb | |
irb(main):001:0> require 'mongo_mapper' | |
NameError: uninitialized constant MongoMapper::Associations::ManyDocumentsProxy::MongoMapper | |
from /usr/playerconnect-stack-2009e/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:105:in `rescue in const_missing' | |
from /usr/playerconnect-stack-2009e/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:94:in `const_missing' | |
from /usr/playerconnect-stack-2009e/lib/ruby/gems/1.9.1/gems/mongo_mapper-0.5.5/lib/mongo_mapper/associations/many_documents_proxy.rb:7:in `<class:ManyDocumentsProxy>' | |
from /usr/playerconnect-stack-2009e/lib/ruby/gems/1.9.1/gems/mongo_mapper-0.5.5/lib/mongo_mapper/associations/many_documents_proxy.rb:3:in `<module:Associations>' | |
from /usr/playerconnect-stack-2009e/lib/ruby/gems/1.9.1/gems/mongo_mapper-0.5.5/lib/mongo_mapper/associations/many_documents_proxy.rb:2:in `<module:MongoMapper>' | |
from /usr/playerconnect-stack-2009e/lib/ruby/gems/1.9.1/gems/mongo_mappe |
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
--- mongo_mapper-0.5.5/lib/mongo_mapper/associations/many_documents_proxy.rb.orig 2009-10-22 10:55:04.000000000 -0700 | |
+++ mongo_mapper-0.5.5/lib/mongo_mapper/associations/many_documents_proxy.rb 2009-10-22 10:54:26.000000000 -0700 | |
@@ -4,7 +4,7 @@ | |
delegate :klass, :to => :@association | |
delegate :collection, :to => :klass | |
- include MongoMapper::Finders | |
+ include ::MongoMapper::Finders | |
def find(*args) |
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
-- Bulk updating your pending Wordpress comments as spam when you have thousands of them. | |
mysql> select comment_approved, count(*) from wp_comments group by comment_approved; | |
+------------------+----------+ | |
| comment_approved | count(*) | | |
+------------------+----------+ | |
| 0 | 2052 | | |
| 1 | 3 | | |
| spam | 441 | | |
+------------------+----------+ |
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
diff --git a/lib/redis/text_search/collection.rb b/lib/redis/text_search/collection.rb | |
index 3e3afe8..fcec4d2 100644 | |
--- a/lib/redis/text_search/collection.rb | |
+++ b/lib/redis/text_search/collection.rb | |
@@ -118,6 +118,19 @@ module Redis::TextSearch | |
@total_entries = number.to_i | |
@total_pages = (@total_entries / per_page.to_f).ceil | |
end | |
+ | |
+ # returns the current start ordinal of the paginated collection |
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
perl -pi -e 's/CLAD/BKOC/g' test.txt | |
perl -pi.bak -e 's/CLAD/BKOC/g' test.txt |
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/env ruby | |
# Results (Mac laptop): | |
# user system total real | |
# effigy 1.100000 0.010000 1.110000 ( 1.166467) | |
# erubis 0.260000 0.000000 0.260000 ( 0.265821) | |
class Post < Struct.new(:id, :title, :body, :comments) | |
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 'rubygems' | |
require 'rack' | |
class Rack | |
class PlayCo | |
class RequestValidator | |
# ==== Parameters | |
# app<Rack::Builder>:: The Rack builder which will use this middleware. | |
# path_opts<Hash>:: Path options used to identify path to validate. |
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/env ruby | |
require 'rubygems' | |
require 'redis/objects' | |
require 'benchmark' | |
$redis = Redis.new(:host => '127.0.0.1', :port => 6379, :thread_safe => true) | |
require 'redis/sorted_set' | |
lb = Redis::SortedSet.new('rank:overall:by_points') |
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/env ruby | |
$:.unshift File.expand_path "#{File.dirname(__FILE__)}/../friendly/lib" | |
require 'mysqlplus' | |
require 'friendly' | |
require "rbench" | |
require 'uuid4r' | |
# Choose how many times you want to repeat each benchmark. |
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 compat for FasterCSV (painful) | |
# http://matthewbass.com/2008/01/05/csv-transmogrifies-into-fastercsv-in-ruby-19/ | |
require 'csv' | |
if CSV.const_defined? :Reader | |
require 'faster_csv' # For CSV data files | |
else | |
FasterCSV = CSV | |
end | |
namespace :db do |
OlderNewer