Skip to content

Instantly share code, notes, and snippets.

View pglombardo's full-sized avatar
🕶️

Peter Giacomo Lombardo pglombardo

🕶️
View GitHub Profile
@pglombardo
pglombardo / capistrano_database_yml.rb
Created February 13, 2012 23:09 — forked from weppos/capistrano_database_yml.rb
Provides a couple of tasks for creating the database.yml configuration file dynamically when deploy:setup is run.
#
# = Capistrano database.yml task
#
# Provides a couple of tasks for creating the database.yml
# configuration file dynamically when deploy:setup is run.
#
# Category:: Capistrano
# Package:: Database
# Author:: Simone Carletti <weppos@weppos.net>
# Copyright:: 2007-2010 The Authors
@pglombardo
pglombardo / default.vcl.pl
Created July 11, 2012 22:05 — forked from bmarini/default.vcl.pl
A good varnish config for a Rails app
# https://www.varnish-cache.org/docs/2.1/tutorial/vcl.html
# https://www.varnish-cache.org/trac/wiki/VCLExamples
# Summary
# 1. Varnish will poll the backend at /health_check to make sure it is
# healthy. If the backend goes down, varnish will server stale content
# from the cache for up to 1 hour.
# 2. Varnish will pass X-Forwarded-For headers through to the backend
# 3. Varnish will remove cookies from urls that match static content file
# extensions (jpg, gif, ...)
@pglombardo
pglombardo / gist:4486693
Last active December 10, 2015 20:18 — forked from trjordan/gist:4475869
# In the web request
def start_job(*args)
# Log the fact that we're starting a job, and send the job with the current
# task id
Oboe::API.force_trace do
Oboe::API.start_trace('job', nil, { :Async => True }) do
task_id = Oboe::Context.toString unless not Oboe::Context.isValid
Resque.enqueue(Archive, task_id, *args)
end
end
@pglombardo
pglombardo / sidekiqer.rb
Last active September 1, 2015 14:51 — forked from cpuguy83/sidekiqer.rb
Run Sidekiq in your main process
require 'sidekiq/cli'
require 'sidekiq/launcher'
module Sidekiqer
Sidekiq = ::Sidekiq.dup
module Sidekiq
CLI = ::Sidekiq::CLI.dup
Launcher = ::Sidekiq::Launcher.dup
::Sidekiq.send(:remove_const, :CLI)