Skip to content

Instantly share code, notes, and snippets.

View jareha's full-sized avatar

Jonathan Horak jareha

  • Publicis Sapient
  • Chicago, IL
  • X @jareha
View GitHub Profile
@jareha
jareha / bookmarklet_macports.js
Created April 30, 2024 16:42
Bookmarklet to search ports on MacPorts
/* jshint esversion: 8 */
(function () {
const fallback = "https://ports.macports.org/";
const keyword = "%s";
const service = "https://ports.macports.org/search/";
const suffix = "&name=on";
if (keyword !== "" || keyword !== "%" + "s") {
window.location = `${service}?q=${keyword}${suffix}`;
} else {
@jareha
jareha / bookmarklet_greens-dictionary-of-slang.js
Last active April 15, 2024 01:47
Bookmarklet to show entries from Green’s Dictionary of Slang
/* jshint esversion: 8 */
(function () {
const fallback = null;
const keyword = "%s";
const service = "https://greensdictofslang.com/";
if (keyword !== "" || keyword !== "%" + "s") {
window.location = `${service}search/basic?q=${keyword}`;
} else {
window.location = fallback || service;
@jareha
jareha / bookmarklet_chicago-public-library_merlo-film-calendar.js
Created April 10, 2023 19:08
Bookmarklet to show film calendar for Merlo Branch of Chicago Public Library
/* jshint esversion: 8 */
(function () {
// Sweden (`sv`) outputs something close to ISO
const currentDate = new Date().toLocaleDateString("sv", {
timeZone: "America/Chicago",
});
const parameters =
"?locations=51&programs=5c9261756fdc8d742d2296a5" +
"&startDate" +
currentDate.split("T")[0].replace("T", "");
@jareha
jareha / bookmarklet_scrollbar-scofflaws.js
Created February 8, 2022 19:51
Bookmarklet to highlight DOM elements that cause horizontal scrollbars
/* jshint esversion: 8 */
(function (currentDocument) {
const treeWalker = currentDocument.createTreeWalker(currentDocument.body, NodeFilter.SHOW_ELEMENT);
const width = currentDocument.documentElement.offsetWidth;
while (treeWalker.nextNode()) {
const domRectangle = treeWalker.currentNode.getBoundingClientRect();
if (domRectangle.right > width || domRectangle.left < 0) {
const currentNode = treeWalker.currentNode;
@jareha
jareha / ds_store.sh
Last active February 8, 2022 16:38 — forked from vybstat/ds_store_removal
Remove `.ds_store` files created by macOS from local `git` repo
# Find and remove `.ds_store` files from local `git` repo
find . -name .ds_store -print0 | xargs -0 git rm -f --ignore-unmatch
@jareha
jareha / bookmarklet_passivator.js
Created January 26, 2022 21:36
Bookmarklet to highlight adverbs and passive verbs
/* jshint esversion: 8 */
(function () {
// List of verbs, for editing convenience
// am
// are
// be
// been
// being
// go
// hasn't
@jareha
jareha / bookmarklet_localhost-toggler.js
Last active September 19, 2022 03:18
Bookmarklet to toggle between `localhost` and production
/* jshint esversion: 8 */
(function () {
const domain = "https://example.com";
const isLocalhost = window.location.href.indexOf("localhost") >= 0;
const localhost = "http://localhost:8080";
const pathname = window.location.pathname;
const url = isLocalhost ? (domain + pathname) : (localhost + pathname);
window.location = url;
})();
@jareha
jareha / cookie-setter.js
Last active January 24, 2022 21:28
Cookie setter with defaults
@jareha
jareha / keyword-search.js
Last active April 30, 2024 16:36
Keyword search (bookmarklet) template with implementations
/* jshint esversion: 8 */
(function () {
const fallback = null;
const keyword = "%s";
const service = "https://www.example.com/";
const suffix = "";
if (keyword !== "" || keyword !== "%" + "s") {
window.location = `${service}?q=${keyword}${suffix}`;
} else {