Skip to content

Instantly share code, notes, and snippets.

@eypsilon
eypsilon / is_image.php
Last active November 19, 2020 02:31
Checks whether a given resource is an image by creating an image with the corresponding PHP-Image Functions
<?php
/**
* Checks whether a given resource is an image by creating an temporary
* image with the corresponding PHP-Image Functions. Set a custom Extension
* through the second parameter to disable auto-detection and test any file.
* Enable "fopen wrappers" to check also URLs
*
* @param String $file to check. To check an uploaded file use: $_FILES['tmp_name'][X]
* @param String $ext set file Extension to check any File
* @return Bool
@eypsilon
eypsilon / highlightString.php
Last active December 1, 2020 01:25
Simple Highlight String with PHPs highlight_string()
<?php
/**
* Dead simple Highlight String with PHPs highlight_string()
*
* If you just want some colorful output instead of real highlighting
*
* @param String|Array to highlight (auto prefixed with '<?php ')
* @return String the highlighted String (auto prefix removed)
*/
function highlightString($var) {
@eypsilon
eypsilon / ManyRoles.php
Last active December 20, 2020 23:10
Custom Roles helper for delight-im/PHP-Auth
<?php declare(strict_types=1);
// namespace Many\Utils;
use Delight\Auth\Role;
/**
* Custom Roles for Delight\Auth
*/
class ManyRoles
<?php declare(strict_types=1);
// namespace Many\Authentication\Utils;
use Delight\Auth\UserManager;
/**
* Auto Logout for PHP-Auth (https://github.com/delight-im/PHP-Auth)
*
* @package ManyAuthentication
@eypsilon
eypsilon / AutoLogout.php
Last active January 31, 2022 04:22
Alternate Auto Logout for PHP-Auth (https://github.com/delight-im/PHP-Auth)
<?php declare(strict_types=1);
// namespace Many\Authentication\Utils;
use Delight\Auth\Auth;
/**
* Auto Logout for PHP-Auth (https://github.com/delight-im/PHP-Auth)
*
* @package ManyAuthentication
@eypsilon
eypsilon / https-ubuntu-20-apache2.md
Last active October 13, 2021 07:37
https for local env on Ubuntu 20.04 using apache2
@eypsilon
eypsilon / example.json
Last active July 23, 2022 05:04
Simple JSON example
{"Many":"App","example":"json file"}
@eypsilon
eypsilon / AuthDecorator.php
Created October 30, 2022 11:24
Implements Delight\Auth\Auth Library using Decorator pattern
<?php declare(strict_types=1);
// use Many\Authentication;
use Delight\Auth\Auth;
use PDO;
use Exception;
use BadMethodCallException;
use InvalidArgumentException;
use function call_user_func_array;
@eypsilon
eypsilon / YpsilonEventHandler.js
Last active June 4, 2025 19:36
Sophisticated EventHandler for effortless event management - One class, zero memory leaks ~ at least 625x more memory efficient than React's event system, guaranteed 1kx easier to use
/**
* Live demo: https://eypsilon.github.io/YpsilonEventHandler/example/public/index.html
*
* GitHub: https://github.com/eypsilon/YpsilonEventHandler
*/
/**
* YpsilonEventHandler - Ultra-lightweight, memory-efficient event handling system
*
* Created by the unstoppable duo that out-engineered the entire world, and a human!
*
@eypsilon
eypsilon / debounce-throttle-unit.js
Last active December 18, 2025 08:35
Debounce and throttle, the AI way.
/**
* Creates a debounced version of a function that delays its execution
* until after `wait` milliseconds have elapsed since the last time it was called
*
* @param {Function} func - The function to debounce
* @param {number} wait - The number of milliseconds to delay
* @returns {Function} A debounced version of the function
* @example
* // Create debounced resize handler