This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Colorize helper. | |
| */ | |
| class Colorize | |
| { | |
| /** | |
| * RGB array for a color. | |
| * |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Override Localstorage and Sessionstorage setItem prototype | |
| */ | |
| Storage.prototype._setItem = Storage.prototype.setItem; | |
| Storage.prototype.setItem = function(key, value) | |
| { | |
| const isQuotaExceededError = (err: unknown) => err instanceof DOMException && | |
| ( | |
| // Legacy Webkit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| DELIMITER $$ | |
| CREATE DEFINER = CURRENT_USER FUNCTION `uuidv7` () RETURNS UUID LANGUAGE SQL NOT DETERMINISTIC NO SQL SQL SECURITY DEFINER | |
| COMMENT 'Generate a UUID7 according to https://www.ietf.org/archive/id/draft-peabody-dispatch-new-uuid-format-04.html#variant_and_version_fields' | |
| BEGIN | |
| -- Obtain date with 4 milliseconds precision | |
| SET @now = sysdate(4); | |
| /* | |
| UNIX_TIMESTAMP returns a 32bits number, so this function will not work after the Epochalypse, I am crossing my fingers and I hope that MySQL/MariaDB teams will move to 64bits timestamps before than 2038. | |
| */ | |
| SET @time_sec = LPAD(HEX(TRUNCATE(UNIX_TIMESTAMP(@now), 0)), 9, '0'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| use Ramsey\Uuid\Uuid; | |
| $date = now()->parse("2024-01-01 00:00:00"); | |
| while ($date->year < 2039) { | |
| $dateProcess = (clone $date) | |
| ->endOfMonth() | |
| ->hour(23) | |
| ->minute(59) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Extract all JSON objects (doens't work with JSON arrays) from a string. | |
| * | |
| * This method is the alternative to '/\{(?:[^{}]|(?R))*}/m' regular expression but faster | |
| * according to https://3v4l.org/4WtGX VS https://3v4l.org/N9oRi | |
| * | |
| */ | |
| function jsonExtract(string $str) : array | |
| { | |
| $numBrackets = $initStr = $foundAt = -1; |
OlderNewer