Skip to content

Instantly share code, notes, and snippets.

View blizzardengle's full-sized avatar

Christopher Keers blizzardengle

View GitHub Profile
@blizzardengle
blizzardengle / dom-watcher.js
Last active November 10, 2025 16:26
A single place to watch for DOM elements. an alternative to using DOMContentLoaded or individual mutation observers all over the place.
/**
* @class DOMWatcher
* Observes the DOM for elements matching CSS selectors
*
* Monitors the DOM tree for elements that match specified selectors, triggering
* callbacks when matching elements are added. Handles both immediate detection
* of existing elements and observation of future additions.
*
* @example
* // Create a watcher instance
@blizzardengle
blizzardengle / encrypt_zips.ps1
Created November 7, 2025 17:48
PowerShell script to batch password-protect solution ZIP files using weak but compatible encryption as a basic student deterrent.
# Password-protect all ZIP files in current directory
# Password format: BasePassword + first digit found in filename
$basePassword = "PLACEHOLDER"
$sevenZipPath = "C:\Program Files\7-Zip\7z.exe"
# Verify 7-Zip is installed
if (-not (Test-Path $sevenZipPath)) {
Write-Host "ERROR: 7-Zip not found at $sevenZipPath" -ForegroundColor Red
Write-Host "Please install 7-Zip or update the path in the script"
@blizzardengle
blizzardengle / nearest.js
Created November 17, 2025 18:12
Finds the nearest element matching the querySelector based on DOM traversal distance.
/**
* Finds the nearest element matching the querySelector based on DOM traversal distance.
* Can be added to Element.prototype for convenient use like Element.closest()
*
* @example
* // Standalone usage
* const result = nearest(element, '.target');
*
* @example
* // Add to prototype (optional)
@blizzardengle
blizzardengle / sam.combined.css.js
Created December 19, 2025 07:28
A span-aware masonry-style grid layout, a polyfill of the CSS masonry spec with my alterations.
/**
* SpanAwareMasonry (SAM) - A span-aware masonry-style grid layout system
*
* @class SpanAwareMasonry
* @description
* Creates a packed grid layout that combines CSS Grid auto-placement with masonry-style
* vertical stacking. Unlike native CSS Masonry (grid-template-rows: masonry), SAM maintains
* left-to-right sequential placement while optimizing vertical space usage.
*
* @features