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
#!/bin/sh | |
###################################################################### | |
# | |
# switch_bundler_environment OLD-BRANCH NEW-BRANCH | |
# | |
# Swap out the old branch's Bundler environment, and swaps in the new | |
# branch's. Arguments may be branch names or SHAs. | |
# | |
# For best results, add this to .git/hooks/post-checkout: |
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 | |
# | |
# Run redis-server with settings taken from the command line. | |
# | |
# Source: https://gist.github.com/929513 | |
# | |
require 'optparse' | |
require 'fileutils' |
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
# | |
# Runs two blocks in parallel, yielding a barrier to each for | |
# synchronization. The barrier may be called multiple times in each | |
# block to establish multiple synchronization points. | |
# | |
# parallel do | |
# process do |barrier| | |
# ... | |
# barrier.call | |
# ... |
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
ActiveRecord::Base.class_eval do | |
def self.ignore_columns(*names) | |
extend ColumnIgnorance | |
ignored_columns.merge names.map(&:to_s) | |
end | |
module ColumnIgnorance | |
def columns | |
return @columns if @columns | |
@columns = super.reject do |column| |
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
class Person | |
attr_reader :full_name, :age, :profession, :favorite_food | |
def initialize(full_name, age, profession, favorite_food) | |
@full_name = full_name | |
@age = age | |
@profession = profession | |
@favorite_food = favorite_food | |
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
#!/usr/bin/env ruby | |
# Demonstrates the superiority of Goliath over Unicorn for a single-process app | |
# handling file uploads. | |
# | |
# This program runs in 3 modes: | |
# | |
# ./goliath-vs-unicorn goliath - Runs the goliath server on the default port (9000) | |
# ./goliath-vs-unicorn unicorn - Runs the unicorn server on the default port (8080) | |
# ./goliath-vs-unicorn upload - Upload 5 files in parallel to the port given by -p |
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 | |
###################################################################### | |
# | |
# Open the given file names in Aquamacs. | |
# | |
# If the user already has an Aquamacs process open, use it. | |
# Otherwise, fire up a new one. Only Aquamacs instances without a | |
# controlling terminal (i.e., those running in a window) will be | |
# selected. |
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 | |
keep = `git config git-delete-merged-branches.persist`.strip.split(',') | |
puts "preserving: #{keep.join(', ')}" | |
current_branch = `git rev-parse --abbrev-ref HEAD`.strip | |
`git branch --merged`.lines.each do |line| | |
next if line =~ /\A\* / | |
branch, target = line.strip.split(' -> ', 2) | |
next if keep.include?(branch) || keep.include?(target) |
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
class RDownloadStrategy < SubversionDownloadStrategy | |
def stage | |
quiet_safe_system "cp", "-r", @clone, Dir.pwd | |
Dir.chdir cache_filename | |
end | |
end | |
class R < Formula | |
homepage "http://www.r-project.org/" | |
url "http://cran.rstudio.com/src/base/R-3/R-3.1.2.tar.gz" |
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 | |
keep = `git config git-delete-merged-branches.persist`.strip.split(',') | |
puts "preserving: #{keep.join(', ')}" | |
current_branch = `git rev-parse --abbrev-ref HEAD`.strip | |
`git branch --merged`.lines.each do |line| | |
next if line =~ /\A\* / | |
branch, target = line.strip.split(' -> ', 2) | |
next if keep.include?(branch) || keep.include?(target) |
OlderNewer