Skip to content

Instantly share code, notes, and snippets.

Gus Knowlden gus

Block or report user

Report or block gus

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
gus / gist:180907
Created Sep 4, 2009 — forked from mtodd/gist:180398
Ruby and Heredocs
View gist:180907
Surround a heredoc with quotes and you can continue the code on the same line:
render :status => 404, :text => <<-'EOH' and return unless setup
article not found<br/>
I, as a server, have failed<br/>
Quotes also give you more freedom/creativity with the terminal ID:
gus /
Created Nov 10, 2009
OCaml Interpreter
type exp =
IntExp of int
| Builtin of (exp -> env -> exp)
| VarExp of string
| FunExp of string * exp
| LetExp of string * exp * exp
| IfExp of exp * exp * exp
| AppExp of exp * exp
env = (string * exp) list
gus / index.txt
Created Nov 30, 2009 — forked from toothrot/index.txt
Ruby/Clojure analogs
View index.txt
For each Ruby module/class, we have Ruby methods on the left and the equivalent
Clojure functions and/or relevant notes are on the right.
For clojure functions, symbols indicate existing method definitions, in the
clojure namespace if none is explicitly given. clojure.contrib.*/* functions can
be obtained from,
ruby-to-clojure.*/* functions can be obtained from the source files in this
If no method symbol is given, we use the following notation:
gus /
Created Jul 8, 2010
Coding in Ruby - mostly the Gus way

Hijacked from Christian Neukirchen's Ruby Style Guide

Coding in Ruby

These are guides, not rules. There are always reasons to not do something, but if you can stay on this road for as long as possible, at least Gus will be happy.


  • Use common sense.
  • Be consistent.
View git-svn-for-masochists.markdown

Create an account on (skip if you already have one)

Create a repo on using s-and-m for this example

Locally, run the following commands:

git svn clone -s svn://hostname/s-and-m
git clone ./s-and-m better-s-and-m
cd better-s-and-m
git remote rm origin
View Rakefile
require 'rubygems'
require 'rake'
require 'pathname'
module ThumbleMonks
class Tastic # Formerly Rake::Static
def initialize(app, options={})
@app = app
gus / riot_example.rb
Created Jul 20, 2010 — forked from toothrot/riot_example.rb
Riot examples - via toothrot
View riot_example.rb
require 'rubygems'
require 'riot'
context "Something" do
setup do
D = 8
asserts("big") { 8==D }
asserts("bigger") { 8===D }
gus /
Created Jul 28, 2010
Hellooooo, Ben

This is example is taken from a live app I'm playing around with. It's been retrofitted and trimmed for example usage for one Mr. Ben Guthrie! Custom gists by demand. Get em' while they're hot!

View gc_stats.rb
# From mattetti's gc_stats.rb
# Basic middleware to help developers track their memory usage
# Currently only tested on Ruby 1.9 and no support guaranteed
# Output example:
# GC run, previous cycle was 255 requests ago.
View a-bundler-whoa.markdown

I'm not sure what the feature is called in 0.9.26, so I'll describe it instead; essentially, I can package (vendor/cache) my gems for use in deployment and if during the deployment (bundle install vendor/bundle) a gem is found in the shared gems repo (managed through RVM gemsets per project) then that gem is used without unpacking it in vendor/bundle. This is useful to me because my ops dude pre-installs gems needing compilation on all of the systems needing it (managed through Puppet for now); these gems are currently unicorn and bson_ext.

You can argue that he just shouldn't do that and I won't argue back, but that's something he likes since he doesn't want to have to recompile unicorn, bson_ext, etc. for each system as deploys are running; we have a few systems to manage and the list is growing; we also have several services working together and not all are ruby, so he just wants simple deploys. I also can't argue too much with that as there are oodles of things he concerns himself with that I don't have/

You can’t perform that action at this time.