Skip to content

Instantly share code, notes, and snippets.

@laughinghan
laughinghan / Every possible TypeScript type.md
Last active March 11, 2026 07:03
Diagram of every possible TypeScript type

Hasse diagram of every possible TypeScript type

  • any: magic, ill-behaved type that acts like a combination of never (the proper [bottom type]) and unknown (the proper [top type])
    • Anything except never is assignable to any, and any is assignable to anything at all.
    • Identities: any & AnyTypeExpression = any, any | AnyTypeExpression = any
    • Key TypeScript feature that allows for [gradual typing].
  • unknown: proper, well-behaved [top type]
    • Anything at all is assignable to unknown. unknown is only assignable to itself (unknown) and any.
    • Identities: unknown & AnyTypeExpression = AnyTypeExpression, unknown | AnyTypeExpression = unknown
  • Prefer over any whenever possible. Anywhere in well-typed code you're tempted to use any, you probably want unknown.
@mortymacs
mortymacs / send-read-message.md
Last active April 10, 2019 01:44
Send and Read Message in a Python Process Via stdin in GNU/Linux

To read message from stdin try this sample code:

import time
import sys

while True:
    for i in sys.stdin:
        print(i)
    time.sleep(2)
@oifland
oifland / Jenkinsfile
Last active July 15, 2024 06:36
Loops in Jenkinsfiles
// Related to https://issues.jenkins-ci.org/browse/JENKINS-26481
abcs = ['a', 'b', 'c']
node('master') {
stage('Test 1: loop of echo statements') {
echo_all(abcs)
}
stage('Test 2: loop of sh commands') {
@danidiaz
danidiaz / _FP reading lists.md
Last active January 15, 2026 20:31
assorted reading lists

A series of reading lists mostly related to functional programming.