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 'active_support/all' | |
require 'HTTParty' | |
require 'json' | |
UK_CHILD_DECIMAL = 0.189 | |
UK_ADULT_DECIMAL = 1.0 - UK_CHILD_DECIMAL | |
UK_POPULATION = 67_886_004.0 | |
UK_ADULT_POPULATION = UK_POPULATION * UK_ADULT_DECIMAL | |
DOWNLOAD_URL = 'https://api.coronavirus.data.gov.uk/v1/data?filters=areaType=nation&structure={"date":"date","total":"cumPeopleVaccinatedFirstDoseByPublishDate","new":"newPeopleVaccinatedFirstDoseByPublishDate"}' | |
# v2 is not working today (Jan. 26), and instead respondes with a |
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
day | new | total | |
---|---|---|---|
1 | 0 | 0 | |
2 | 0 | 0 | |
3 | 0 | 0 | |
4 | 0 | 0 | |
5 | 0 | 0 | |
6 | 0 | 0 | |
7 | 0 | 0 | |
8 | 2 | 2 | |
9 | 0 | 2 |
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 'watir' | |
b = Watir::Browser.new | |
b.goto "https://nytimes.com" | |
b.driver.manage.logs.get(:browser).each do |log| | |
puts log | |
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 'whois' | |
require 'whois-parser' | |
require 'addressable/uri' | |
require 'public_suffix' | |
class Registrar | |
class << self | |
def lookup(domain, timeout = 30) | |
tld = tld_domain(domain) | |
base_tld_definition = Whois::Server.definitions(:tld).map{|s| s if s[0] == tld}.compact.first |
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 'watir-webdriver' | |
profile = Selenium::WebDriver::Firefox::Profile.new | |
profile.add_extension "/your/path/to/Firefox/profile/extensions/[email protected]" | |
profile.add_extension "/your/path/to/Firefox/profile/extensions/[email protected]" | |
profile["extensions.firebug.currentVersion"] = "2.0.14" # Supress "What's new in Firebug" tab from opening. | |
profile["extensions.firebug.delayLoad"] = false | |
profile["extensions.firebug.showFirstRunPage"] = false | |
profile["extensions.firebug.console.enableSites"] = true |
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/env ruby | |
# encoding: utf-8 | |
# Trying to replicate error described in a StackOverflow Question | |
# http://stackoverflow.com/questions/31065711/watir-webdriver-does-not-show-dialogs-in-firefox-when-finished-testing | |
require 'os' | |
require 'headless' | |
require 'watir-webdriver' | |
require 'yaml' |
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/env ruby | |
# encoding: utf-8 | |
# Trying to replicate error described in a StackOverflow Question | |
# http://stackoverflow.com/questions/31065711/watir-webdriver-does-not-show-dialogs-in-firefox-when-finished-testing | |
require 'os' | |
require 'headless' | |
require 'watir-webdriver' |
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 SammerHammer < RTanque::Bot::Brain | |
NAME = 'sammer_hammer' | |
include RTanque::Bot::BrainHelper | |
TURRET_FIRE_RANGE = RTanque::Heading::ONE_DEGREE * 5.0 | |
def tick! | |
## main logic goes here | |
@desired_heading ||= nil |