Skip to content

Instantly share code, notes, and snippets.

@akaia-shadowfox
akaia-shadowfox / bcp47-zod-schemas.ts
Created October 24, 2025 10:24
Zod schemas for bcp47 tag validation. Supports both tags and subtags.
import { isValid as isValidLanguageCode } from "@aleksejdix/ally-bcp47"
import { isError } from "remeda"
import { array, preprocess, string } from "zod"
/**
* All inline localization strings must be written in English.
* Do not change this type, as it enforces the rule.
*/
type SourceLocaleId = "en"
@akaia-shadowfox
akaia-shadowfox / link.rs
Created November 11, 2023 08:28
link.rs
@akaia-shadowfox
akaia-shadowfox / settings.json
Last active May 18, 2025 19:10
VSCode config snapshot
{
"$schema": "vscode://schemas/settings/folder",
"remote.SSH.useLocalServer": false,
"remote.SSH.remotePlatform": {
"akaia.local": "linux",
"akaia": "linux",
"jauv.local": "linux",
"jauv": "linux"
},
"editor.semanticHighlighting.enabled": true,
@akaia-shadowfox
akaia-shadowfox / validation-snippet.js
Last active September 2, 2022 16:55
effector-forms FP-way validation example
import { createForm } from "effector-forms"
import { __, assoc, pipe, prop } from "ramda"
import { toString } from "some-library"
import { toGas, toSomeAlienStructure } from "some-other-library-or-something"
import { isOk, isJustFine } from "some-validation-library"
/* Shared library code */
const logged = (value) => {
console.log(value)
return value
@akaia-shadowfox
akaia-shadowfox / did:3:kjzl6cwe1jw147bm53gh2sa5f0azm0e1r4pfvkystrc7lwdtyhus4urew247epv
Created August 31, 2022 02:35
did:3:kjzl6cwe1jw147bm53gh2sa5f0azm0e1r4pfvkystrc7lwdtyhus4urew247epv
did:3:kjzl6cwe1jw147bm53gh2sa5f0azm0e1r4pfvkystrc7lwdtyhus4urew247epv
module.exports = {
forbidden: [
{
name: "no-pages-on-pages",
severity: "warn",
comment: "Page MUST not depends on another page.",
from: { path: "^src/pages/([^/]+)/?.+", pathNot: "^src/pages/(routes|paths).ts" },
to: { path: "^src/pages/(?!$1)/?.+", pathNot: "^src/pages/(routes|paths).ts" },
},
{
@akaia-shadowfox
akaia-shadowfox / colorChanges.js
Created July 20, 2020 11:19
Playing with colors
import tinycolor from 'tinycolor2';
export const darken = (color, degree = 10) => {
if (0 <= degree && degree <= 100) {
return tinycolor(color)
.darken(degree)
.toString();
} else {
throw new RangeError('The color darken degree must be between 0 and 100.');
}
@akaia-shadowfox
akaia-shadowfox / npm
Created October 2, 2019 17:36
Access to "C:\Program Files\nodejs\npm" from WSL
#!/bin/sh
(set -o igncr) 2>/dev/null && set -o igncr; # cygwin encoding fix
basedir=`dirname "$0"`
case `uname` in
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
esac
NODE_EXE="$basedir/node.exe"