Skip to content

Instantly share code, notes, and snippets.

@JAffleck
JAffleck / printme.js
Created April 18, 2024 14:24
PrintMe - Image remover, and table row/cell background clearer to save ink
// To use this bookmarklet just urlencode this, and remove the comment lines, create a new bookmark and copy this into the url
javascript:(function(){
//remove image elems
for (let i= document.images.length; i-->0;)
document.images[i].parentNode.removeChild(document.images[i]);
// make TR and TD elems background white
let tableElems = document.querySelectorAll('tr, td');
for(let i=0; i<tableElems.length;i++)
tableElems[i].style.backgroundColor='white';})();
@JAffleck
JAffleck / gist:b443db7aeac72574d624f5a58c9c60ae
Created November 22, 2021 21:17
Vim Title Case something that was Embiggend
"Match Groups (1st letter), (rest of letter characters (as many in a row as possible))
"\u = Uppercase next character of 1st match
"\L = Lowercase rest of word
%s/\v<(\w)(\w{1,})/\u\1\L\2/g
@JAffleck
JAffleck / Adblock Simple.js
Created June 16, 2021 15:07 — forked from kbauer/Adblock Simple.js
A simple adblocker bookmarklet, removing suspicious iframes. To install, copy-paste the source to a bookmark (will automatically remove newline characters). Extend the array ``exceptOrigins`` in order to create new exceptions. Careful: If bookmarklets get too long, they might stop working. This methods provides on-demand adblocking (as opposed t…
javascript:/* Adblock Simple */
(function(){
const exceptOrigins = [
'https://disqus.com',
document.origin
];
function remIF(e){
try{
var orgn = new URL(e.src || 'http://unknown-src').origin;
/*
MyPage bookmarklet
Copyright 2006 Steve Clay
License: http://mrclay.org/licenses/bsd.html
*/
// this lets you remove individual elements (I only use R, and esc)
/*
Perform actions via keyboard (mouse over [?] in the top right corner)
R Remove selected element(s)
U Undo removal
(function() {
var CLASS = 'hide-images';
var STYLE = 'html body,html body *,html body *::before,html body *::after { background-image: none !important; } html body img, html body svg, html body video, html body iframe { opacity: 0.02 !important; }';
var block = document.querySelector('.' + CLASS);
// add/remove style block to override images
if (block) block.remove();
else {
block = document.createElement('style');
block.className = CLASS;
@JAffleck
JAffleck / select.bat
Created August 28, 2020 19:03
Open explorer, select file from batch file
@echo off
set filename=%1
set "strToMeasure=%CD%"
call :strLen strToMeasure strlen
@REM echo.String is %strlen% characters long
call :filePath %strlen% %filename%
exit /b
@REM methods stolen to get string length
@JAffleck
JAffleck / gist:48b7c776a01ad5bc30cb11749f725da1
Created June 4, 2020 23:21
Bookmarklet - Remove page elements
`javascript:javascript:(function(){var d=document,i=0,l,em=0,ed,b=d.body,w=window,sl=[],hid=[],$=b.getElementsByTagName('*'),cTp=(d.all&&!w.opera)?'absolute':'fixed',css=d.createElement('style');css.type='text/css';css.media='all';var cT='#mPp{font-size:15px;padding:5px;background:#fdd;color:#000;position:'+cTp+';top:0;right:0;zIndex:1000;text-align:right}#mPp:hover{padding:.5em;line-height:1.6;}#mPp:hover u{display:none}#mPp i{display:none;text-align:left;cursor:default;color:#000}#mPp:hover i{display:block}#mPp b{border:1px outset #000;background:#fff;color:#666;padding:0 2px;margin-right:4px}#mPe{position:absolute;left:0;right:0;padding:5px 10px;background:#fdd;text-align:left}#mPe textarea{width:99%;display:block}'+'.mPs,.mPs *{background:#ff0;color:#000;}.mPh{background:#ffc;}.mPi,.mPi *{background:#fff;width:auto;float:none;margin:1em 0;padding:0;}body.mPi{text-align:left;margin:0;}'.replace(/;/g,' !important;');if(css.styleSheet)css.styleSheet.cssText=cT;else css.appendChild(d.createTextNode(cT));d.get
@JAffleck
JAffleck / iframe-killa
Created June 4, 2020 23:18 — forked from rodmcnew/iframe-killa.js
This is a bookmarklet that removes all iframes from the current page. Paste its code into a bookmark URL field. Click the bookmark to remove all iframes. Once started, it also removes newly spawned iframes every 100ms.
javascript:void(function(){setInterval(function(){document.querySelectorAll('iframe').forEach(function(element){console.log('Iframe Killa - Removing Element:', element);element.parentNode.removeChild(element)})},100)}());
@JAffleck
JAffleck / editWithNeoVIm.reg
Created June 17, 2018 05:42
Neovim - Edit With Neovim WIndows Context menu
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\*\shell\Neovim]
@="Edit with Neovim"
"Icon"="C:\\tools\\neovim\\Neovim\\bin\\nvim-qt.exe"
[HKEY_CLASSES_ROOT\*\shell\Neovim\command]
@="\"C:\\tools\\neovim\\Neovim\\bin\\nvim-qt.exe\" \"%1\""
@JAffleck
JAffleck / Hub.json
Last active December 14, 2018 17:17
Running Webdriver tests in VirtualBox VM in Microsoft Edge in Selenium Grid 3
{
"port": 4444,
"newSessionWaitTimeout": -1,
"servlets" : [],
"withoutServlets": [],
"custom": {},
"capabilityMatcher": "org.openqa.grid.internal.utils.DefaultCapabilityMatcher",
"throwOnCapabilityNotPresent": true,
"cleanUpCycle": 5000,
"role": "hub",