Skip to content

Instantly share code, notes, and snippets.

View pglombardo's full-sized avatar
🕶️

Peter Giacomo Lombardo pglombardo

🕶️
View GitHub Profile
@pglombardo
pglombardo / puma.rb
Last active August 29, 2015 14:16
TraceView, Heroku & the Puma Webserver
workers Integer(ENV['WEB_CONCURRENCY'] || 2)
threads_count = Integer(ENV['MAX_THREADS'] || 5)
threads threads_count, threads_count
preload_app!
rackup DefaultRackup
port ENV['PORT'] || 3000
environment ENV['RACK_ENV'] || 'development'
@pglombardo
pglombardo / error.txt
Created March 31, 2015 15:57
Refinery Error
NameError in Refinery::Admin::CoreController#index
uninitialized constant Refinery::I18n::Engine::Globalize
Rails.root: /home/pglombardo/Projects/ruby-test-stacks/refinethis2
Application Trace | Framework Trace | Full Trace
refinerycms-i18n (3.0.1) lib/refinery/i18n/engine.rb:63:in `globalize!'
activesupport (4.1.9) lib/active_support/callbacks.rb:424:in `block in make_lambda'
activesupport (4.1.9) lib/active_support/callbacks.rb:160:in `call'
activesupport (4.1.9) lib/active_support/callbacks.rb:160:in `block in halting'
@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)
@pglombardo
pglombardo / gist:1005825
Created June 3, 2011 03:31
Regnum Online Mac Client Crash with Trackpad Multi-touch (reproduceable)
Process: ROClientGame [4953]
Path: /Users/pglombardo/Applications/Realms Online/live/./ROClientGame.app/Contents/MacOS/ROClientGame
Identifier: ???
Version: ()
Code Type: X86 (Native)
Parent Process: ??? [1]
Date/Time: 2011-06-02 23:27:29.648 -0400
OS Version: Mac OS X 10.6.7 (10J869)
Report Version: 6
@pglombardo
pglombardo / gist:1020074
Created June 11, 2011 00:21
Mac Realms Online Crash with Two Finger Trackpad Drag
Process: ROClientGame [92712]
Path: /Users/pglombardo/Applications/Realms Online/live/./ROClientGame.app/Contents/MacOS/ROClientGame
Identifier: ???
Version: ()
Code Type: X86 (Native)
Parent Process: ??? [1]
Date/Time: 2011-06-10 20:20:17.983 -0400
OS Version: Mac OS X 10.6.7 (10J869)
Report Version: 6
@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 / gist:1894853
Created February 23, 2012 20:16
Block versus String With Incrementing Var Showdown
require 'benchmark'
require 'logger'
logger = Logger.new("/dev/null")
logger.level = Logger::INFO
puts "Simple Strings"
Benchmark.bmbm do |x|
x.report("string form") {
x = 0
@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:3105378
Created July 13, 2012 15:07
Varnish check for existing cookie
# Don't serve cached pages for logged in users
if (req.http.Cookie ~ "logged_in_cookie=") {
return(pass);
}
@pglombardo
pglombardo / gist:3105491
Created July 13, 2012 15:30
Rails expires_in unless logged in
# Set cache headers unless this user is logged in
expires_in 1.hour, :public => true, 'max-stale' => 0 unless current_user