Skip to content

Instantly share code, notes, and snippets.

View kenmazaika's full-sized avatar

ken mazaika kenmazaika

View GitHub Profile
class CreatePizzas < ActiveRecord::Migration
def change
create_table :pizzas, :options => 'ENGINE=MyISAM' do |t|
t.string :awesome
t.timestamps
end
add_index :pizzas, :awesome, type: 'FULLTEXT'
end
irb(main):027:0> s = AdDistribution.reflect_on_association(:publisher_points).klass.instance_exec(&AdDistribution.reflect_on_association(:publisher_points).scope)
AdDistributionPoint Load (0.3ms) SELECT `ad_distribution_points`.* FROM `ad_distribution_points` WHERE (publisher_id IS NOT NULL)
=> #<ActiveRecord::Relation []>
irb(main):028:0>
# asset_sync gem seems to be incompatible with Rails4. This is
# a very bare-bones s3 asset sync script.
# RAILS_ENV=development bundle exec rake assets:upload_to_s3
namespace :assets do
task :upload_to_s3 => :environment do
require 'aws-sdk'
config = YAML.load(File.open(Rails.root.join("config", "s3.yml")))[Rails.env.to_s]
AWS.config(config)
{
"name":"parent_category",
"id":10,
"subcategories": [
{
"name":"child_category",
"id" 20
}
]
}
@kenmazaika
kenmazaika / ruby2-rails4
Last active December 15, 2015 23:19
thumbs up bro
LM-BOS-00676322:campaign_manager kmazaika$ bundle exec rake
Run options: --seed 3248
# Running tests:
........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
LM-BOS-00676322:campaign_manager kmazaika$ bundle exec rake
Rack::File headers parameter replaces cache_control after Rack 1.5.
Run options:
# Running tests:
...............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
LM-BOS-00676322:campaign_manager kmazaika$ bundle exec rake
Run options: --seed 8221
# Running tests:
........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
LM-BOS-00676322:campaign_manager kmazaika$ bundle exec rake
Run options: --seed 49686
# Running tests:
.......................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
export RUBY_HEAP_MIN_SLOTS=600000
export RUBY_GC_MALLOC_LIMIT=59000000
export RUBY_HEAP_FREE_MIN=100000

Step 2 - Use a performance tweaked verison of ruby

Follow Funny Falcon's guides to performance improvements.