Skip to content

Instantly share code, notes, and snippets.


Alister Scott alisterscott

View GitHub Profile
alisterscott / wordpress-calypso-warn-on-publish.js
Last active Apr 12, 2016
A UserScript to prompt on publish for the Calypso client
View wordpress-calypso-warn-on-publish.js
// ==UserScript==
// @name WordPress Calypso Warn on Publish
// @version 0.1
// @description Warn on publish
// @author Alister Scott
// @match*
// @match http://calypso.localhost:3000/*
// @match*
// @grant none
// ==/UserScript==
alisterscott / quoth_example.rb
Created Jun 15, 2012
An example of using the quoth gem
View quoth_example.rb
require 'quoth'
puts Quoth.get
# If I have ventured wrongly, very well, life then helps me with its penalty.
# But if I haven't ventured at all, who helps me then? ~ Søren Kierkegaard
alisterscott / uuid_example.rb
Created Jun 15, 2012
An example of how to use UUIDs in ruby
View uuid_example.rb
require 'securerandom'
puts SecureRandom.uuid
# ffe71bd2-2650-4135-b366-f8da08b4b708
alisterscott / faker_example.rb
Created Jun 15, 2012
An example of the faker gem
View faker_example.rb
require 'faker'
# Nathanael Botsford
# Labadie, Marvin and Kassulke
puts Faker::Company.catch_phrase
# Self-enabling bottom-line project
# grow B2C platforms
alisterscott / watir-webdriver-downloads.rb
Created Jun 15, 2012
How to check for downloads to complete and get the file name
View watir-webdriver-downloads.rb
require 'watir-webdriver'
file_name = nil
download_directory = "#{Dir.pwd}/downloads"
download_directory.gsub!("/", "\\") if
downloads_before = Dir.entries download_directory
profile =
profile[''] = 2 # custom location
profile[''] = download_directory
alisterscott / watir-webdriver_user_agent.rb
Created Jun 13, 2012
watir webdriver user agent example
View watir-webdriver_user_agent.rb
require 'watir-webdriver'
require 'webdriver-user-agent'
driver = UserAgent.driver(:browser => :chrome, :agent => :iphone, :orientation => :landscape)
browser = driver
browser.goto ''
browser.url.should == ''
alisterscott / selenium_user_agent.rb
Created Jun 13, 2012
selenium webdriver user agent example
View selenium_user_agent.rb
require 'selenium-webdriver'
require 'webdriver-user-agent'
driver = UserAgent.driver(:browser => :chrome, :agent => :iphone, :orientation => :landscape)
driver.get ''
driver.current_url.should == ''
alisterscott / set_text_chrome_native.rb
Created Jun 6, 2012
Benchmarking the performance of a .set operation on a text field across browsers using watir-webdriver in ruby
View set_text_chrome_native.rb
require 'selenium-webdriver'
require 'watir-webdriver'
require 'bench'
d = Selenium::WebDriver.for :chrome, native_events: true
b = d
b.goto ''
benchmark 'set chrome native' do
b.text_field(name: 'q').set 'ghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghghgh'
alisterscott / block_suggestion.rb
Created May 31, 2012 — forked from natritmeyer/block_suggestion.rb
Page Object Management blog post material
View block_suggestion.rb
visit LoginPage do |page|
page.login_with('foo', 'badpass')
page.text.should include "Login error"
page.text.should include "Secure your account"
alisterscott / page_instance_variables.rb
Created May 30, 2012
Example of way to get rid of page instance variables from step defs
View page_instance_variables.rb
# was
@home =
@home.search_field.set "Sausages"
@results_page =
@results_page.should have_search_result_items
You can’t perform that action at this time.