Skip to content

Instantly share code, notes, and snippets.

Brendon Murphy bemurphy

View GitHub Profile
csswizardry /
Last active Jun 7, 2020
Vim without NERD tree or CtrlP

Vim without NERD tree or CtrlP

I used to use NERD tree for quite a while, then switched to CtrlP for something a little more lightweight. My setup now includes zero file browser or tree view, and instead uses native Vim fuzzy search and auto-directory switching.

Fuzzy Search

There is a super sweet feature in Vim whereby you can fuzzy find your files using **/*, e.g.:

:vs **/*<partial file name><Tab>
View rebuild
#!/usr/bin/env bash
set -e
if [ -e static ]; then
rm -r static
mkdir -p static
sass src/sass/main.scss > static/application.css
$(npm bin)/browserify src/js/main.js > static/application.js
ryanfelton /
Last active May 25, 2017
CircleCI Install Qt5
# Based on:
set -x
# Exit if any subcommand fails
set -e
if [ ! -d "/opt/qt55" ]; then
echo "Installing QT 5.5 ..."
pedrosmmoreira / final_controller_calls.rb
Last active Jan 21, 2016
Dynamic Pundit Policies per user type
View final_controller_calls.rb
class FoosController < ApplicationController
include Pundit
# record policy
def set_record_policy
policy(, current_user)
# scope policy
jwood / application.html.erb
Last active Oct 7, 2019
Disable animations
View application.html.erb
<!-- app/views/layouts/application.html.erb -->
<!DOCTYPE html>
<html lang="en">
<!-- ... -->
<% if Rails.application.config.disable_animations %>
<%= stylesheet_link_tag('disable_animations') %>
<!-- Turn off animations in jQuery -->
<script>$ = true;</script>
joost / change_s3_metadata.rb
Last active Aug 26, 2016
Change metadata on existing S3 files
View change_s3_metadata.rb
# Using v1 of Ruby aws-sdk as currently v2 seems not able to do this (broken?).
require 'aws-sdk-v1'
AWS.config(access_key_id: key, secret_access_key: secret, region: region)
s3 =
bucket = s3.buckets[bucket_name]
krasnoukhov /
Last active Feb 25, 2020
Profiling memory leaky Sidekiq applications with Ruby 2.1

My largest Sidekiq application had a memory leak and I was able to find and fix it in just few hours spent on analyzing Ruby's heap. In this post I'll show my profiling setup.

As you might know Ruby 2.1 introduced a few great changes to ObjectSpace, so now it's much easier to find a line of code that is allocating too many objects. Here is great post explaining how it's working.

I was too lazy to set up some seeding and run it locally, so I checked that test suite passes when profiling is enabled and pushed debugging to production. Production environment also suited me better since my jobs data can't be fully random generated.

So, in order to profile your worker, add this to your Sidekiq configuration:

View two-factor
#!/usr/bin/env ruby --disable-gems
# Roll your own two-factor authentication! Place this file on a USB key, make
# it executable, then run:
# two-factor --setup
# Now place each TOTP secret in its own file in the `keys/` directory. I like
# to name them after the website they apply to, but any name is fine. To
# generate a token, plug in your USB key and:
relaxdiego /
Last active Dec 22, 2019 — forked from surjikal/
Installing Graphite in OS X Mavericks

Follow these steps to install graphite on OS X Mavericks.


  • Homebrew
  • Python 2.7
  • Git

Install dependencies

Install Cairo and friends

xaviershay /
Last active Dec 24, 2015
SASS + Coffee + Concatenation in prod
set -exo pipefail
if [ `uname` == 'Darwin' ]; then
JSCOMPRESSOR="yuicompressor --type js"
You can’t perform that action at this time.