Skip to content

Instantly share code, notes, and snippets.

View bensheldon's full-sized avatar
🏊‍♂️
Swimming through code.

Ben Sheldon bensheldon

🏊‍♂️
Swimming through code.
View GitHub Profile
@brenogazzola
brenogazzola / gist:0f8d2dc191e217d5ce6e9293fa34e640
Created July 15, 2026 20:03
Rails + PostgreSQL Performance Audit Playbook
# Rails + PostgreSQL Performance Audit Playbook
A field-tested method for finding what's actually burning your database CPU, built for a
Rails monolith on managed PostgreSQL (Cloud SQL / RDS / etc.). It assumes no APM — just
`pg_stat_statements`, `pg_stat_activity`, and discipline. It pairs well with an LLM: point
one at this file plus your query results and let it do the attribution; the queries below
are ordered so a human can run them and paste results back.
## The core idea
@jjb
jjb / file.md
Last active July 29, 2026 15:49
Using Jemalloc 5 with Ruby.md

For years, people have been using jemalloc with ruby. There were various benchmarks and discussions. Legend had it that Jemalloc 5 didn't work as well as Jemalloc 3.

Then, one day, hope appeared on the horizon. @wjordan offered a config for Jemalloc 5.

Ubuntu/Debian

FROM ruby:3.1.2-bullseye
RUN apt-get update ; \
@mmazanec22
mmazanec22 / README.md
Last active April 26, 2019 08:44
Intercom Accessibility Hack
@scribu
scribu / generate-key-mac.sh
Last active September 7, 2016 14:43 — forked from floydpink/travis-secure-key-mac.sh
Generating secure environment variables for GitHub deployment keys to be used from a Travis-CI build.
#!/usr/bin/env bash
# On OS X, use this script to generate an encrypted deployment key for Travis CI.
# Dependencies:
# gem install travis
# brew install coreutils
if [ $# -lt 1 ]; then
echo "usage: $0 <user>/<repo>"
@dypsilon
dypsilon / frontendDevlopmentBookmarks.md
Last active July 25, 2026 20:55
A badass list of frontend development resources I collected over time.
@marcomd
marcomd / gist:3129118
Created July 17, 2012 12:18
Authenticate your API with devise, token by header
#Session controller provides a token
#/controllers/api/sessions_controller.rb
class Api::SessionsController < Devise::SessionsController
before_filter :authenticate_user!, :except => [:create]
before_filter :ensure_params_exist, :except => [:destroy]
respond_to :json
def create
resource = User.find_for_database_authentication(:email => params[:user_login][:email])
return invalid_login_attempt unless resource
@marcaube
marcaube / bootstrap-hugrid.js
Created March 26, 2012 14:01
Twitter Bootstrap Heads-Up Grid
definegrid = function() {
var browserWidth = $(window).width();
// LARGE DESKTOP & UP
if (browserWidth >= 1200)
{
pageUnits = 'px';
colUnits = 'px';
pagewidth = 1170;
columns = 12;
@dnagir
dnagir / rspec-syntax-cheat-sheet.rb
Created November 5, 2010 09:29
RSpec 2 syntax cheat sheet by example
# RSpec 2.0 syntax Cheet Sheet by http://ApproachE.com
# defining spec within a module will automatically pick Player::MovieList as a 'subject' (see below)
module Player
describe MovieList, "with optional description" do
it "is pending example, so that you can write ones quickly"
it "is already working example that we want to suspend from failing temporarily" do
pending("working on another feature that temporarily breaks this one")