Skip to content

Instantly share code, notes, and snippets.

View dvdasari's full-sized avatar

DV Dasari dvdasari

View GitHub Profile
# rails g model Book name:string:index description:text ‘cost:decimal{5,2}’
class CreateBooks < ActiveRecord::Migration
def change
create_table :books do |t|
t.string :name
t.text :description
t.decimal :cost, precision: 5, scale: 2
t.timestamps
end
# rails g model Book name:string:index isbn:string:uniq description:text user:references content:string{30}
class CreateBooks < ActiveRecord::Migration
def change
create_table :books do |t|
t.string :name
t.string :isbn
t.text :description
t.references :user, index: true
t.string :content, limit: 30
# /etc/init/sidekiq.conf - Sidekiq config
# This example config should work with Ubuntu 12.04+. It
# allows you to manage multiple Sidekiq instances with
# Upstart, Ubuntu's native service management tool.
#
# See workers.conf for how to manage all Sidekiq instances at once.
#
# Save this config as /etc/init/sidekiq.conf then mange sidekiq with:
# sudo start sidekiq index=0
# /etc/init/workers.conf - manage a set of Sidekiqs
# This example config should work with Ubuntu 12.04+. It
# allows you to manage multiple Sidekiq instances with
# Upstart, Ubuntu's native service management tool.
#
# See sidekiq.conf for how to manage a single Sidekiq instance.
#
# Use "stop workers" to stop all Sidekiq instances.
# Use "start workers" to start all instances.
@dvdasari
dvdasari / gist:6e1ea0e69d0050581fb8
Last active August 29, 2015 14:06
config/initializers/sidekiq.rb
if Rails.env.production?
Sidekiq.configure_server do |config|
config.redis = { :url => 'redis://10.0.WX.YZ:6379/12', :namespace => 'sidekiq' }
end
Sidekiq.configure_client do |config|
config.redis = { :url => 'redis://10.0.WX.YZ:6379/12', :namespace => 'sidekiq' }
end
end
@dvdasari
dvdasari / gist:7c4662583761baf11001
Created September 9, 2014 02:34
vlad config/deploy.rb
require 'vlad/sidekiq'
task "vlad:deploy" => %w[
vlad:update
vlad:bundle:install
vlad:migrate
vlad:assets:precompile
vlad:sidekiq:restart
vlad:start_app
vlad:cleanup
lib/tasks/act_celluloid.rake
namespace :act_celluloid do
task :crawl => :environment do
app_ids = get_items
supervisor = Celluloid::SupervisionGroup.run!
supervisor.pool(AppActor, as: :app_actors, size: 10)
futures = []