A minimal, unopinionated state management library for React with a hooks-based API.
- Store: A single source of truth holding your application state
- Hooks-based: Access state using hooks, no providers needed
| import networkx as nx | |
| import numpy as np | |
| import math | |
| from dataclasses import dataclass, field | |
| from typing import List, Dict, Tuple, Any | |
| # --- core data structures --- | |
| @dataclass | |
| class Entity: |
| import torch | |
| import torch.nn as nn | |
| import torch.nn.functional as F | |
| import math | |
| from typing import List, Optional | |
| class PagedKVCache: | |
| """ | |
| advanced paged key-value cache manager for large language models. | |
| simulates the memory management backend of frameworks like vllm. |
| // 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; | |
| } |
| type Listener = () => void; | |
| type Unsubscribe = () => void; | |
| interface CacheEntry<T> { | |
| data: T; | |
| listeners: Set<Listener>; | |
| dbUnsubscribe: Unsubscribe | null; | |
| subscriberCount: number; | |
| } |
Fast all-in-one JavaScript runtime and toolkit (bundler, test runner, package manager).
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.
| // 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 |