Skip to content

Instantly share code, notes, and snippets.

View zackradisic's full-sized avatar

Zack Radisic zackradisic

View GitHub Profile
@qdm12
qdm12 / main.go
Last active February 12, 2024 01:17
DNS over HTTPS server resolver under 300 lines of clean Go code
package main
import (
"bytes"
"context"
"crypto/tls"
"errors"
"fmt"
"io/ioutil"
"log"
@rbuckton
rbuckton / ts-proposal-range-types.md
Last active June 20, 2024 05:26
Proposal: Range Types for TypeScript

Range Types (T[X:Y]) for TypeScript

A Range Type is a type that produces a new tuple or array type that derives from T by dropping the excess ordered elements of T outside of the range starting at offset X (inclusive) through offset Y (exclusive).

A Range Type is denoted using a : operator in what would otherwise be an Indexed Access Type:

type T = [1, 2, 3][0:2];