Skip to content

Instantly share code, notes, and snippets.

View daemondevin's full-sized avatar

daemon.devin daemondevin

View GitHub Profile
@daemondevin
daemondevin / Physics2DPlugin.js
Created March 13, 2026 04:30
Custom Physics2DPlugin implementation providing 2D physics simulation for GSAP
/**
* Custom Physics2DPlugin for GSAP
* A from-scratch implementation providing 2D physics simulation
* (velocity, angle, acceleration, gravity, friction)
*
* Compatible with GSAP 3.x plugin API
* Usage: gsap.registerPlugin(Physics2DPlugin)
*/
const Physics2DPlugin = {
@daemondevin
daemondevin / Gravatar.php
Created March 9, 2026 02:22
Gravatar API Client—A clean, zero-dependency PHP class for working with the Gravatar API.
<?php
declare(strict_types=1);
/**
* Gravatar API Client
*
* Handles avatar image URLs, profile data fetching, and QR code URLs
* for Gravatar (gravatar.com) using both the public image API
* and the authenticated REST API (Gravatar API v3).
@daemondevin
daemondevin / README.md
Last active March 7, 2026 10:46
PHP CLI text find/replace with support for regex, case sensitivity, recursion, and dry-run preview.

replaceText.php

A PHP CLI utility for finding and replacing text across files in a directory. Supports plain and regex-based replacements, case-insensitive matching, recursive directory scanning, extension filtering, and a dry-run preview mode.


Requirements

  • PHP 7.1+
@daemondevin
daemondevin / replaceFilename.php
Created March 7, 2026 10:06
PHP CLI filename renamer with wildcard capture
<?php
/**
* CLI filename renamer with wildcard capture
*
* Example:
* php replaceFilename.php --find=frontendadmin.*.php --replace=ts*.snippet.php --regex=*
*/
$options = getopt("", [
@daemondevin
daemondevin / Autoloader.php
Created February 21, 2026 02:54
A PSR-4 compliant autoloader with performance tracking, singleton support, and statistics for PHP 7.4+
<?php
/**
* Autoloader
*
* PSR-4 compliant autoloader with recursive directory scanning
* and intelligent class file discovery
*
* @package Themantic
* @version 2.0.0
@daemondevin
daemondevin / replace.php
Last active February 20, 2026 22:15
Command line utility that will recursively scan a directory and does a full namespace-aware/class-name-only replacement (AST-safe replacement using token parsing).
<?php
if (php_sapi_name() !== 'cli') {
exit("Run from CLI only.\n");
}
function is_true($val, $return_null=false){
$boolval = ( is_string($val) ? filter_var($val, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE) : (bool) $val );
return ( $boolval===null && !$return_null ? false : $boolval );
}
;=#
;
; NSIS Associations Handler
; Provides functions for managing file types, protocols, and context menus
; by daemon.devin (daemon.devin@gmail.com)
;
; AVAILABLE FILETYPE MACROS
; ${GetFileTypeProgID}
; ${CheckFileTypeExists}
; ${GetFileTypeInfo}
@daemondevin
daemondevin / ActiveXObject.polyfill.js
Created November 23, 2025 02:30
ActiveXObject Polyfill
/**
* ActiveXObject Polyfill
* Provides fallback implementations for common ActiveX objects
* Note: This only works for specific objects and has limited functionality
*/
(function() {
'use strict';
// Skip if ActiveXObject already exists (IE)
@daemondevin
daemondevin / RuntimeManager.nsh
Last active November 8, 2025 05:35
NSIS Include that manages VC++ (2005-2022) and .NET (Framework/Core) redistributables. Supports x86, x64, and ARM64 architectures.
; RuntimeManager.nsh - Complete Runtime Detection, Download, and Installation
; Manages VC++ (2005-2022) and .NET (Framework/Core) redistributables
; Supports x86, x64, and ARM64 architectures
!ifndef RUNTIME_MANAGER_NSH
!define RUNTIME_MANAGER_NSH
!ifndef LOGICLIB
!include LogicLib.nsh
!endif
@daemondevin
daemondevin / ModernWinVer.nsh
Created November 3, 2025 08:11
Modern Windows Version Detection Optimized for Windows 10, 11, and current Server versions
; ModernWinVer.nsh - Modern Windows Version Detection
; Optimized for Windows 10, 11, and current Server versions
; Extends and modernizes the standard WinVer.nsh
!ifndef MODERN_WINVER_NSH
!define MODERN_WINVER_NSH
!include LogicLib.nsh
; Windows Version Constants (Major.Minor.Build)