Skip to content

Instantly share code, notes, and snippets.

View masone's full-sized avatar
🚗

Christian Felder masone

🚗
View GitHub Profile
gem 'foreman', :git => 'https://github.com/tjdett/foreman.git', :branch => 'upstart_stop_fix'
E, [2012-02-14T11:54:35.488363 #11130] ERROR -- : reaped #<Process::Status: pid 18694 exit 1> worker=0
I, [2012-02-14T11:54:35.488521 #11130] INFO -- : worker=0 spawning...
I, [2012-02-14T11:54:35.490429 #18697] INFO -- : worker=0 spawned pid=18697
I, [2012-02-14T11:54:35.490617 #18697] INFO -- : Refreshing Gem list
E, [2012-02-14T11:54:35.494272 #18697] ERROR -- : undefined method `worker_processes' for main:Object (NoMethodError)
/var/www/development.silp.co/releases/20120214105251/config/unicorn.rb:4:in `<top (required)>'
I, [2012-02-17T08:48:42.206107 #30643] INFO -- : unlinking existing socket=/var/www/xx/shared/sockets/unicorn.sock
I, [2012-02-17T08:48:42.206354 #30643] INFO -- : listening on addr=/var/www/xx/shared/sockets/unicorn.sock fd=5
I, [2012-02-17T08:48:42.206693 #30643] INFO -- : listening on addr=0.0.0.0:5000 fd=6
I, [2012-02-17T08:49:09.548939 #30966] INFO -- : worker=0 spawned pid=30966
I, [2012-02-17T08:49:09.549375 #30966] INFO -- : worker=0 ready
I, [2012-02-17T08:49:09.550624 #30969] INFO -- : worker=1 spawned pid=30969
I, [2012-02-17T08:49:09.550907 #30969] INFO -- : worker=1 ready
I, [2012-02-17T08:49:09.552280 #30972] INFO -- : worker=2 spawned pid=30972
I, [2012-02-17T08:49:09.552567 #30972] INFO -- : worker=2 ready
I, [2012-02-17T08:49:09.553961 #30975] INFO -- : worker=3 spawned pid=30975
@masone
masone / gist:2169133
Created March 23, 2012 09:53
foreman capistrano
after 'deploy:update_code', 'foreman:export'
after 'deploy:update_code', 'foreman:restart'
namespace :foreman do
desc "Start the application services"
task :start, :roles => [:web], :except => {:no_release => true} do
run "sudo start #{host}"
end
@masone
masone / integration_test_helper.rb
Created July 16, 2012 18:43
Headless integration testing of facebook dialogs with capybara-webkit

## Most important settings

Create a new facebook app (1) and make sure the canvas url (2) in the basic tab matches the host and port configured with Capybara.server_port and Capybara.app_host. Activating sandbox mode (3) in the advanced tab enables you to roll without providing an SSL canvas url. You want to set the display mode (4) of your facebook dialogs to page, which is also the default.

  1. https://developers.facebook.com/apps
  2. http://screencast.com/t/lt6ORnb1sf
  3. http://screencast.com/t/tPSUyE6s
  4. https://developers.facebook.com/docs/reference/dialogs/
@masone
masone / settings.rb
Created August 8, 2012 11:36
Global settings object with default and environment specific values
# Loads the file config/settings/shared.yml and merges it with config/settings/ENV['SILP_CLOUD'].yml.
# If ENV['SILP_CLOUD'] is not set, local.yml will be loaded as fallback.
class Settings
include Singleton
def self.init!(silp_cloud, rails_env)
rails_root = File.join(File.dirname(__FILE__), '..')
# event data: { :_type => :set_metrics, :total_people_count => 23000000 }
gauge :total_people_count_day,
:tick => 1.day,
:title => "Active count"
event :set_metrics do
set_value :total_people_count_day, data[:total_people_count]
end
@masone
masone / bar1
Created August 22, 2013 15:32
branding.css has different fingerprints
report.js: report-d911aecae84d2d930d578aa7f62287a8.js
report/index.js: report-d911aecae84d2d930d578aa7f62287a8.js
admin.css: admin-a0a48d9e00dd39245caa980508ed360f.css
admin/index.css: admin-a0a48d9e00dd39245caa980508ed360f.css
application.css: application-79a362c3d79b9399b53e38ddd421498e.css
application/index.css: application-79a362c3d79b9399b53e38ddd421498e.css
branding.css: branding-48068931d8d00ce25f671089c291c28c.css
branding/index.css: branding-48068931d8d00ce25f671089c291c28c.css
report.css: report-c208c0c0bcedd54b59a8133c9e6b8f2e.css
report/index.css: report-c208c0c0bcedd54b59a8133c9e6b8f2e.css
[101] pry(main)> ParanoidAttributes.only(Person.all, :id, :first_name).first.first_name
=> "Harry"
[102] pry(main)> ParanoidAttributes.only(Person.all, :id, :first_name).first.last_name
ArgumentError: Accessing excluded field last_name
[103] pry(main)> ParanoidAttributes.only(Person.all, :id, :first_name).first.bla
NoMethodError: undefined method `bla' for #<Person:0x007fe9ebbb2768>
@masone
masone / rails
Created August 21, 2014 10:10
Thin with SSL as default server for use with rails server. Works with Rubymine.
#!/usr/bin/env ruby
require 'rack'
# Thin SSL workaround
module Rack
module Handler
class Thin
def self.run(app, options={})
app = Rack::Chunked.new(Rack::ContentLength.new(app))
server = ::Thin::Server.new(options[:Host] || '0.0.0.0',