Skip to content

Instantly share code, notes, and snippets.

View ArrayIterator's full-sized avatar

ArrayIterator ArrayIterator

View GitHub Profile
@ArrayIterator
ArrayIterator / Math.php
Last active August 19, 2026 06:42
PHP Arithmetic BigInteger Support For Backward Compatibility
<?php
declare(strict_types=1);
use DivisionByZeroError;
use InvalidArgumentException;
use OverflowException;
use function chr;
use function explode;
use function function_exists;
use function intdiv;
@ArrayIterator
ArrayIterator / Time.php
Last active August 17, 2026 10:40
PHP Better Precise Time Unit than microtime()
<?php
declare(strict_types=1);
use function hrtime;
use function intdiv;
use function microtime;
/**
* Time helper class to get the current time in milliseconds, microseconds, and nanoseconds
* Use boot time to get the time since the application booted and more precise time than microtime
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ArrayIterator
ArrayIterator / dailytech.svg
Created April 24, 2026 08:39
dailytech.id .svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ArrayIterator
ArrayIterator / SchemaToolListener.php
Last active March 24, 2026 11:14
Dotrine (MySQL) SchemaToool Resolver (Support Custom Relation Name & Invalid Default 'NULL' detected as string - Timestamp Object vs Default current_timestamp())
<?php
declare(strict_types=1);
namespace App\EventListener;
use Doctrine\Bundle\DoctrineBundle\Attribute\AsDoctrineListener;
use Doctrine\DBAL\Platforms\AbstractMySQLPlatform;
use Doctrine\DBAL\Schema\AbstractSchemaManager;
use Doctrine\DBAL\Schema\Column;
use Doctrine\DBAL\Schema\ComparatorConfig;
@ArrayIterator
ArrayIterator / SessionPayload.php
Last active August 8, 2026 08:22
Stateless Session Cookie Implementation - Secure & Fast By Design!! User Id (int/bigint) based signing & validation!
<?php
declare(strict_types=1);
class SessionPayload {
public function __construct(
public string $token,
public int $userId,
public int $timestamp,
public int $expiredAt,
public string $random16 // binary string
@ArrayIterator
ArrayIterator / language_codes_by_country.json
Created January 24, 2026 10:51
Language code list & direction by Country Code (2 Chars)
{
"BD": {
"code": "BN",
"locale": "bn_BD",
"english": "Bengali",
"original": "বাংলা",
"dir": "ltr"
},
"BE": {
"code": "NL",
/**
* REAL HMAC HASHING FUNCTION:
* Relies on the globally loaded CryptoJS library being available.
* Or use another hmacsha256
*/
const hmacSha256 = (data, key) => {
if (typeof CryptoJS === "undefined") {
// If CryptoJS is missing in CodePen setup
return "ERROR_CRYPTOJS_NOT_READY_".repeat(2).substring(0, HMAC_LENGTH);
}
type UppercaseAlphabet =
'A'
| 'B'
| 'C'
| 'D'
| 'E'
| 'F'
| 'G'
| 'H'
| 'I'
@ArrayIterator
ArrayIterator / Communicator.java
Created June 9, 2025 08:42
Thread Based Asynchronous One-Way Communication pattern fallback
package my.unit.utils;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Parcelable;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;