This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# This script uses Pivotal Tracker's API to generate a list of unique members | |
# from all of your projects; it then iterates over each project, adding any of | |
# those members who are missing. That way, everyone has access to everything. | |
# | |
# It only acts on projects belonging to accounts called ACCOUNT_NAME below. | |
# | |
# By default, the script doesn't proceed with the modifications, so you can | |
# double-check the pending changes. Run it again with --no-dry-run to proceed. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Originally by Nicholas A. Evans. See LICENSE.txt | |
# | |
# Note: includes modifications by Chris Kampmeier to use '=' for the progress | |
# bar mark and keep the cursor from hopping all around during the animation | |
# | |
# This version is compatible with RSpec 1.2.9 and ProgressBar 0.9.0 | |
require 'spec/runner/formatter/base_text_formatter' | |
require 'progressbar' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module EmptyDirectoryHelper | |
def self.dir_contains_files?(dir) | |
entries = Dir.entries(dir).reject { |entry| entry == '.' || entry == '..' } | |
entries.any? { |entry| !File.directory?(File.join(dir, entry)) || dir_contains_files?(File.join(dir, entry)) } | |
end | |
def self.empty_vendor_dirs | |
Dir.glob(Rails.root.join("vendor/{gems,plugins}/*")).reject { |dir| dir_contains_files?(dir) } | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A stateful version of the Integrity notifier for Campfire. It only pings the room | |
# when the build is broken or when it's just been fixed. This is nice when you already | |
# have a post-receive hook posting every commit to the same room. | |
require 'rubygems' | |
require 'integrity' | |
require 'tinder' | |
require 'action_view' | |
module Integrity |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
require 'rubygems' | |
require 'twitter' | |
require 'httparty' | |
require 'json' | |
require 'action_view' | |
include ActionView::Helpers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Monitor the processes from a set of pid files in top | |
# This doesn't work on OS X, because its top doesn't have -p. | |
top -p $(cat /var/run/*.pid | tr '\n', ',' | sed s/,$//) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module DurationHelper | |
# Takes a number of seconds as input and returns a formatted string. See | |
# tests for examples. | |
def format_duration(seconds, options = {}) | |
return "0 seconds" if seconds.floor == 0 | |
options.reverse_merge!(:parts_to_show => 4, :word_style => :short, :specific_end => false) | |
description = (options[:word_style] == :short) ? | |
[ ['sec', 60], ['min', 60], ['hr', 24], ['day'] ] : |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ShouldaContextExtensions | |
def self.included(base) | |
base.class_eval do | |
alias_method_chain :build, :fast_context | |
alias_method_chain :am_subcontext?, :fast_context | |
end | |
end | |
def fast_context(name, &blk) | |
@fast_subcontexts ||= [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# You can use newlines as delimiters for the various | |
# %-style string quoting syntaxes (like %{}, %Q{}, etc.) | |
>> % | |
%s | |
>> % % | |
bacon | |
>> | |
=> "bacon" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Hide labels in Pivotal Tracker story lists | |
// @namespace http://shiftcommathree.com | |
// @description Hides the small green labels before each story title | |
// @include http://www.pivotaltracker.com/projects/* | |
// @include http://pivotaltracker.com/projects/* | |
// @author Chris Kampmeier | |
// ==/UserScript== | |
function addGlobalStyle(css) { |