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
def get_ansible_host(config, inventory, host, ssh_config=None, | |
ssh_identity_file=None): | |
if is_empty_inventory(inventory): | |
return testinfra.get_host('local://') | |
hostvars = inventory['_meta'].get('hostvars', {}).get(host, {}) | |
connection = hostvars.get('ansible_connection', 'ssh') | |
if connection not in ('ssh', 'local', 'docker', 'lxc', 'lxd'): | |
wrote pytestdebug information to /roles/test-windows-config/molecule/windows/pytestdebug.log | |
raise NotImplementedError( | |
> 'unhandled ansible_connection {}'.format(connection)) |
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
# name this file spec_helper.rb, and put it in the spec directory (root_of_app/spec/[file]) | |
require File.join(File.dirname(__FILE__), '..', 'my_sinatra_app.rb') | |
require 'sinatra' | |
require 'rack/test' | |
#setup test environment | |
set :environment, :test |
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
puts "I want to pay x amount per month. How much house can I afford?" | |
each_payment = gets.chomp.to_i | |
interest_rate = 0.045 | |
interest_rate_per_period = interest_rate/12 | |
number_of_payments = 360 | |
loan_amount = (each_payment/interest_rate_per_period)*(1-(1+interest_rate_per_period)**-number_of_payments) | |
puts loan_amount |
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
=begin | |
first edition: 11/15/2011 | |
I created this script in order to help me create files with the same extension quickly. It's not too powerful, but gets | |
the job done and can be somewhat customized to suit the needs of the user (granted if they can code in ruby) | |
Hope it helps! | |
-Chris |
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 'rubygems' | |
require 'sinatra' | |
get '/' do | |
"enter the tracking number in the url: | |
ltracker.heroku.com/tracking/(your tracking number)" | |
end | |
get '/tracking/:number' do | |
# UPS code |