Skip to content

Instantly share code, notes, and snippets.

View pjmelling's full-sized avatar

Peter Melling pjmelling

View GitHub Profile
@pjmelling
pjmelling / capybara cheat sheet
Created July 7, 2017 22:06 — forked from zhengjia/capybara cheat sheet
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@pjmelling
pjmelling / relativeUrl.js
Created January 26, 2017 20:03 — forked from tkw1536/relativeUrl.js
Resolve a relative URL in client-side JavaScript with jQuery.
/*
Resolves a relative url
@param url Url to resolve
@param base Optional. Base url to use.
@param isDir Optional. If set to true, will return a directory name ending with a slash.
*/
var resolve = function(url, base, isDir){
var resolveWithBase = false;
var baseUrl, oldBase, newBase;