Skip to content

Instantly share code, notes, and snippets.

@sirupsen
sirupsen / ping_less.rb
Created March 7, 2019 12:33
Ping less patch for MySQL.
# frozen_string_literal: true
# By default, ActiveRecord will issue a PING command to the database to check
# if it is active at various points. This overhead is unnecessary; we instead
# attempt to issue queries without checking the connection, then if the query
# returns an error and the connection was closed, try to reconnect.
# This also allows for reconnection during a single UoW, improving resiliency
# under transient connection failure (e.g. ProxySQL restarts).
#
# To avoid amplifying load when a database is intermittently down, the attempt
@ctalkington
ctalkington / Gemfile
Last active May 16, 2023 20:19
Nginx, Sinatra, and Puma.
source :rubygems
gem "puma"
gem "sinatra"
class ActionDispatch::Routing::Mapper
def draw(routes_name)
instance_eval(File.read(Rails.root.join("config/routes/#{routes_name}.rb")))
end
end
BCX::Application.routes.draw do
draw :api
draw :account
draw :session
@myobie
myobie / mountain-lion-brew-setup.markdown
Created February 18, 2012 20:14
Get Mountain Lion and Homebrew to Be Happy

Get Mountain Lion and Homebrew to Be Happy

1) Install XCode 4.4 into /Applications

Get it from the App Store.

2) Install Command Line Tools

In XCode's Preferences > Downloads you can install command line tools.

@burke
burke / 0-readme.md
Created January 27, 2012 13:44 — forked from funny-falcon/cumulative_performance.patch
ruby-1.9.3-p327 cumulative performance patch for rbenv

ruby-1.9.3-p327 cumulative performance patch for rbenv

This installs a patched ruby 1.9.3-p327 with various performance improvements and a backported COW-friendly GC, all courtesy of funny-falcon.

Requirements

You will also need a C Compiler. If you're on Linux, you probably already have one or know how to install one. On OS X, you should install XCode, and brew install autoconf using homebrew.

@panthomakos
panthomakos / Gemfile
Created May 18, 2011 18:41
Spork, RSpec, Sham and Caching Classes
source 'http://rubygems.org'
gem 'rails', '3.0.4'
group :test do
gem 'database_cleaner'
gem 'rspec-rails'
gem 'rspec-rails-matchers'
gem 'sham'
gem 'spork', '=0.9.0.rc7'
@natesilva
natesilva / markdown.vim
Created May 6, 2011 23:44
Vim: Preview a Markdown document in the default browser on Windows or Mac OS X
"
" While editing a Markdown document in Vim, preview it in the
" default browser.
"
" Author: Nate Silva
"
" To install: Place markdown.vim in ~/.vim/ftplugin or
" %USERPROFILE%\vimfiles\ftplugin.
"
" To use: While editing a Markdown file, press ',p' (comma p)
@abachman
abachman / 0. why
Created April 16, 2011 18:28
acclimating myself to the Mac keyboard layout by reclaiming keyboard shortcuts. https://twitter.com/#!/abachman/status/59323764772569088
For the last two years I've been using Ubuntu Linux for software development.
Last week I got a MacBook Pro and have been changing over. I run a heavily
customized vim setup, so the change was particularly difficult with regards to
my keyboard layout.
These step show what I did to make my Mac work like my Linux machines which all
have caps-lock remapped to control. I used OSX's built in keyboard setup tool
to remap my caps-lock key to be a command key, since command, for the most
part, takes the place of control as the primary shortcut key modifier.
@nruth
nruth / cookie_steps.rb
Created July 21, 2010 17:16
Testing login "remember me" feature with Capybara (rack::test or selenium) - deleting the session cookie (only)