Skip to content

Instantly share code, notes, and snippets.

@moofkit
moofkit / application_record.rb
Last active May 28, 2024 08:43
ActiveRecord alter default timeout for PostgreSQL query
class ApplicationRecord < ActiveRecord::Base
self.abstract_class = true
class << self
# Start a new transaction with a statement timeout.
# The timeout is reset after the block is executed. Works even with pg_bouncer in transaction mode
# This is useful for queries that are expected to be slower than the default timeout
# timeout - the timeout in seconds
# Usage:
# with_statement_timeout(10) do
@jjb
jjb / file.md
Last active July 11, 2024 15:27
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 ; \
@alicebartlett
alicebartlett / Hiring-links.md
Last active November 26, 2018 03:41
A while ago I asked twitter for resources on hiring, here are some links:
@henrik
henrik / yosemite_upgrade_notes.md
Last active December 30, 2015 02:29
Yosemite upgrade notes

Yosemite upgrade notes

From a (mostly) Ruby on Rails developer.

After doing the below everything seems to work (some of it worked before doing anything), including Ruby, Gems, RVM, Homebrew, VirtualBox/Vagrant VMs, Pow, tmux, git, vim.

  1. Did a full-disk backup that I can restore from
  2. Moved out /usr/local to avoid super slow install, per option 1 in https://jimlindley.com/blog/yosemite-upgrade-homebrew-tips/: sudo mv /usr/local ~/local
  3. Upgraded to Yosemite
  4. Restored /usr/local, per option 1 in https://jimlindley.com/blog/yosemite-upgrade-homebrew-tips/: sudo mv ~/local /usr