Skip to content

Instantly share code, notes, and snippets.

Avatar

Alan Richardson eviltester

View GitHub Profile
@eviltester
eviltester / closeAllDoors.js
Last active Jan 5, 2021
Challenge 13 of the 12 Days of TestMas 2020 challenge
View closeAllDoors.js
var _0x2014=['class','div.door','27DvQMlz','323835EbRkHy','236136uYgZaz','data-date','2022/12/12','removeAttribute','988067lbpwFN','181827nlOrMb','785308bizyhW','querySelectorAll','1DhEcvB','div.door\x20a','forEach','setAttribute','1010029ZNxBZi','13133dzTUde'];var _0x29e1=function(_0x2c1487,_0x3e2de6){_0x2c1487=_0x2c1487-0x10b;var _0x20149e=_0x2014[_0x2c1487];return _0x20149e;};var _0x3b985f=_0x29e1;(function(_0xe08d5a,_0x2ed766){var _0x5a9c86=_0x29e1;while(!![]){try{var _0x208977=-parseInt(_0x5a9c86(0x112))*parseInt(_0x5a9c86(0x11b))+parseInt(_0x5a9c86(0x118))+parseInt(_0x5a9c86(0x117))+parseInt(_0x5a9c86(0x119))+parseInt(_0x5a9c86(0x113))+parseInt(_0x5a9c86(0x111))*-parseInt(_0x5a9c86(0x10e))+-parseInt(_0x5a9c86(0x10d));if(_0x208977===_0x2ed766)break;else _0xe08d5a['push'](_0xe08d5a['shift']());}catch(_0x10ce15){_0xe08d5a['push'](_0xe08d5a['shift']());}}}(_0x2014,0x7ac63),document[_0x3b985f(0x11a)](_0x3b985f(0x110))[_0x3b985f(0x10b)](_0x10bccc=>{var _0x1412a1=_0x3b985f;_0x10bccc[_0x1412a1(0x10c)](_0x1412a1
@eviltester
eviltester / gist:5fb355076c11c9eed8ef0a56a96971f7
Created Jun 23, 2020
some example page scraping examples and output to console using JavaScript
View gist:5fb355076c11c9eed8ef0a56a96971f7
document.querySelectorAll("tbody tr td[style*='15px']").forEach(function(item, index){console.log(item.innerText)})
document.querySelectorAll("tbody tr td[style*='15px']").forEach(function(item, index){console.log("<option value='" + item.innerText + "'>" + item.innerText + "</option>")})
document.querySelectorAll("tbody tr td[style*='15px']").forEach(function(item, index){console.log("\"" + item.innerText + "\", ")})
@eviltester
eviltester / format web pages for readability
Created Jun 16, 2020
right click, inspect, find <body>, paste this into the element style
View format web pages for readability
color: black !important;
background: white !important;
font-size: 2em !important;
font-family: sans-serif !important;
View gist:71c05ae1ea584826feac7e140f249576
// find the text line in a feed item e.g. [person] commented on this
window.setInterval(function(){
Array.from(document.querySelectorAll("div.feed-shared-text-view > span > span")).forEach(function(item){
if(item.innerText.endsWith(" this") || item.innerText.endsWith(" this insightful")){
// mark it for ignoring and the parent for deletion
item.className="IGNORE";
item.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.style.display="none";
item.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.className="DELETEENTRY";
}});},100)
View gist:42de6e41d2d1cdd591be0fc024f10920
// https://playtictactoe.org/
function playGame(){
var restart = document.querySelector("div.restart");
if(restart.style.display=="block"){
restart.click()
}else{
var squares = document.querySelectorAll("div.square > div:not(.x):not(.o)");
var item=Math.floor(Math.random()*squares.length)
View gist:cb27abecdd2eda4abbe82e68ddbd32f7
// http://zzzscore.com/1to50/en
function clickAllSquares(){
var clickedCount=0;
for(currentNum=1;currentNum<51;currentNum++){
console.log("processing "+currentNum);
cells = document.querySelectorAll("div#grid div");
for(var cellindex=0;cellindex<cells.length;cellindex++){
var foundInt = parseInt(cells[cellindex].innerText);
if(foundInt==currentNum){
View gist:f4658a75f99947ecf140cfa1b2ebc369
// http://zzzscore.com/1to50/en
function clickAllSquares(){
var clickedCount=0;
for(currentNum=1;currentNum<51;currentNum++){
console.log("processing "+currentNum);
cells = document.querySelectorAll("div#grid div");
for(var cellindex=0;cellindex<cells.length;cellindex++){
var foundInt = parseInt(cells[cellindex].innerText);
if(foundInt==currentNum){
View bitbloxs examples
var xhttp = new XMLHttpRequest();
xhttp.open("GET","https://bitbloxs.herokuapp.com/boxes?api_key=thisistheapikey");
xhttp.onload = (e)=>{
console.log(xhttp.status);
console.log(xhttp.responseText);
}
xhttp.send(null);
View gist:11093f0e4c501a41990e227393184eda
var timer=100;document.querySelectorAll("div > input[type='checkbox']:checked").forEach((interest) => {setTimeout(function(){interest.click()},timer);timer+=2000;});
@eviltester
eviltester / _sample.java
Created Nov 11, 2019
deprecated example using a firefox plugin
View _sample.java
@Test
public void firefoxUseExtensions() throws IOException {
// **************************************************************************
// profile is good for setting preferences and fiddling with browser settings
// **************************************************************************
// Download the extension to a local folder
String s = File.separator;
String extensionPath = System.getProperty("user.dir") +