Skip to content

Instantly share code, notes, and snippets.

View vitobotta's full-sized avatar

Vito Botta vitobotta

View GitHub Profile
@denji
denji / heroku.rake
Last active June 17, 2018 14:21 — forked from phoet/heroku.rake
heroku GC settings generator for rails
namespace :heroku do
desc "generate GC settings"
task gc: [:environment] do
# https://discussion.heroku.com/t/tuning-rgengc-2-1-on-heroku/359/6
# http://tmm1.net/ruby21-rgengc/
# http://thorstenball.com/blog/2014/03/12/watching-understanding-ruby-2.1-garbage-collector/
# http://collectiveidea.com/blog/archives/2015/02/19/optimizing-rails-for-memory-usage-part-1-before-you-optimize/
settings = {
RUBY_GC_HEAP_FREE_SLOTS: 600000, # default is 4096,
RUBY_GC_HEAP_GROWTH_FACTOR: 1.25, # default is 1.8,
@vitobotta
vitobotta / example.feature
Created June 4, 2012 21:32 — forked from matschaffer/example.feature
Cucumber - confirmation box with JavaScript
@javascript
Scenario: confiming when saving inactive
Given I expect to click "OK" on a confirmation box saying "Are you sure?"
When I press "Save"
Then the confirmation box should have been displayed
And I should see "TV" in the "Campaign Keywords" section
@vitobotta
vitobotta / indexes.rake
Created September 13, 2011 16:42
List unindexed foreign keys
namespace :indexes do
desc "List unindexed foreign keys"
task :unindexed_foreign_keys => :environment do
ActiveRecord::Base.logger = Logger.new('/dev/null')
missing_indexes = {}
connection = ActiveRecord::Base.connection
connection.tables.collect do |table|