Skip to content

Instantly share code, notes, and snippets.

View mcherryleigh's full-sized avatar
🌪️
Making a mess

Michael Cherry-Leigh mcherryleigh

🌪️
Making a mess
View GitHub Profile
@mcherryleigh
mcherryleigh / status-code-bot.js
Last active May 12, 2017 00:37
A bot that responds with either a list of http status codes or a cat meme for an individual status.
var express = require('express');
var bodyParser = require('body-parser');
var yargs = require('yargs');
var argv = require('yargs')
.alias('p','port')
.number('p')
.require('p')
.argv
@mcherryleigh
mcherryleigh / useThisInChrome.js
Last active June 30, 2016 21:03
Find and prioritize locators from chrome console. can be copy-pasted into a console command in Chrome or saved and run from dev tools -> sources -> snippets
//formLoc is the root element to look under. It should be a string representing a css selector
//if testing is true print the easily debuggable obj. If not true, drop the debug "element" keys and json.stringify
var getSelectors = function(formLoc, testing=false) {
var counter = 1;
var results = {};
var getTheseTags = 'a,button,input';
//css selector to find children of. Loop over each and use the most-desirable option as their location strategy
$$(`${formLoc} ${getTheseTags}`).forEach(function(el) {
if(el.attributes.hasOwnProperty('id')){
results[`needsName${counter}`] = {element: el, id: el.id}