Skip to content

Instantly share code, notes, and snippets.

Feature: Paul pays employees
In order to retain staff
As Paul the Payroll Manager I want to pay my staff
Scenario:
Given an admin user called "Paul" with a password "password"
And a user called "Bob"
And "Bob" is an employee
And "Bob" gets paid "$2,000" a month
When I visit the homepage
@chrismdp
chrismdp / committer_stats.rb
Created June 26, 2011 21:49
Committer stats
committers = `git log --pretty=format:%an`
authors = []
committers.each_line do |commit|
commit.chomp.split(' and ').map{|a| authors.push a}
end
stats = Hash.new(0)
authors.map do |author|
stats[author] += 1
end
@chrismdp
chrismdp / bootstrap_chef.bash
Created June 15, 2011 07:12 — forked from michaelvobrien/bootstrap_chef.bash
Bootstrap Chef Solo on Ubuntu
#!/usr/bin/env bash
# call like this on the target server:
# NODENAME='foo' CHEF_ENV='production' RUNLIST='["role[foo]","recipe[bar]"]' CHEFREPO='git@example.com:repo.git' bash <( curl -L https://raw.github.com/gist/1026628 )
# You will need to ensure that the ssh key is already set up on the server.
set -e
export CHEF_DIR="${HOME}/chef"
sudo rm -rf $CHEF_DIR
mkdir -p "$CHEF_DIR"
def authors_from_commit(commit)
authors = []
commit.chomp.split(' and ').map{|a| authors.push a}
authors
end
def authors_from_commits(commits)
authors = []
commits.each do |commit|
authors += authors_from_commit(commit)
@chrismdp
chrismdp / cycle-metrics.html
Created March 1, 2010 21:51
to use, replace line 47 with your project list, and line 51 with your metrics host...
<html>
<head>
<script type='text/javascript' src='jquery-1.3.2.min.js'></script>
<script type='text/javascript' src='jquery.cycle.lite.1.0.min.js'></script>
<style>
body { margin: 0 }
li { width: 100% }
h1 {
position: absolute;
font-family: arial;
@chrismdp
chrismdp / hamlserve.rb
Created September 16, 2009 15:01
Put this one level above a 'views' directory and run it. haml/sass parsing for quickfire templating... you'll need the haml, sass and sinatra gems.
require 'rubygems'
require 'sinatra'
require 'haml'
require 'sass'
get '/stylesheet.css' do
content_type 'text/css', :charset => 'utf-8'
sass :stylesheet
end