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
def get_all_branches | |
value = `git branch --list` | |
value.split("\n") | |
end | |
def parse_branch_name(branch_name_line) | |
branch_name_line.match(/^(\*\s)?(\s{2})?(.*)$/i).captures.last | |
end | |
def print_branch_names(branch_names) |
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
private void WaitUntil(Action assertion, int timeoutMillis) | |
{ | |
var cancelTokenSource = new CancellationTokenSource(timeoutMillis); | |
var token = cancelTokenSource.Token; | |
var t = Task.Factory.StartNew(() => | |
{ | |
while (true) | |
{ | |
try |
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
$$('.file-info').forEach(fileInfo => { | |
const trimName = fileInfo.textContent.trim().toLowerCase(); | |
const excludeSuffixes = ['.csproj', 'packages.config', 'app.config', 'production.config', 'qa.config', 'dll.refresh', '.sln', 'assemblyinfo.cs']; | |
const shouldDelete = excludeSuffixes.find(s => trimName.endsWith(s)); | |
if (shouldDelete) { fileInfo.closest('.js-file').remove(); } | |
}); |
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
def get_default_features | |
[ | |
{'name' => 'Feature1', 'enabled' => true}, | |
{'name' => 'Feature2', 'enabled' => true} | |
] | |
end | |
# Param will be in the shape: | |
# {'name': 'FeatureName', 'enabled': true/false} | |
def set_feature(original_feature_set, feature_to_set) |
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
import boto3 | |
import sys | |
import time | |
# Script param validation. | |
def validate_params(): | |
param_error_found = False | |
if len(sys.argv) < 3: | |
param_error_found = True | |
if sys.argv[1].lower() not in ['qa0', 'qa1', 'qa2', 'qa3', 'qa4', 'qa5', 'qa6', 'qa7', 'qa8', 'qa9', 'qa10']: |
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
// https://developers.google.com/web/updates/2017/04/headless-chrome | |
const fs = require('fs'); | |
const {Builder, By, Capabilities, Key, until} = require('selenium-webdriver'); | |
const chromedriver = require('chromedriver'); | |
const chromeCapabilities = Capabilities.chrome(); | |
chromeCapabilities.set('chromeOptions', {args: ['--headless']}); | |
async function test() { | |
// Note: On macOS, you'll likely see a new Chrome process flash on your 'Dock' | |
// when this new driver object is built. As it's launched headlessly, it's |
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 'sinatra/base' | |
require 'rack' | |
# http://recipes.sinatrarb.com/p/embed/event-machine | |
class WebService < Sinatra::Base | |
def initialize(test_obj) | |
super() | |
@test_obj = test_obj | |
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
class TodoItem | |
attr_reader :name | |
attr_accessor :status | |
def initialize(arg1) | |
@name = arg1 | |
@status = false | |
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 'selenium-webdriver' | |
begin | |
driver = Selenium::WebDriver.for :chrome | |
driver.get 'http://google.com' | |
search_input_field = driver.find_element(:id => 'lst-ib') # Returns an instance/object of the WebElement class. | |
search_input_field.send_keys('Ryan Buff') | |
ensure | |
driver.quit |
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
# WebDriver API Examples | |
driver = WebDriver.new('Chrome') | |
# Example of sending keystrokes to an input field. | |
input_el = driver.find_element(<some_input_selector_goes_here>) # <-- Returns an instance of the WebElement class. | |
input_el.send_keys('Hey') # <-- Sends keystrokes to the retrieved input WebElement object. | |
# Example of clicking a button. | |
button_el = driver.find_element(<some_button_selector_goes_here>) # <-- Returns an instance of the WebElement class. | |
button_el.click() # <-- Clicks the retrieved button WebElement object. |
NewerOlder