Skip to content

Instantly share code, notes, and snippets.

View acarpe's full-sized avatar

Antonio Carpentieri acarpe

  • MamaClean
  • Milan, Italy
View GitHub Profile
@krisleech
krisleech / 01-my_current_way.rb
Created February 8, 2013 23:44
services and responders: which protocol (duck type) is best for talking between controller and service
class OrderController
def new
@order = Order.new
end
def create
command = CreateOrder.new(current_user, params[:order])
command.execute(:success => lambda { redirect_to orders_path },
:failure => lambda { |order| @order = order; render :action => :new })
end
@nathany
nathany / config.ru
Last active May 3, 2019 17:10
Magical Unicorn Configuration for Heroku
# add something like this to config.ru
# see https://github.com/kzk/unicorn-worker-killer
if Integer(ENV['UNICORN_KILLER'] || 0) != 0
require 'unicorn/worker_killer'
# Max memory size (RSS) per worker
use Unicorn::WorkerKiller::Oom, (350*(1024**2)), (400*(1024**2)), 30, true
end
@giannisp
giannisp / gist:ebaca117ac9e44231421f04e7796d5ca
Last active July 14, 2024 18:27
Upgrade PostgreSQL 9.6.5 to 10.0 using Homebrew (macOS)
After automatically updating Postgres to 10.0 via Homebrew, the pg_ctl start command didn't work.
The error was "The data directory was initialized by PostgreSQL version 9.6, which is not compatible with this version 10.0."
Database files have to be updated before starting the server, here are the steps that had to be followed:
# need to have both 9.6.x and latest 10.0 installed, and keep 10.0 as default
brew unlink postgresql
brew install postgresql@9.6
brew unlink postgresql@9.6
brew link postgresql