This file contains hidden or 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 Thing | |
def method_missing(method, *args, &block) | |
puts method.to_s.gsub /_/, " " | |
end | |
end | |
Thing.new.send <<-T_REX | |
_____________.-=-==--==--. | |
_______..-=="__,'o`)______`. | |
_____,'_________`"'_________\\ |
This file contains hidden or 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
vagrant ssh -c "nohup java -jar /vagrant/my_app.jar >> my_app.out 2>&1 &" |
This file contains hidden or 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 'httparty' | |
require 'json' | |
class QueueInspector | |
include HTTParty | |
basic_auth "guest", "guest" | |
base_uri "http://192.168.0.1:55672" | |
def messages | |
body = {'count' => 5,'requeue' => true, 'encoding' => 'auto', 'truncate' => 50000}.to_json |
This file contains hidden or 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
#Getting this? | |
<<-ANNOYING_ERROR | |
Failure/Error: response = http.request(request) | |
OpenSSL::SSL::SSLError: | |
SSL_connect returned=1 errno=0 state=SSLv2/v3 read server hello A: (null) | |
ANNOYING_ERROR |
This file contains hidden or 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 'active_support/time' | |
def duration_of(input) | |
Time.at(input).gmtime.strftime "0000-00-00T%H:%M:%S" | |
end | |
duration_of 6.seconds #=> "0000-00-00T00:00:06" | |
duration_of 70.seconds #=> "0000-00-00T00:01:10" | |
duration_of 5.minutes #=> "0000-00-00T00:05:00" |
This file contains hidden or 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
# Example Rakefile that demonstrates how to add task dependencies | |
# to custom rake tasks that don't allow for the normal rake task | |
# behaviour around setting task dependencies. | |
require 'cucumber/rake/task' | |
# here's the task that I want to run before any of my cucumber tasks (see below) | |
namespace :stub do | |
desc "Start stub required by features" | |
task :start do |
This file contains hidden or 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
#substitute LIBNAME for the library you want. Eg: grails | |
brew tap homebrew/versions | |
brew versions LIBNAME | |
#2.1.2 git checkout 5c5b964 /usr/local/Library/Formula/grails.rb # <== we want this version | |
#2.1.3 git checkout d08ef78 /usr/local/Library/Formula/grails.rb | |
#2.1.1 git checkout 1bcf5af /usr/local/Library/Formula/grails.rb | |
#... | |
cd /usr/local | |
git checkout 5c5b964 Library/Formula/LIBNAME.rb # <== notice the hash, it's a reference to the version we want |
This file contains hidden or 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 'reek/rake/task' | |
Reek::Rake::Task.new do |t| | |
t.config_files = "config.reek" | |
t.source_files = "**/*.rb" | |
t.fail_on_error = false | |
t.reek_opts = "-q" #only list smelly files | |
end |
This file contains hidden or 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 'rspec/core/rake_task' | |
namespace :stubs do | |
namespace :schedule do | |
pid_file_path = "lib/stubs/schedule.pid" | |
desc "Start the schedule stub" | |
task :start do | |
`rackup -D lib/stubs/schedule.ru -P #{pid_file_path} -p 2000` | |
end |
This file contains hidden or 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
#in env.rb: | |
require 'active_support/time' | |
Time.zone = 'Europe/London' | |
#use in tests instead of `Time.now`: | |
Time.current #=> will output the time in London, regardless of the localhost's timezone |