Skip to content

Instantly share code, notes, and snippets.

View jonashw's full-sized avatar

Jon Wilson jonashw

  • Yolo County, California
View GitHub Profile
(function() {
/* Grabs the images for all OVERDUE materials on the WPL "Checked Out" page,
** assembles them in a new page, and invokes the system print dialog.
** Run from https://woodland.aspendiscovery.org/MyAccount/CheckedOut
*/
'use strict';
printImages(Array.from(document.querySelectorAll('.striped > div.result.bg-overdue img')));
function printImages(imgElements) {
const w = window.open('', '_blank');
@jonashw
jonashw / Bookmarklet-Maker.js
Last active June 11, 2026 23:04
Bookmarklet Maker
// ==UserScript==
// @name Bookmarklet Maker
// @namespace http://tampermonkey.net/
// @version 2026-06-11
// @description A lean and mean JavaScript-only SPA that facilitates the creation of bookmarklets from JavaScript code. Inspiration: https://caiorss.github.io/bookmarklet-maker/. Fun fact! You can package this tool *as a bookmarklet* using the tool itself ;)
// @author Jon Wilson <2jonwilson@gmail.com>
// @source https://gist.github.com/jonashw/83be75a1cd63537259070a430395d486
// @match https://*/*
// @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant none
@jonashw
jonashw / gist:e503e6558c4504219bf8bbaf4502adc6
Last active June 11, 2026 20:14
Tamper Monkey script: Print Cover Images of Overdue Materials
// ==UserScript==
// @name Print Cover Images of Overdue Materials
// @namespace http://tampermonkey.net/
// @version 2026-06-11
// @description Grabs the images for all OVERDUE materials on the WPL "Checked Out" page, assembles them in a new page, and invokes the system print dialog.
// @author You
// @match https://woodland.aspendiscovery.org/MyAccount/CheckedOut
// @icon https://www.google.com/s2/favicons?sz=64&domain=aspendiscovery.org
// @grant none
// @source https://gist.github.com/jonashw/e503e6558c4504219bf8bbaf4502adc6
@jonashw
jonashw / gist:d314c2b1dd0e08948bb588245344a4ef
Last active June 8, 2026 22:17
Browser Network Observer
// ==UserScript==
// @name BrowserNetworkObserver
// @description Captures all fetch/XHR traffic via callback and Observable interfaces.
// @match *://*/*
// @run-at document-start
// @grant none
// @source https://gist.githubusercontent.com/jonashw/d314c2b1dd0e08948bb588245344a4ef
// @version 2026-06-08
// ==/UserScript==
// Specification: https://gist.github.com/jonashw/df8c914c706a50ce1a73e86740bd210c

ADR: NetworkObserver Injection Method

Context

We need to inject NetworkObserver into the browser before any page scripts execute so that all fetch/XHR traffic is captured from page load.

Decision

Tampermonkey userscript for immediate use; custom Chrome extension as a future option if more control is needed.

@jonashw
jonashw / Sample Sum Type
Last active June 20, 2016 18:24
This is typically how I implement a sum type in C# for day-to-day use. At the bottom is the code I wish I could write instead.
//So much boilerplate!
public abstract class UserAccountCreationResult
{
private UserAccountCreationResult() { }
public UserAccountCreationResult AsBaseType() => this;
//Emulate pattern matching
public abstract T Match<T>(
Func<Success, T> success,
Func<WeakPassword, T> weakPassword,
SELECT
p.ProjectID,
p.FourHTitle,
rt.RecordTypeID,
rt.RecordTypeName,
rt.RecordTypeDescription,
( SELECT COUNT(1)
FROM c_RecordTypeConfiguration
WHERE OrganizationID = 25
AND RecordTypeID = rt.RecordTypeID
function extend(destination, source) {
for (var k in source) {
if (source.hasOwnProperty(k)) {
destination[k] = source[k];
}
}
return destination;
}
function getFileServicesHost() {
let mapleader=","
"enable pathogen
filetype off
call pathogen#runtime_append_all_bundles()
call pathogen#helptags()
"git status on statusline
set statusline=%t
set statusline+=%m
set statusline+=\ %{fugitive#statusline()}