Skip to content

Instantly share code, notes, and snippets.

View StreetStrider's full-sized avatar

Strider StreetStrider

  • Rostov-on-Don
  • 21:31 (UTC +03:00)
View GitHub Profile
// ISC © 2023, Strider.
/* eslint-disable complexity */
const values = Object.values
import { useEffect, useRef } from 'react'
import { useParams } from 'react-router-dom'
import { useLocation } from 'react-router-dom'
import { useNavigate } from 'react-router-dom'
[buildPlans.IosevkaCustom]
family = "Iosevka Custom"
spacing = "term"
serifs = "sans"
noCvSs = true
exportGlyphNames = false
[buildPlans.IosevkaCustom.variants.design]
capital-i = "short-serifed"
capital-j = "serifed-symmetric"
@StreetStrider
StreetStrider / opaque.ts
Last active January 18, 2021 12:16
opaque type
type Brand <T> = T & { readonly type: unique symbol }
// type Foo = Brand<number>
type Foo = number & { readonly type: unique symbol }
type Bar = number & { readonly type: unique symbol }
function Foo (n: number): Foo
{
return (n as Foo)
@StreetStrider
StreetStrider / compress.js
Created October 23, 2020 21:58
compress-decompress
var log = console.log
var input = 'LLLAABBBBBEE'
log(input)
var c = compress(input)
log(c)
var d = decompress(c)
function Ensure (check, action)
{
return function ensurer (data)
{
return capture(() => check(data))
.then(so =>
{
if (! so)
{
if (! action)
#!/usr/bin/env node
var
exec = require('child_process').exec,
path = require('path');
var
is_reverse = ~ process.argv.indexOf('reverse');
sync = require('./sync.list'),
LEFT_PREFIX = '~',
var isArray = Array.isArray;
module.exports = function strip (ast)
{
ast = ast.filter(filterOnlyLeaves(like));
ast = ast.map(mapOnlyBranches(strip));
return ast;
}
@StreetStrider
StreetStrider / locale.js
Created October 30, 2014 15:33
locale object
function Locale ()
{
var locale = Object.create(Locale.prototype);
locale.ns = {};
return locale;
}
@StreetStrider
StreetStrider / codes.c
Last active April 2, 2020 02:37
libuv error codes
XX( -1, UNKNOWN, "unknown error") \
XX( 0, OK, "success") \
XX( 1, EOF, "end of file") \
XX( 2, EADDRINFO, "getaddrinfo error") \
XX( 3, EACCES, "permission denied") \
XX( 4, EAGAIN, "resource temporarily unavailable") \
XX( 5, EADDRINUSE, "address already in use") \
XX( 6, EADDRNOTAVAIL, "address not available") \
XX( 7, EAFNOSUPPORT, "address family not supported") \
XX( 8, EALREADY, "connection already in progress") \
#lang racket
(define (@filter fn L)
(foldl
(lambda (i A)
(if (fn i)
(append A (list i))
A
)
)