Skip to content

Instantly share code, notes, and snippets.

View wlangstroth's full-sized avatar

Will Langstroth wlangstroth

View GitHub Profile
@GBH
GBH / gist:3451944
Last active October 9, 2015 06:17
Textmate snippet `controller`. Scope `source.ruby`
class ${1:Model}sController < ApplicationController
before_action :build_${1/./\l$0/}, only: [:new, :create]
before_action :load_${1/./\l$0/}, only: [:show, :edit, :update, :destroy]
def index
@${1/./\l$0/}s = ${1:Model}.page(params[:page])
end
def show
@GBH
GBH / gist:3452023
Last active October 9, 2015 06:17
Textmate snippet for `controllertest`. Scope `source.ruby`
require_relative '../test_helper'
class ${1:Model}sControllerTest < ActionController::TestCase
def setup
@${1/./\l$0/} = ${1/./\l$0/}s(:default)
end
def test_get_index
get :index
@byorgey
byorgey / Knotty.hs
Created October 13, 2012 16:01
Creating a tree with shared links back to parent nodes
type AccountName = String
data Account = Account {
aname :: AccountName,
asubs :: [Account]
}
deriving Show
data Account2 = Account2 {
aname2 :: AccountName,
@simonmichael
simonmichael / gist:1185421
Created September 1, 2011 03:59
ghc-pkg-clean, ghc-pkg-reset
# unregister broken GHC packages. Run this a few times to resolve dependency rot in installed packages.
# ghc-pkg-clean -f cabal/dev/packages*.conf also works.
function ghc-pkg-clean() {
for p in `ghc-pkg check $* 2>&1 | grep problems | awk '{print $6}' | sed -e 's/:$//'`
do
echo unregistering $p; ghc-pkg $* unregister $p
done
}
# remove all installed GHC/cabal packages, leaving ~/.cabal binaries and docs in place.