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
# Check if remote file exists | |
def remote_file_exists?(full_path) | |
'true' == capture("if [ -e #{full_path} ]; then echo 'true'; fi").strip | |
end | |
# Check if process is running | |
def remote_process_exists?(pid_file) | |
capture("ps -p $(cat #{pid_file}) ; true").strip.split("\n").size == 2 | |
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
RSpec::Matchers.define :be_json do |expected| | |
match do |actual| | |
acturl_json = | |
ActiveSupport::JSON.decode(ActiveSupport::JSON.encode(actual)) | |
expected_json = | |
ActiveSupport::JSON.decode(ActiveSupport::JSON.encode(expected)) | |
acturl_json == expected_json | |
end | |
diffable |
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 X | |
module Y | |
end | |
end | |
module X | |
module Z | |
Y # = X::Y | |
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
require 'date' | |
class Date | |
def programmers_day? | |
self.yday == 0x100 | |
end | |
end | |
Date.today.programmers_day? # => true if today is 9/14 |
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
gem 'thin' | |
gem 'sinatra', :require => 'sinatra/base' | |
gem 'async_sinatra', :require => 'sinatra/async' | |
group :development, :test do | |
gem 'rspec-rails' | |
end |
NewerOlder