Skip to content

Instantly share code, notes, and snippets.

View igorsokolov's full-sized avatar

Igor Sokolov igorsokolov

  • San Francisco, CA, US
View GitHub Profile
@igorsokolov
igorsokolov / introrx.md
Created April 19, 2016 01:52 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
db.createUser(
{
user: "<username>",
pwd: "<password>",
roles: [ { "role" : "readWrite", "db" : "<database_name>" } ]
}
)
@igorsokolov
igorsokolov / transporter_chief.rb
Created July 12, 2012 07:19
Transporter Chief - upload iOS application to iOS devices
#!/usr/bin/ruby
require 'optparse'
require 'ostruct'
require 'fileutils'
require 'pathname'
require 'tmpdir'
$script_path = File.expand_path(File.dirname(__FILE__))
$temp_path = Dir.mktmpdir

Ruby Debugger

Most of the time simple output statements using warn, raise, or a logger will help you find your issue. But sometimes you need the big guns, and that means ruby-debug.

Ruby-Debug

The ruby-debug package has had some rocky times during the transition from Ruby 1.8.7 to 1.9.2 and beyond. But now, finally, the debugger is reliable and usable.

Installation

Bluepill.application("app", :base_dir => "#{RAILS_ROOT}/tmp/bluepill", :log_file => "#{RAILS_ROOT}/log/bluepill.log") do |app|
app.process("unicorn") do |process|
process.pid_file = File.join(RAILS_ROOT, 'tmp/pids/unicorn.pid')
process.working_dir = RAILS_ROOT
process.start_command = "unicorn -c config/unicorn.rb -E production config.ru"
process.stop_command = "kill -QUIT {{PID}}"
process.restart_command = "kill -USR2 {{PID}}"
process.uid = process.gid = 'www'
# unicorn_rails -c config/unicorn.rb -E production -D
working_directory File.join(File.dirname(File.expand_path(__FILE__)), '..')
rails_env = ENV['RAILS_ENV'] || 'production'
# 16 workers and 1 master
worker_processes (rails_env == 'production' ? 4 : 1)
stderr_path "log/unicorn.stderr.log"
Failed to start bluepill:
TypeError `no marshal_dump is defined for class Mutex`
/Users/skip/.bundle/ruby/1.9.1/gems/bluepill-0.0.38/lib/bluepill/process.rb:381:in `dump'
/Users/skip/.bundle/ruby/1.9.1/gems/bluepill-0.0.38/lib/bluepill/process.rb:381:in `deep_copy'
/Users/skip/.bundle/ruby/1.9.1/gems/bluepill-0.0.38/lib/bluepill/process.rb:367:in `block in refresh_children!'
/Users/skip/.bundle/ruby/1.9.1/gems/bluepill-0.0.38/lib/bluepill/process.rb:366:in `each'
/Users/skip/.bundle/ruby/1.9.1/gems/bluepill-0.0.38/lib/bluepill/process.rb:366:in `refresh_children!'
/Users/skip/.bundle/ruby/1.9.1/gems/bluepill-0.0.38/lib/bluepill/process.rb:122:in `tick'
/Users/skip/.bundle/ruby/1.9.1/gems/bluepill-0.0.38/lib/bluepill/group.rb:19:in `block in tick'
/Users/skip/.bundle/ruby/1.9.1/gems/bluepill-0.0.38/lib/bluepill/group.rb:18:in `each'