Skip to content

Instantly share code, notes, and snippets.

Bradley Schaefer soulcutter

Block or report user

Report or block soulcutter

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@JoshCheek
JoshCheek / routes
Created May 4, 2018
Cache / filter / reformat filtered routes since `rake routes` is so expensive.
View routes
#!/usr/bin/env ruby
argv = ARGV
# handle help screen
if argv.any? { |arg| arg == '-h' || arg == '--help' }
$stderr.puts <<~HELP
Usage: routes [--load] [--reload] [filter ...]
Runs `bin/rake routes` and caches the result so that you don't have to wait
@kddeisz
kddeisz / test_helper.rb
Created Jan 30, 2018
Tracking delegations in the test run
View test_helper.rb
# Hook into delegate to make sure those don't go stale
ActiveRecord::Base.singleton_class.prepend(
Module.new do
DELEGATION_CALLS = {}
def delegate(*, **)
super.map do |method_name|
tracking_key = "#{name}##{method_name}"
DELEGATION_CALLS[tracking_key] = 0
@smcabrera
smcabrera / .vimrc
Last active Nov 15, 2016
Some sensible defaults for a .vimrc
View .vimrc
"============================================================
"== Vundle Plugin Manager
"============================================================
"found here: https://github.com/VundleVim/Vundle.vim
set rtp+=~/.config/nvim/bundle/Vundle.vim
call vundle#begin()
Plugin 'gmarik/Vundle.vim'
"============================================================
"== Plugins: Sensible Defaults
@benwalsh
benwalsh / gist:0e3fa2276ffe2f03fef5
Created May 14, 2015
Capistrano for manifests
View gist:0e3fa2276ffe2f03fef5
after "deploy:assets:precompile", "download_asset_manifest"
after "download_asset_manifest", "upload_asset_manifest"
desc "Download the compiled asset manifest .json file"
task :download_asset_manifest, roles: :admin do
set(:manifest_json, capture("ls #{ release_path }/public/assets/manifest*json").strip.split("/").last)
download "#{ release_path }/public/assets/#{ manifest_json }", "/tmp/#{ manifest_json }"
end
desc "Upload the asset manifest file"
@xaviershay
xaviershay / build_frontend.sh
Last active Dec 24, 2015
SASS + Coffee + Concatenation in prod
View build_frontend.sh
#!/bin/bash
set -exo pipefail
BUILD_ENV=$1
if [ `uname` == 'Darwin' ]; then
OSX=1
JSCOMPRESSOR="yuicompressor --type js"
else
OSX=
@idrozd
idrozd / translatable.rb
Created Jul 19, 2013
Ruby Translatable
View translatable.rb
# Motivation:
# Wanted a more solid way to test validation resulted in correct errors
# other than matching strings;
# Decoupling the very notion of error from message
#
# Sideeffects:
# - Conventional way to namespace error translation by actual path
module Translatable
@coreyhaines
coreyhaines / .rspec
Last active Sep 4, 2019
Active Record Spec Helper - Loading just active record
View .rspec
--colour
-I app
View kill worker
#!/bin/sh
set -u
set -e
# Example init script, this can be used with nginx, too,
# since nginx and unicorn accept the same signals
# Feel free to change any of the following variables for your app:
APP_ROOT=/k/app_name/current
PID=/var/run/unicorn/unicorn.pid
ENV=production
You can’t perform that action at this time.