Skip to content

Instantly share code, notes, and snippets.

View Remls's full-sized avatar
💀
beat

Adam Raaif Nasheed Remls

💀
beat
View GitHub Profile
@Remls
Remls / getFormErrrors.ts
Created January 25, 2023 09:27
Angular: Get form errors
getFormErrors(form: AbstractControl) {
if (form instanceof UntypedFormControl) {
// Return FormControl errors or null
return form.errors ?? null;
}
if (form instanceof UntypedFormGroup) {
const groupErrors = form.errors;
// Form group can contain errors itself, in that case add'em
const formErrors = groupErrors ? { groupErrors } : {};
Object.keys(form.controls).forEach(key => {
@Remls
Remls / keybindings.json
Last active January 5, 2023 06:45
VSCode keyboard shortcuts for missing characters on MacOS Dhivehi keyboard
[
// Dhivehi comma
{
"key": "alt+[Comma]",
"when": "isMac && inputFocus",
"command": "type",
"args": {
"text": "،"
}
},
@Remls
Remls / hijri_dates_mv.csv
Last active March 29, 2025 15:39
Days when Hjiri months started for Maldives. Dates prior to 1443H are incomplete and may contain mistakes.
gregorian_y gregorian_m gregorian_d hijri_y hijri_m
1983 2 14 1403 5
1989 11 30 1410 5
1990 7 23 1411 1
1991 2 14 1411 8
1991 5 16 1411 11
1995 6 29 1416 2
1995 7 29 1416 3
1997 3 10 1417 11
1999 8 12 1420 5
@Remls
Remls / ordinal.php
Created September 5, 2021 03:18
Get ordinal for a given positive integer (English)
<?php
function ordinal(int $i): string
{
// $numberFormatter = new \NumberFormatter('en_US', \NumberFormatter::ORDINAL);
// return $numberFormatter->format($i);
$asString = (string) ($i % 100);
$asString = str_pad($asString, 2, "0", STR_PAD_LEFT); // Pad zero
@Remls
Remls / _domains.json
Last active April 27, 2022 07:01
Domain rewards for Genshin Impact. Last updated for v2.7.
{
"domains": [
{
"name": "Cecilia Garden",
"location": "Wolvendom, Windwail Highland",
"region": "Mondstadt",
"type": "weapon_ascension_mats",
"rewards": {
"sun": ["w_tile", "w_tooth", "w_shackle"],
"mon": ["w_tile"],