do NOT add devise
gem "rails_admin", :git => "git://github.com/sferik/rails_admin.git"
#!/usr/bin/env ruby | |
# Complete rake tasks script for bash | |
# Save it somewhere and then add | |
# complete -C path/to/script -o default rake | |
# to your ~/.bashrc | |
# Xavier Shay (http://rhnh.net), combining work from | |
# Francis Hwang ( http://fhwang.net/ ) - http://fhwang.net/rb/rake-complete.rb | |
# Nicholas Seckar <[email protected]> - http://www.webtypes.com/2006/03/31/rake-completion-script-that-handles-namespaces | |
# Saimon Moore <[email protected]> |
gem install pru | |
bundle exec ruby benchmark.rb > report | |
cat report | pru 'split(/\s+/)' 'reject{|a| a.size != 6 }.map{|a| [a[0], a[1]] }.sort_by(&:last).reverse.map{|a| "#{a[0].ljust(21)} -> #{a[1]}" }.join("\n")' | head -n20 | |
haml -> 0.320000 | |
prawn -> 0.270000 | |
mail -> 0.240000 | |
webrat -> 0.230000 | |
newrelic_rpm -> 0.210000 |
# https://gist.github.com/1214052 | |
require 'sinatra/base' | |
class ResqueWeb < Sinatra::Base | |
require 'resque/server' | |
use Rack::ShowExceptions | |
if CFG[:user].present? and CFG[:password].present? | |
Resque::Server.use Rack::Auth::Basic do |user, password| | |
user == CFG[:user] && password == CFG[:password] |
# drop this in a ruby file in my_rails_app/config/initializers | |
# restart your rails and app you're good to go! | |
class String | |
# remove middle from strings exceeding max length. | |
def ellipsize(options={}) | |
max = options[:max] || 40 | |
delimiter = options[:delimiter] || "..." | |
return self if self.size <= max | |
remainder = max - delimiter.size |
class ResqueGenericJob | |
def self.perform(options={}) | |
options = options.with_indifferent_access | |
klass = options[:class] | |
method = options[:method] | |
if options.has_key?(:args) | |
klass.constantize.send(method, *options[:args]) | |
else | |
klass.constantize.send(method) | |
end |
Rails::Initializer.run do |config| | |
#....... | |
config.middleware.use 'ResqueWeb' | |
end |
# Tag.find_values(:select => :user_id, :limit => 30) --> ["1", "3", "6"] | |
# Tag.find_values(:select => 'user_id, foobar', :limit => 30, :all=>true) --> [["1","A"], ["3","B"], ["6","C"]] | |
class ActiveRecord::Base | |
def self.find_values(options) | |
sql = self.send(:construct_finder_sql, options.except(:all)) | |
result = connection.select_rows(sql, name) | |
if options[:all] | |
result | |
else | |
result.map{|v| v[0] } |
Ever wondered how much who adds/removes, its time to find out :D (those are real stats, i just obfuscated the names )
###Results
Git scores (in LOC):
mr-add : +482273 -9466
justu : +286250 -159905
grosser : +152384 -323344
another : +121257 -82116