Skip to content

Instantly share code, notes, and snippets.

View ArrayIterator's full-sized avatar

ArrayIterator ArrayIterator

View GitHub Profile
@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 March 19, 2026 01:53
Stateless Session Implementation
<?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;
import java.util.Map;
import java.util.Set;
/**
* Represents a cipher suite in SSL/TLS.
* A cipher suite is a combination of cryptographic algorithms used to secure the communication.
* This class aims to provide a comprehensive (though not exhaustive) list of standard
* cipher suites and their support across different SSL/TLS protocol versions.
*/
public class CipherSuite {
@ArrayIterator
ArrayIterator / SlideCaptcha.tsx
Last active April 25, 2025 18:15
React + Tailwind -> Puzle Captcha Image - Based on Sliding Verification & Tolerance
import React, { ReactNode, useEffect, useRef, useState } from 'react';
export type PlacementResultProperties = {
valid: boolean;
tolerance: number;
puzzle: {
x: number;
y: number;
},
piece: {
@ArrayIterator
ArrayIterator / Adsense.tsx
Last active February 24, 2025 03:26
Google Adsense Implementation for non GPT (Google Publisher Tag)
import React, {createRef, useEffect, useState} from 'react';
import {CSSProperties, ReactNode} from 'react';
import AdsenseJS from './AdsenseJS';
declare var window: Window&{
adsbygoogle: any[],
};
const IS_SSR = typeof window !== 'object' || !window || typeof window.document !== 'object';
export function Adsense(props: {
@ArrayIterator
ArrayIterator / OATH.js
Last active December 27, 2024 16:47
OATH - HOTP (HMAC-based One-time Password Algorithm) - TOTP (Time-based One-time Password Algorithm)
/**
* OATH - HOTP (HMAC-based One-time Password Algorithm)
*
* @author ArrayIterator
* @link https://tools.ietf.org/html/rfc4226
* @link https://en.wikipedia.org/wiki/HMAC-based_One-time_Password_Algorithm
*/
class HOTP {
/**