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
namespace(:pb) do | |
desc "Symlink the databse config file from shared drectory to current release directory." | |
task :symlinks do | |
run "ln -nsf #{shared_path}/config/database.yml #{release_path}/config/database.yml" | |
run "ln -nsf #{shared_path}/config/initializers/site_keys.rb #{release_path}/config/initializers/site_keys.rb" | |
end | |
end | |
namespace(:deploy) do | |
desc "Tell Passenger to restart the server" |
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
// Instance method in my XML Reader to easily read dates from the XML | |
// Pretty sure I have the date formatting right, per the link from the Apple documentation | |
// http://unicode.org/reports/tr35/tr35-4.html#Date_Format_Patterns | |
-(NSDate *)dateWithString:(NSString *)dateString { | |
NSDateFormatter * formatter = [[[NSDateFormatter alloc] init] autorelease]; | |
[formatter setDateFormat:@"yyyy-MM-DD HH:mm:ss ZZ"]; | |
NSLog(@"Converting '%@' to '%@'", dateString, [formatter dateFromString:dateString]); | |
return [formatter dateFromString:dateString]; | |
} |
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
--type-set=bin=.pdf | |
--nobin | |
--ignore-dir=tmp | |
--ignore-dir=coverage | |
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 | |
# | |
# Simple script to perform SCM (svn, hg, git) commands across your workspace | |
# Edit the SHARED_WORKSPACE environment variable if your code isn't checked out to ~/workspace | |
# Skip to the end for the actual execution ... to keep it all in one file, had to define the class first | |
# Get the latest version from https://gist.github.com/1090808 | |
USAGE = <<-end_usage | |
SSS performs SCM commands on all projects in your workspace. Set the | |
SHARED_WORKSPACE environment variable if your workspace is not ~/workspace. |
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
testing download |
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
# Assumes a Comment model with a message attribute contianing the text of the | |
# comment. Change these to suit your needs. | |
class Comment | |
validate :disallow_phone_numbers_and_email_addresses | |
# possibly not the most performant, but it's clear | |
# assumes you have arrays of regexes you want to dissalow | |
def disallow_phone_numbers_and_email_addresses | |
if PHONE_NUMBERS.any? { |regex| message =~ regex } | |
errors.add(:message, "cannot contain phone numbers.") |
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/bash | |
echo "Updating Homebrew and bash completion" | |
brew update | |
echo " | |
# homebrew completion files for installed libraries | |
if [ -f `brew --prefix`/etc/bash_completion ]; then | |
. `brew --prefix`/etc/bash_completion | |
fi | |
" >> ~/.bash_profile |
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
79c79 | |
< let s:code = "print ($: + begin; require %q{rubygems}; Gem.all_load_paths.sort.uniq; rescue LoadError; []; end).join(%q{,})" | |
--- | |
> let s:code = "print ($:)" |
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
Run options: include {:focus=>true} | |
All examples were filtered out; ignoring {:focus=>true} | |
Automation::CLI | |
.perform(command) | |
passes the given command to the shell | |
.say(message) | |
displays the given message | |
.perform_in(dir, &block) |
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
# desired_cluster is a hash of roles and their counts (e.g., {web: 2, redis: 1} | |
def equalize_servers fog, app, environment, desired_cluster | |
current_cluster = filtered_servers(fog, app, environment).group_by { |server| server.tags["role"] } | |
to_build = {} | |
to_destroy = [] | |
current_cluster.each do |role, servers| | |
if desired_cluster.has_key? role | |
# we want some, but do we have the right amount? | |
difference = desired_cluster[role] - servers.count |
OlderNewer