just a fun exercise for learning some x86_64 nasm assembly (linux)
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
export enum Ordering { | |
Less = -1, | |
Equal = 0, | |
Greater = 1, | |
} | |
export interface Eq<T> { | |
eq(other: T): 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
export default function createPartialApplication<T extends any[], R>( | |
fn: (...args: T) => R, | |
): PartialApplication<T, R> { | |
return function accumulator(...args1: any[]): any { | |
return args1.length >= fn.length | |
? fn(...(args1 as T)) | |
: (...args2: any[]) => accumulator(...args1.concat(args2)); | |
}; | |
} |
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
use std::collections::HashSet; | |
use std::iter::Peekable; | |
use std::str::Chars; | |
#[derive(Debug, PartialEq, Clone)] | |
enum Token { | |
Lambda, | |
Dot, | |
Variable(String), | |
LParen, |
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
use std::collections::HashSet; | |
use std::iter::Peekable; | |
use std::str::Chars; | |
#[derive(Debug, PartialEq, Clone)] | |
enum Token { | |
Lambda, | |
Dot, | |
Variable(String), | |
LParen, |
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
#include <stdio.h> | |
#include <stdint.h> | |
uint8_t da(uint8_t value) { | |
uint8_t lo = value & 0x0F; | |
uint8_t hi = value >> 4; | |
if (lo > 9) lo += 6; | |
if (hi > 9) hi += 6; | |
return (hi << 4) | lo; | |
} |
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
package main | |
import ( | |
"errors" | |
"math/rand" | |
"os" | |
"time" | |
) | |
// initialize rng |
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 AnyFn = (...args: any[]) => any; | |
namespace ElementExt { | |
export function addEventListener< | |
El extends Element | Document, | |
const S extends string, | |
const H extends AnyFn, | |
>(name: S, cb: H): (el: El) => void; | |
export function addEventListener< | |
El extends Element | Document, |
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
# Standard .NET and C# ignores | |
bin/ | |
obj/ | |
out/ | |
build/ | |
buildscript/ | |
*.sln.cache | |
*.suo | |
*.user | |
*.userprefs |
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 { describe, it, expect } from "bun:test"; | |
import { deepClone, deepMerge, isObject } from "./lib.ts"; | |
describe("isObject", () => { | |
it("returns false for null", () => expect(isObject(null)).toBe(false)); | |
it("returns false for undefined", () => expect(isObject(undefined)).toBe(false)); | |
it("returns false for numbers", () => expect(isObject(0)).toBe(false)); | |
it("returns false for strings", () => expect(isObject("")).toBe(false)); | |
it("returns false for booleans", () => expect(isObject(false)).toBe(false)); | |
it("returns true for objects", () => expect(isObject({})).toBe(true)); |