Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Making Yapp better all the time and likely working on some Ember.js OSS

Luke Melia lukemelia

💭
Making Yapp better all the time and likely working on some Ember.js OSS
View GitHub Profile
View gist:42973
#features/steps/users_steps.rb:
Given "I'm a logged in member" do
@me = create_adult
logged_in_as @me
end
#features/support/env.rb:
class Cucumber::Rails::World
View gist:83377
require "benchmark"
x = 10_000
first_id = Sport.first.id
key = "Sport:#{first_id}"
Sport.set key, Sport.find(first_id) # prime cache
Benchmark.bm(20) do |b|
b.report "Sport.get" do
View gist:83390
74.201.152.100:8298 ->
==> /data/weplay/shared/log/mongrel.5002.log <==
** [Exceptional] Error contacting Exceptional: execution expired
** [Exceptional] /usr/lib64/ruby/1.8/timeout.rb:54:in `rbuf_fill'
/usr/lib64/ruby/1.8/timeout.rb:56:in `timeout'
/usr/lib64/ruby/1.8/timeout.rb:76:in `timeout'
/usr/lib64/ruby/1.8/net/protocol.rb:132:in `rbuf_fill'
/usr/lib64/ruby/1.8/net/protocol.rb:116:in `readuntil'
/usr/lib64/ruby/1.8/net/protocol.rb:126:in `readline'
/usr/lib64/ruby/1.8/net/http.rb:2029:in `read_status_line'
View gist:83579
m_local = MemCache.new('127.0.0.1:11211')
=> <MemCache: 1 servers, ns: nil, ro: false>
>> m_remote = MemCache.new('ey04-s00298:11211')
=> <MemCache: 1 servers, ns: nil, ro: false>
>>
?> first_id = Sport.first.id
=> 1
>> key = "Sport:#{first_id}"
=> "Sport:1"
>> m_local.set key, Sport.find(first_id) # prime cache
View gist:146708
[22:38-focus!][weplay(master)]$ rake db:migrate --trace
(in /Users/lmelia/devprojects/weplay)
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:migrate
== AddJerseyNumberToMembership: migrating ====================================
-- add_column(:memberships, :jersey_number, :string, {:limit=>20})
-> 658.3954s
== AddJerseyNumberToMembership: migrated (658.3955s) =========================
View gist:157861
(::) failed steps (::)
expected 237 +/- (< 20), got 0 (Spec::Expectations::ExpectationNotMetError)
/Users/lmelia/devprojects/weplay/vendor/plugins/rspec/lib/spec/expectations/fail_with.rb:39:in `fail_with'
/Users/lmelia/devprojects/weplay/vendor/plugins/rspec/lib/spec/expectations/handler.rb:21:in `handle_matcher'
/Users/lmelia/devprojects/weplay/vendor/plugins/rspec/lib/spec/expectations/extensions/kernel.rb:27:in `should'
./features/steps/selenium/color_picker_steps.rb:101:in `/^the live preview should have new primary and secondary colors$/'
features/selenium/change_colors.feature:57:in `Then the live preview should have new primary and secondary colors'
expected element matching "#membership_136960 .children" to contain the text "(?-mix:Joe\ Player)", but was "" (Spec::Expectations::ExpectationNotMetError)
View gist:171219
class Admin::SportsController < Admin::AdminController
before_filter :validate_admin_rights
admin_assistant_for Sport do |aa|
aa.actions :index, :create, :update
aa.index.columns :id, :name, :member_count, :groups_count, :enabled, :drills_enabled, :organizations, :player_term
aa.index.per_page 100
aa.index.sort_by 'name ASC'
aa.index.include :organizations
aa[:enabled].label = "Hub Enabled?"
View gist:171220
diff --git a/lib/admin_assistant/request/index.rb b/lib/admin_assistant/request/index.rb
index de6b761..f0371e5 100644
--- a/lib/admin_assistant/request/index.rb
+++ b/lib/admin_assistant/request/index.rb
@@ -15,6 +15,9 @@ class AdminAssistant
@admin_assistant, @controller.params, controller_methods
)
@controller.instance_variable_set :@index, index
+ if @controller.respond_to?(:before_render_for_index)
+ @controller.send :before_render_for_index
View gist:173932
~/devprojects/rails/tools/profile config/environment.rb
cache classes = true
with AS with AA Savings
Mem Objs ms RSS Mem Objs ms RSS Mem Objs ms RSS
236394.54 1574652 26835.9 115492 224070.60 1365837 23570.7 111984
236394.56 1575110 25262.4 115556 224070.81 1365889 23500.1 112024
236394.66 1574652 25886.1 115484 224070.81 1365889 23500.1 112024
236394.66 1574652 25886.1 115484 224070.82 1365837 23754.9 111996
236394.56 1574651 26932.8 115564 224070.82 1365889 23345.8 112028
View gist:178463
Run 1 Run 2 Run 3 Run 4 Run 5 Average
rake spec 119.10 99.09 101.29 100.89 97.69 103.61
rake parallel:spec 90.86 90.19 91.06 87.99 90.63 90.15
Time savings 13.46
Savings as % of orig = 12.99%
Source data: