Skip to content

Instantly share code, notes, and snippets.

View mdippery's full-sized avatar

Michael Dippery mdippery

View GitHub Profile
@mdippery
mdippery / window.m
Last active March 14, 2025 23:34
Get window information using Core Graphics
#import <stdio.h>
#import <sys/sysctl.h>
#import <unistd.h>
#import <Foundation/Foundation.h>
#import <CoreGraphics/CoreGraphics.h>
/* Returns the parent of any arbitrary process, more flexible than
* getpid() and getppid().
*/
@mdippery
mdippery / result.ts
Created October 29, 2025 23:35
Rust's Result type in TypeScript
/**
* Abstract representation of success or failure.
*
* @remarks
* Provides a fluid interface for chaining and working with errors that
* is easier to read than long chains of null and undefined checks.
*/
export abstract class Result<T, E> {
/** @return a new result representing a successful calculation. */
static ok<T, E = never>(value: T): Result<T, E> {