This file contains 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 | |
/** | |
* @property-read int $length | |
*/ | |
class BetterStr{ | |
protected string $value = ""; | |
public function get_value(){ | |
return $this->value; | |
} |
This file contains 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
import fs from "fs"; | |
/** | |
* @param {Array<T>} arr | |
* @param {number} index | |
* @returns {Array<T>} | |
* @template T | |
*/ | |
function RemoveIndexOfArray(arr, index){ | |
const copyOfArray = [... arr]; |
This file contains 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 | |
namespace App\Http\Middleware; | |
use Illuminate\Http\Request; | |
use Inertia\Middleware; | |
class HandleInertiaRequests extends Middleware | |
{ | |
/** |
This file contains 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
export type Func<P extends Array<unknown>, R> = (...args: P) => R; | |
interface JSTypes{ | |
string: string | |
number: number | |
bigint: bigint | |
boolean: boolean | |
symbol: symbol | |
undefined: undefined | |
object: object |
This file contains 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
fn modadd(a: u64, b: u64, module: u64) -> u64{ | |
if a >= module{ | |
return a%module; | |
}else if b >= module{ | |
return b%module; | |
} | |
if a > module - b{ | |
return a - (module - b); | |
}else if b > module - a { | |
return b - (module - a); |
This file contains 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
enum EType { | |
Some, | |
None, | |
} | |
export class Option<T> { | |
private value!: T; | |
private type: EType; | |
private constructor(type: EType) { |