Skip to content

Instantly share code, notes, and snippets.

View motionharvest's full-sized avatar

Aaron motionharvest

View GitHub Profile
@motionharvest
motionharvest / cgms-onload-ideal-state.js
Created January 2, 2026 21:59
If a user is on a course/view page and is viewing it for the first time, arrange the UI to the ideal state
if (window.location.href.includes('course/view.php')) {
const courseKey = `${window.location.pathname}${window.location.search}`;
const lsKey = `courseViewAutoClicks::${courseKey}`;
if (!localStorage.getItem(lsKey)) {
const clickIfExists = (selector) => {
const el = document.querySelector(selector);
if (el) el.click();
return !!el;
};
@motionharvest
motionharvest / ai_call.ps1
Created December 30, 2025 13:15
powershell script that calls the OpenAI endpoint for use with ai_insert.ahk. Requires OPENAI_API_KEY in Environment Variables.
param(
[Parameter(Mandatory=$true)][string]$Prompt,
[string]$Selection = "",
[string]$OutFile = ""
)
$log = Join-Path $PSScriptRoot "ai_call.log"
function Log($msg) {
@motionharvest
motionharvest / ai_insert.ahk
Created December 30, 2025 13:12
Capslock + Space autohotkey script for carrot insert AI answer
#Requires AutoHotkey v2.0
#SingleInstance Force
CapsLock::return
CapsLock & Space::
{
prompt := AskPalette()
if (prompt = "")
return
/* Pragmatic.js (standalone UMD) */
/* eslint-disable no-unused-vars, no-undef */
(function (global) {
'use strict';
// =========================
// Utilities + Globals
// =========================
const Fragment = Symbol("Fragment");
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@motionharvest
motionharvest / daysuntil.notion
Last active July 1, 2021 22:49
Days Until Formula for Notion
empty(prop("Due Date")) ? "" : ((dateBetween(prop("Due Date"), now(), "hours") < 0) ? ((dateBetween(prop("Due Date"), now(), "hours") > -24) ? "Today" : ((abs(floor(dateBetween(prop("Due Date"), now(), "hours") / 24) + 1) == 1) ? "Yesterday" : (format(abs(floor(dateBetween(prop("Due Date"), now(), "hours") / 24) + 1)) + " Days ago"))) : ((dateBetween(prop("Due Date"), now(), "hours") < 24) ? "Tomorrow" : (format(abs(floor(dateBetween(prop("Due Date"), now(), "hours") / 24) + 1)) + " Days from now")))
@motionharvest
motionharvest / vs.js
Last active February 6, 2020 16:20
VectorScrolling rewrite for 2020. Only 350bytes Gzipped
/*
Copyright 2020 Aaron Sherrill
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
associated documentation files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge, publish, distribute,
sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/*
Globals are any collection of styles that are used in more than one place.
Use this file for colors, font stacks, and for
Partials use %global- to help developers guess where they are writen.
*/
.glyphicon.glyphicon-play, .columnStyle .statusIndicator.indicatorGreen, span#help1, .dropdown.accountInfoIcon .dropdown-toggle, .glyphicon.glyphicon-download-alt, #ConfirmPayment .rightArrowWhite, #PaymentConfirmReview .rightArrowWhite, #interestedInEarlyPay .rightArrowWhite, .glyphicon.glyphicon-alert, .glyphicon.glyphicon-ban-circle {
display: inline-block;
line-height: 1;
vertical-align: middle; }