Skip to content

Instantly share code, notes, and snippets.

View hinkelman's full-sized avatar

Travis Hinkelman hinkelman

View GitHub Profile
#lang racket
(require pict
rackunit)
; left and right are (or/c choice? team?)
; winner is (or/c #f team?)
(struct choice (left right winner) #:transparent)
(struct team (name strength) #:transparent)
@thisisnic
thisisnic / back_button_confirm.js
Last active December 17, 2022 12:11
Confirm "back" browser button click in Shiny
history.pushState(null, null, null);
window.addEventListener('popstate', function () {
const endProgress = confirm('This will end your session, are you sure you want to go back?');
if (endProgress) {
window.onpopstate = null;
history.back();
} else {