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
source 'https://rubygems.org' | |
gem 'rack' |
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 Persistence::Mongoid::Operation | |
include Mongoid::Document | |
end | |
class Persistence::Memory::Operation | |
end | |
module Persistence | |
def self.included(klass) | |
klass.send(:include, InstanceMethods) |
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 Action | |
def self.error(target, arguments, transcript) | |
transcript.entries << { element: self, action: "error", result: :error } | |
:error | |
end | |
def self.failure(target, arguments, transcript) | |
transcript.entries << { element: self, action: "failure", result: :failure } | |
:failure | |
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
require 'open3' | |
require 'timeout' | |
def subprocess_sleep(seconds) | |
Open3.popen3("sleep #{seconds}") | |
end | |
begin | |
Timeout.timeout(2) do | |
stdin, stdout, stderr, wait_thr = subprocess_sleep(3) |
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
require 'bundler' | |
Bundler.setup(:templates) | |
require 'active_support/inflector' | |
def filename(argument) | |
"#{argument.underscore}.rb" | |
end | |
def indent(size) | |
" " * size |
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
# SRC: http://www.ruby-forum.com/topic/163430 | |
module SubclassTracker | |
def subclasses | |
classes = [] | |
ObjectSpace.each_object do |klass| | |
next unless Module === klass | |
classes << klass if klass.ancestors.include?(self) | |
end | |
classes |
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
require 'logger' | |
require 'yaml' | |
class CommandsFile | |
FILE_PATH = File.join(File.dirname(__FILE__), "commands.yml") | |
def self.load | |
commands_file = new | |
commands_file.load | |
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
#!/bin/sh | |
# Modified version of script found at | |
# http://devblog.springest.com/a-script-to-remove-old-git-branches | |
# This has to be run from master | |
git checkout master | |
# Update our list of remotes | |
git fetch origin | |
git remote prune origin |
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
TEMPLATE = "permit tcp any any eq {PORT}" | |
def generate_template(port) | |
TEMPLATE.gsub('{PORT}', port.to_s) | |
end | |
TEMPLATE = "permit tcp any any eq %{port}" | |
def generate_template(port) | |
TEMPLATE % { :port => port } |
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
' Copyright (c) 2007, Tony Ivanov | |
All rights reserved. | |
Redistribution and use in source and binary forms, with or without | |
modification, are permitted provided that the following conditions are met: | |
* Redistributions of source code must retain the above copyright | |
notice, this list of conditions and the following disclaimer. | |
* Redistributions in binary form must reproduce the above copyright | |
notice, this list of conditions and the following disclaimer in the | |
documentation and/or other materials provided with the distribution. |