Skip to content

Instantly share code, notes, and snippets.

View garrensmith's full-sized avatar

Garren garrensmith

View GitHub Profile
@rday
rday / gist:3504674
Created August 28, 2012 21:52
Abstract wrapper to allow connection pools
type InitFunction func() (interface{}, error)
type ConnectionPoolWrapper struct {
size int
conn chan interface{}
}
/**
Call the init function size times. If the init function fails during any call, then
the creation of the pool is considered a failure.
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

#!/usr/bin/env bash
# Usage: curl -L https://raw.github.com/gist/3277326/ubuntu_bootstrap.sh | bash
RUBY=1.9.3-p327
echo "Updating Packages"; echo
apt-get -y update && apt-get -y upgrade
apt-get -y install build-essential zlib1g-dev libssl-dev libreadline6-dev libyaml-dev libgdbm-dev libxml2 libxml2-dev libxslt-dev git-core
@mudge
mudge / active_record_helper.rb
Created June 26, 2012 15:49
A bare-bones spec helper for testing Active Record classes without the rest of Rails.
require "active_record"
require "database_cleaner"
require "rspec/rails/extensions"
# Note that this *will not load your Rails configuration* which means things like
# mass assignment protection by default, etc. will not be set.
RSpec.configure do |config|
config.before(:suite) do
ActiveRecord::Base.configurations =
@railsdev
railsdev / gist:2973432
Created June 22, 2012 15:22 — forked from obrok/gist:2499900
Setting up fresh Ubuntu server for Rails

Setting up fresh Ubuntu server for Rails

Preparations

$ sudo -i

Set preferred editor

$ export EDITOR=vim
@bhenerey
bhenerey / ideal ops.md
Created May 23, 2012 19:40
ideal ops checklist

In a perfect world, where things are done well, not just quickly, I would expect to find the following when joining the company:

Documentation

  • Accurate / up-to-date systems architecture diagram

  • Accurate / up-to-date network diagram

  • Out-of-hours support plan

  • Incident management plan

Recently, we've been working on extracting Ember conventions from applications we're working on into the framework. Our goal is to make it clearer how the parts of an Ember application work together, and how to organize and bootstrap your objects.

Routing

Routing is an important part of web applications. It allows your users to share the URL they see in their browser, and have the same things appear when their friends click on the link.

The Ember.js ecosystem has several great solutions for routing. But, since it is such an important part of most web applications, we've decided to build it right into the framework.

If you have already modeled your application state using Ember.StateManager, there are a few changes you'll need to make to enable routing. Once you've made those changes, you'll notice the browser's address bar spring to life as you start using your app—just by moving between states, Ember.js will update the URL automatically.

@rnewson
rnewson / gist:2387973
Created April 14, 2012 21:31
CouchDB Future Feature List - Round 2
A list of features that we want to see in CouchDB. Needs to be voted on so that it can become a priority queue.
User Facing Features
====================
1. Conflicts are the rule, not the exception
All previous versions of CouchDB hide conflicts by default (selecting
an arbitrary but consistent winning revision). Expert users can find
and resolve conflicts.
@tsloughter
tsloughter / gist:2344451
Created April 9, 2012 16:05
cowboy rest example
%% @private
-spec init(list()) -> {ok, {SupFlags::any(), [ChildSpec::any()]}} |
ignore | {error, Reason::any()}.
init([]) ->
Dispatch = [
%% {Host, list({Path, Handler, Opts})}
{'_', [{[<<"graphs">>, graph], kw_handler, []}]}
],
RestartStrategy = one_for_one,
@chriseppstein
chriseppstein / readme.md
Created August 31, 2011 21:57 — forked from mislav/Gemfile
How to integrate Compass with Rails 3.1 asset pipeline

This gist is no longer valid. Please see Compass-Rails for instructions on how to install.