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 'uri' | |
require 'digest/sha1' | |
class BitlyURLRewriter | |
DOMAIN = "later.ly" | |
def update_domain(url) | |
URI.parse(url).tap { |uri| uri.host = "later.ly" } | |
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
class TolerantFetcher | |
def self.get(url) | |
TimeoutNinja.try do | |
timeout(20) do | |
begin | |
handle = open(url) | |
response = handle.read | |
ensure | |
handle.try(:close!) ####### HERE | |
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
#Used in the common/driver.rb of selenium-webdriver | |
L45 def for(browser, opts = {}) | |
..... | |
class SeleniumListener | |
attr_reader :file |
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
# Excerpt from features/env.rb for customizing selenium to be ran via capybara | |
....... | |
require 'cucumber/rails' | |
require 'selenium-webdriver' | |
# Use default profile for Firefox | |
# By default, selenium uses an anonymous profile so none of your settings will be enabled | |
# It is smart to setup a 'selenium' or 'test' profile to reduce the configurations you | |
# would set as a normal user of Firefox. | |
# |
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 OptionHandler | |
constructor: (@options) -> | |
@options or= {} | |
class Inverter extends OptionHandler | |
invert: () -> | |
for key, value of @options | |
@options[key] = null | |
@options[value.toLowerCase()] = key |
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
flog app/workers/campaign_worker.rb | |
14.9: flog total | |
7.5: flog/method average | |
13.8: CampaignWorker::perform app/workers/campaign_worker.rb:4 |
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
....... | |
Installing rake (0.9.2) | |
Installing Saikuro (1.1.0) | |
Installing SystemTimer (1.2.3) with native extensions | |
Installing aasm (2.2.0) | |
Installing abstract (1.0.0) | |
Installing activesupport (3.0.10) | |
Installing builder (2.1.2) | |
Installing i18n (0.5.0) | |
Installing activemodel (3.0.10) |
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 CucumberExternalResqueWorker | |
DEFAULT_STARTUP_TIMEOUT = 1.minute | |
COUNTER_KEY = "cucumber:counter" | |
class << self | |
attr_accessor :pid, :startup_timeout | |
def start | |
# Call from a Cucumber support file so it is run on startup | |
return unless Rails.env.cucumber? |
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 CircularReferenceDetector | |
attr_reader :block | |
def initialize(&block) | |
@block = block | |
end | |
def circular? node, visited=[] | |
return true if visited.include? node | |
node.extend SmartNil |
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
private static final Pattern[] URL_PATTERNS = { | |
Pattern.compile("git@(.+):([^/]+)/([^/]+).git"), | |
Pattern.compile("https://[^/]+@([^/]+)/([^/]+)/([^/]+).git"), | |
Pattern.compile("git://([^/]+)/([^/]+)/([^/]+).git"), | |
Pattern.compile("ssh://git@([^/]+)/([^/]+)/([^/]+).git") | |
}; |
NewerOlder