Skip to content

Instantly share code, notes, and snippets.

View scambier's full-sized avatar

Simon Cambier scambier

View GitHub Profile
@scambier
scambier / waitForKeyElements.js
Created October 12, 2023 15:33 — forked from BrockA/waitForKeyElements.js
A utility function, for Greasemonkey scripts, that detects and handles AJAXed content.
/*--- waitForKeyElements(): A utility function, for Greasemonkey scripts,
that detects and handles AJAXed content.
Usage example:
waitForKeyElements (
"div.comments"
, commentCallbackFunction
);
@scambier
scambier / swept-aabb.lua
Last active July 9, 2022 08:56 — forked from tesselode/swept-aabb.lua
swept AABB collision detection implemented in Lua (commented)
--[[
moves rectangle A by (dx, dy) and checks for a collision
with rectangle B.
if no collision occurs, returns false.
if a collision does occur, returns:
- the time within the movement when the collision occurs (from 0-1)
- the x component of the normal vector
- the y component of the normal vector