This file contains 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 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 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 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 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 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; |
This file contains 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 alias resolves to `True` if and only if `U` is the same as `V`, otherwise it resolves to `False`. | |
* @typeparam U - An arbitrary type | |
* @typeparam V - An arbitrary type | |
* @typeparam True - Production when `U` is the same as `V` | |
* @typeparam False - Production when `U` is not the same as `V` | |
*/ | |
export type Exact<U, V, True = true, False = false> = | |
{ <_>(): _ extends U ? 1 : 0 } extends { <_>(): _ extends V ? 1 : 0 } | |
? True |
This file contains 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
def PI: 3.14159265359; | |
def Radians(deg): deg * (PI / 180); | |
def Degrees(rad): rad * (180 / PI); | |
def a: 6378.137; #equitorial radius in km | |
def b: 6356.752; #polar radius in km | |
def radius_of_earth(lat1): | |
(((pow(((a*a)*(lat1 | cos));2))+(pow(((b*b)*(lat1 | sin));2)))/(pow((a*(lat1 | cos));2)+pow((b*(lat1 | sin));2))) | sqrt; | |
def Distance1(lat1;long1;lat2;long2): |
This file contains 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 StringSerialized<T extends object, Prefix extends string = ""> = T extends Array<any> ? { | |
[P in keyof T & `${bigint}`]: `-${P}` extends `${bigint}` | |
? | `${Prefix}${P}` | |
| StringSerialized<T[P] & object, `${Prefix}${P}.`> | |
: never | |
}[keyof T & `${bigint}`] : { | |
[P in keyof T & string]: | |
| `${Prefix}${P}` | |
| StringSerialized<T[P] & object, `${Prefix}${P}.`> | |
}[keyof T & string]; |
NewerOlder