This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { useCallback, Reducer, Dispatch, useState, useMemo, useEffect, useRef } from 'react'; | |
| type Batch<S, A extends object> = { | |
| state: S, | |
| actions: A[], | |
| next: Batch<S, A> | null | |
| } | |
| class StreamReducer<S, A extends object> { | |
| /** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| mkdir -p dev.mongodb/{0,1,2}; rm -f dev.mongodb/{0,1,2}/log.*; | |
| ( | |
| for i in {1..100}; do | |
| socat -u OPEN:/dev/null UNIX-CONNECT:./dev.mongodb/0/.sock 2>/dev/null && break; | |
| sleep 0.1; | |
| done; | |
| exec mongosh 'mongodb://.%2Fdev.mongodb%2F0%2F.sock' --eval "$(cat << EOF | |
| const reinitiate = (() => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env -S nginx -e /dev/stderr -p . -c | |
| # Run an NGINX instance serving the current directory on ports 8080 and 8443 | |
| # (when configured). Execute one of the following commands in the terminal. | |
| # - start-nodaemon: ./nginx.conf -g 'daemon off;' | |
| # - start: ./nginx.conf | |
| # - stop: ./nginx.conf -s stop | |
| # - reload: ./nginx.conf -s reload | |
| pid .nginx/nginx.pid; | |
| events {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const Benchmark = require('benchmark'); | |
| const suite = new Benchmark.Suite; | |
| class Base { | |
| type = "base" | |
| } | |
| class Child extends Base { | |
| type = "child" | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #define _GNU_SOURCE | |
| #include <stdio.h> | |
| #include <sched.h> | |
| #include <fcntl.h> | |
| #include <unistd.h> | |
| #include <stdint.h> | |
| #include <inttypes.h> | |
| #include <stdlib.h> | |
| #include <string.h> | |
| #include <errno.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| type If = { | |
| kind: 'if' | |
| condition: Expression | |
| then: Expression | |
| else: Expression | |
| } | |
| type Literal = { | |
| kind: 'boolean' | |
| value: boolean |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function parseString(json: string, startIndex: number) { | |
| const Text = /[^\\"]+/y; | |
| const Escapes = /\\+/y; | |
| const Unicode = /[\dA-Fa-f]{4}/y; | |
| let result = ""; | |
| for(let textStart = Text.lastIndex = startIndex;;) { | |
| // Scan forward from the lastIndex until we encounter: | |
| // 1. closing quote | |
| // 3. end-of-string |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function Multi<Left extends new (...args: any[]) => object, Right extends new (...args: any[]) => object, Largs extends any[], Rargs extends any[], Linst extends object, Rinst extends object>(Left: Left & (new (...args: Largs) => Linst), Right: Right & (new (...args: Rargs) => Rinst)): { | |
| new (largs: Largs, rargs: Rargs): Linst & Rinst | |
| } & { [P in keyof Left]: Left[P] } & { [P in keyof Right]: Right[P] } { | |
| let proxy; | |
| class Multi extends (Left as any) { | |
| #bastard: Rinst; | |
| constructor(largs: Largs, rargs: Rargs) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { IsoBench } from "iso-bench"; | |
| function* createIterable(count) { | |
| for (let i = 0; i < count; i++) { | |
| yield i; | |
| } | |
| } | |
| declare var i: number; | |
| globalThis.i = 0; |