Skip to content

Instantly share code, notes, and snippets.

View mosioc's full-sized avatar
🚀
Ascending - 36°N 64°E

Mehdi Maleki mosioc

🚀
Ascending - 36°N 64°E
View GitHub Profile
@mosioc
mosioc / karteibox.ts
Created June 5, 2026 11:49
5-Box Leitner Spaced Repetition System - G5
// map of box index to the days interval array
const G5_INTERVALS = [1, 2, 5, 9, 14];
interface Flashcard {
id: string;
word: string;
definition: string;
box: number; // 1 to 5
nextReviewDate: Date;
}
@mosioc
mosioc / QueryCache.ts
Created May 26, 2026 09:29
Large-scale offline-first app with useLiveQuery + state management
type Listener = () => void;
type Unsubscribe = () => void;
interface CacheEntry<T> {
data: T;
listeners: Set<Listener>;
dbUnsubscribe: Unsubscribe | null;
subscriberCount: number;
}
@mosioc
mosioc / zustand-sheet.md
Created February 5, 2026 17:47
Zustand cheat sheet

Zustand Cheat Sheet

A minimal, unopinionated state management library for React with a hooks-based API.


Core Concepts

  • Store: A single source of truth holding your application state
  • Hooks-based: Access state using hooks, no providers needed
@mosioc
mosioc / bun-sheet.md
Created January 23, 2026 15:47
Bun cheat sheet

Bun Cheat Sheet

Fast all-in-one JavaScript runtime and toolkit (bundler, test runner, package manager).


Core Concepts

What is Bun?

Bun is a modern JavaScript runtime built from scratch using Zig and JavaScriptCore (Safari's JS engine). It serves as a drop-in replacement for Node.js with significantly faster startup times and execution speed. Unlike Node.js which uses V8, Bun uses JavaScriptCore which contributes to its performance gains.

@mosioc
mosioc / deno-sheet.md
Created January 23, 2026 15:29
Deno cheat sheet

Deno Cheat Sheet

A modern, secure runtime for JavaScript and TypeScript built on V8, Rust, and Tokio.


Core Concepts

What is Deno?

@mosioc
mosioc / script-sheet.md
Created December 29, 2025 17:00
Shell scripting in Bash, Node.js, and Python cheat sheet

Shell Scripting Cheat Sheet: Bash, Node.js, and Python

Quick reference for writing scripts in Bash, Node.js, and Python with practical examples and explanations.


Core Concepts

Script Anatomy

@mosioc
mosioc / algebraic_effects.rs
Created December 28, 2025 19:59
Algebraic Effects in Rust
// ALGEBRAIC EFFECTS
use std::cell::RefCell;
use std::rc::Rc;
#[derive(Debug, Clone)]
enum Effect {
Log(String),
GetRandom(i32, i32), // min, max
Pause(u32), // milliseconds
@mosioc
mosioc / cpp-sheet.md
Created December 28, 2025 19:07
C++ cheat sheet

C++ Cheat Sheet

A powerful general-purpose programming language that provides low-level memory control, object-oriented features, and high performance with zero-cost abstractions. C++ extends C with classes, templates, and modern safety features.


Core Concepts

C++ combines procedural, object-oriented, and generic programming paradigms. It provides direct hardware access while offering high-level abstractions.

@mosioc
mosioc / python-sheet.md
Last active May 17, 2026 07:24
Python cheat sheet

Python Cheat Sheet

Quick reference guide for Python programming fundamentals and common patterns.


Core Concepts

Python is a high-level, interpreted, dynamically-typed language emphasizing code readability. Everything in Python is an object, and the language follows a "batteries included" philosophy with a comprehensive standard library.