Skip to content

Instantly share code, notes, and snippets.

View johnste's full-sized avatar
🐝
busy bee

John Sterling johnste

🐝
busy bee
View GitHub Profile
@johnste
johnste / bookmarklets.html
Last active January 9, 2025 08:57
Useful bookmarklets
<h1>Useful bookmarklets</h1>
<ul>
<li><a href="javascript:(function() { const urls = ['http://localhost:3000', 'https://produktion.com']; const defaultURL = urls[0];const currentOrigin = window.location.origin;const currentIndex = urls.indexOf(currentOrigin);const nextURL = currentIndex === -1 ? defaultURL : urls[(currentIndex + 1) % urls.length];window.open(window.location.href.replace(currentOrigin, nextURL));})()">Open the current URL but in a different environments</a></li>
<li><a href="javascript:(function() { const selector=prompt('Selector','.');const all=document.querySelectorAll(selector);console.log(all),[...all].map((e=>e.classList.add('debug-outline')));var newScript=document.createElement('style'),content=document.createTextNode('.debug-outline { outline: 1px solid #f0f; }');newScript.appendChild(content);var bodyClass=document.getElementsByTagName('head')[0];bodyClass.insertBefore(newScript,bodyClass.childNodes[2]),window.speechSynthesis.speak(new SpeechSynthesisUtterance(`${all.length} found`
const regex = /^https?:\/\/twitter\.com\/(?:#!\/)?(\w+)\/status(?:es)?\/(\d+)(?:\/.*)?$/
module.exports = {
defaultBrowser: "Google Chrome",
rewrite: [
{
match: ({urlString}) => {
const matches = urlString.match(regex);
finicky.log(JSON.stringify(matches, null, 2))
return matches && matches[2];
console.log('testing 123', document.currentScript);
// Rewrite all Bing links to DuckDuckGo instead
finicky.onUrl(function(url, opts) {
var url = url.replace(
/^https?:\/\/www\.bing\.com\/search/,
"https://duckduckgo.com"
);
return {
url: url
};
});
alert();
FROM node:5.2.0
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
ONBUILD COPY package.json /usr/src/app/
ONBUILD COPY .npmrc /usr/src/app/
ONBUILD RUN npm install
ONBUILD COPY . /usr/src/app
<?xml version="1.0"?>
<root>
<item>
<name>Remap Caps Lock to Hyper</name>
<appendix>OS X doesn't have a Hyper. This maps caps lock (actually F19) to Control + Shift + Option + Command.</appendix>
<identifier>caps_lock_to_hyper</identifier>
<autogen>
--KeyToKey--
local utils = require 'utils'
hs.hotkey.bind(utils.hyper, "Left", utils.getScreen(function(win, frame, screen, screenFrame)
local margin = 10
local myFrame = hs.fnutils.copy(frame)
myFrame.x = screenFrame.x + margin
myFrame.y = screenFrame.y + margin
myFrame.w = screenFrame.w/2 - margin*2
myFrame.h = screenFrame.h - margin*2
if utils.rectEquals(myFrame, frame) then
var keydown = function(k) {
var oEvent = document.createEvent('KeyboardEvent');
// Chromium Hack
Object.defineProperty(oEvent, 'keyCode', {
get : function() {
return this.keyCodeVal;
}
});