Skip to content

Instantly share code, notes, and snippets.

@forest
forest / git cheat
Created April 25, 2009 07:58
Git Cheat. #git #cheat
# create a branch
git branch <branch>
# delete a branch
git branch -d|D <branch>
# go back to master
git checkout master
# merge branch to master
@forest
forest / rails_site_template.rb
Created January 8, 2010 21:43
Rails 2.3 Site Template
#
# rails_site_template.rb
# based on:
# Suspenders by Thoughtbot
# http://m.onkey.org/2008/12/4/rails-templates
# http://github.com/jeremymcanally/rails-templates/blob/master/sethbc.rb
#
# Created by Forest Carlisle on 2009-12-30.
#
@forest
forest / rakefile.rb
Created January 22, 2010 17:25
Rakefile to build xcode projects in nested directory structure. #xcode
###########################################################################
# XCode Tasks
###########################################################################
XCODE_PROJECTS_CACHE = 'xcode_projects_cache.yml'
def xcode_projects
projects = []
if File.exist?(XCODE_PROJECTS_CACHE)
@forest
forest / setup-statsd.sh
Created May 23, 2011 16:36 — forked from jasonroelofs/setup-statsd.sh
Turn an Ubuntu 10.10 EC2 into a StatsD/Graphite 0.9.8 server
# install git
sudo apt-get install g++ curl libssl-dev apache2-utils
sudo apt-get install git-core
# download the Node source, compile and install it
git clone https://github.com/joyent/node.git
cd node
./configure
make
sudo make install
# install the Node package manager for later use
@forest
forest / README.markdown
Created May 2, 2012 15:15 — forked from jrust/README.markdown
Bootstrap's Typeahead plugin extended (AJAX functionality, comma-separated values, autowidth, and autoselect)

This is a fork of a fork of Bootstrap Typeahead that adds minimal but powerful extensions.

  • Ability to disable autoselect of first matched element.
  • Ability to automatically set the width of the dropdown to that of the text input.
  • Ability to fetch source element via AJAX
  • Ability to have a comma separated list of tags.

For the proper source, and other examples, please see the original gist.

Example showing off all the above features

@forest
forest / iterations.erb
Created August 15, 2012 17:30 — forked from cbrunnkvist/iterations.erb
Pivatol Tracker Iteration View
<% iterations.each do |iteration| %>
<h2 id='Sprint_<%= iteration.number %>' style='display:inline'>Sprint <%= iteration.number %></h2><i> - ends <%= iteration.finish.strftime("%Y-%m-%d") %></i><a href='#Sprint_<%= iteration.number %>' class='anchor'>&nbsp;&para;</a>
<ul>
<% iteration.stories.each do |story| %>
<li class='story'><h3 style='display:inline'><i>Story <%= story.id %> (<%= story.current_state %>)</i></h3>
<small class='taskCount'><i><%= " - #{story.tasks.size} tasks defined" if story.respond_to?(:tasks) %></i></small>
<p class='storyDescription'><span class="storyIngress"><%= story.name%></span><br><span class="storyRest" style="color:grey"></span></p>
<% end %>
</ul>
<% end %>
@forest
forest / deliver_stories
Created November 9, 2012 18:48
A script to connect to tracker, look for finished stories, grep the git log, and mark the finished ones as delivered
#!/usr/bin/env ruby
# gem 'pivotal-tracker'
require 'pivotal-tracker'
TRACKER_TOKEN = "..."
TRACKER_PROJECT_ID = "..."
PivotalTracker::Client.token = TRACKER_TOKEN
PivotalTracker::Client.use_ssl = true
@forest
forest / deliver_stories
Created November 9, 2012 18:48
A script to connect to tracker, look for finished stories, grep the git log, and mark the finished ones as delivered. #jenkins #pivotal-tracker
#!/usr/bin/env ruby
# gem 'pivotal-tracker'
require 'pivotal-tracker'
TRACKER_TOKEN = "..."
TRACKER_PROJECT_ID = "..."
PivotalTracker::Client.token = TRACKER_TOKEN
PivotalTracker::Client.use_ssl = true
@forest
forest / natcmp.rb
Created July 17, 2013 18:58
Natural order comparison of two strings
# natcmp.rb
#
# Natural order comparison of two strings
# e.g. "my_prog_v1.1.0" < "my_prog_v1.2.0" < "my_prog_v1.10.0"
# which does not follow alphabetically
#
# Based on Martin Pool's "Natural Order String Comparison" originally written in C
# http://sourcefrog.net/projects/natsort/
#
# This implementation is Copyright (C) 2003 by Alan Davies
@forest
forest / rights.rb
Last active December 21, 2015 04:48
Use OO instead of basic ruby types to represent Rights
ALL_RIGHTS = [
CAN_ACCESS_RESOURCES,
CAN_ACCESS_ORGANIZATIONS,
CAN_CREATE_ORGANIZATIONS,
CAN_ACCESS_SCHOOL_EDITION
]
# ---------------------------