Skip to content

Instantly share code, notes, and snippets.

View enricopolanski's full-sized avatar

Enrico Polanski enricopolanski

View GitHub Profile
@nat-418
nat-418 / why-tcl.md
Last active April 1, 2024 03:23
Why Tcl?

Why Tcl?

Introduction

I use [Tcl] as my scripting language of choice, and recently someone asked me why. This article is an attempt to answer that question.

Ousterhout's dichotomy claims that there are two general categories of programming languages:

@Mecanik
Mecanik / Utils.ts
Last active March 26, 2024 16:10
Send or Delete bulk data to Cloudflare Workers KV (TypeScript)
export default class Utils {
/**
* Delete items in bulk from Cloudflare KV Storage
* This assumes you have defined your ENV_ variables using wrangler secrets
* @param {namespace} The namespace binding you defined for your script
*/
static async deleteInBulk(namespace): Promise<Boolean> {
const delete_endpoint =
"https://api.cloudflare.com/client/v4/accounts/" +
EN_ACC_ID +
@przemkow
przemkow / jest.config.js
Last active July 29, 2021 10:52
Jest transform svg with vue-jest@4
modules.export = {
...,
transform: {
".*\\.(svg)$": "<rootDir>/svg-transform.js",
},
}
@graninas
graninas / On_hiring_haskellers.md
Last active March 25, 2023 16:49
On hiring Haskellers

On hiring Haskellers

Recently I noticed the number of the same two questions being asked again and again on different Haskell resources. The questions were “How to get a Haskell job” and “Why is it so hard to find Haskellers?” Although these two are coming from the opposite sides of the hiring process, the answer is really just one. There is a single reason, a single core problem that causes difficulties of hiring and being hired in the Haskell community, and we should clearly articulate this problem if we want to increase the Haskell adoption.

We all know that there are many people wishing to get a Haskell job. And a visible increase of Haskell jobs looks like there should be a high demand for Haskellers. The Haskell community has also grown like crazy past years. But still, why is it so difficult to hire and to be hired? Why can’t companies just hire any single person who demonstrates a deep knowledge of Haskell in blog posts, in chats, on forums, and in talks? And why do Haskell companies avoid hirin

@nth-commit
nth-commit / VariadicPipe.ts
Last active September 29, 2022 21:47
Function composition in TypeScript 4.1 (on top of ixjs's pipe)
import { OperatorFunction } from 'ix/interfaces';
import { pipe } from 'ix/iterable';
import { map } from 'ix/iterable/operators';
/**
* Creates a new type which is the first element of a non-empty tuple type.
*
* @example type T = Head<[string, number, Object]>; // string
*/
export type Head<Ts extends [any, ...any[]]> = Ts extends [infer T, ...any[]] ? T : never;
@kasperpeulen
kasperpeulen / monad-laws.ts
Last active November 18, 2020 11:08
Monad laws for promise
test('left identity', async () => {
async function f(x: number) {
return 2 * x;
}
function g(x: number) {
return f(x).then(y => Promise.resolve(y));
}
const x = 2;
expect(await f(x)).toEqual(await g(x));
})
@sivinnguyen
sivinnguyen / wsl2_200915_fix_dns_resolution.md
Last active April 12, 2024 07:30
Fix DNS resolution in WSL2

Error

$ sudo apt-get update
Err:1 http://archive.ubuntu.com/ubuntu focal InRelease
Temporary failure in name rerolution

$ host google.com
;; connection timed out; no servers could be reached
@domenkozar
domenkozar / README.md
Created June 23, 2020 08:18
Haskell + GitHub Actions + Cachix
@masaeedu
masaeedu / catspan.md
Last active June 9, 2020 16:19
Categories are just monads in the bicategory of spans, what's the problem?

Let's imagine how a given category is a monad in a bicategory of spans.

Consider the set of all the objects in the category C0 and the set of all the morphisms in the category C1 (they're all muddled together in this set). We have two functions domain : C1 -> C0 and codomain : C1 -> C0 which assign to each morphism its source and target object.

This pair of functions forms a "span" of sets, which is a diagram of this shape:

       C_1
      ╱   ╲
   dom     cod

╱ ╲

@laughinghan
laughinghan / Every possible TypeScript type.md
Last active March 31, 2024 04:40
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.