Skip to content

Instantly share code, notes, and snippets.

View axelhamil's full-sized avatar
🥖

AxelHamil axelhamil

🥖
View GitHub Profile
@axelhamil
axelhamil / result.ts
Last active July 2, 2025 23:07
Rust-inspired Result Type for TypeScript
/**
* Represents the result of an operation, which can be either a success or a failure.
* This pattern is useful for explicit error handling and chaining operations.
* @template T The type of the value on success.
* @template E The type of the error on failure (default: string).
*/
export class Result<T, E = string> {
/**
* Indicates if the result is a success.
*/
@axelhamil
axelhamil / option.ts
Last active July 2, 2025 23:07
Rust-inspired Option Type for TypeScript
/**
* Implementation of Rust-like Option type in TypeScript
*/
export abstract class Option<T> {
/**
* Returns true if the option is a Some value
*/
abstract isSome(): boolean;
/**
@axelhamil
axelhamil / ReactLike.md
Last active June 24, 2025 20:41
Mini ReactTree in TypeScript: Typed Components to Render HTML
type NodeReactLike = {
  tag: string;
  attrs: Record<string, string>;
  children: NodeReactLike[];
  text: string | null;
};

const El = (
  tag: string,
@typovrak
typovrak / issues-pr-rebasing-cli-git-gh.md
Last active June 23, 2025 16:28
GitHub workflow management using only CLI (git + gh)

🖥️ Managing issues, PRs, and rebasing using only CLI (git + gh)

0. 🔧 Prerequisites

  • Navigate to your repository in terminal.
  • Ensure git and GitHub CLI (gh) are installed on your system.

1. 🎫 Create an issue

gh issue create