Skip to content

Instantly share code, notes, and snippets.

Rails naming conventions

General Ruby conventions

Class names are CamelCase.

Methods and variables are snake_case.

Methods with a ? suffix will return a boolean.

@michaeldcruz
michaeldcruz / bulk_load.json
Created April 22, 2013 16:03
Elasticsearch parent/child relationship example
# Bulk Sample Data
curl -s -XPOST localhost:9200/_bulk?pretty=true --data-binary '
{ "index" : { "_index" : "products", "_type" : "style_variant", "_id" : "1" } }
{ "name" : "Style Variant 1" }
{ "index" : { "_index" : "products", "_type" : "style_variant", "_id" : "2" } }
{ "name" : "Style Variant 2" }
{ "index" : { "_index" : "products", "_type" : "style_variant", "_id" : "3" } }
{ "name" : "Style Variant 3" }
{ "index" : { "_index" : "products", "_type" : "product", "_id" : "1", "parent" : "1" } }
{ "name" : "Shirt 1", "vendor_name" : "Alternative Apparel", "size" : "S", "retail_price": 100, "tc_color" : "Black" }
@michaeldcruz
michaeldcruz / heroku.rake
Created September 15, 2012 17:11 — forked from njvitto/deploy.rake
Rakefile to deploy and rollback to Heroku to multiple environments
#Deploy and rollback on Heroku in staging and production
task :deploy_staging => ['deploy:set_staging_app', 'deploy:push', 'deploy:restart', 'deploy:tag']
task :deploy_production => ['deploy:set_production_app', 'deploy:push', 'deploy:restart', 'deploy:tag']
namespace :deploy do
PRODUCTION_APP = 'tc-api-prod'
STAGING_APP = 'tc-api-staging'
task :staging_migrations => [:set_staging_app, :push, :off, :migrate, :restart, :on, :tag]
task :staging_rollback => [:set_staging_app, :off, :push_previous, :restart, :on]