Never hold a static or long-lived reference to an Activity, Fragment, View, or their Context. Use applicationContext for needs that outlive a single screen. A static Activity ref keeps the whole view hierarchy alive past onDestroy, leaking memory. (Android docs — Activity lifecycle).
Quote every variable expansion: "$var", "${arr[@]}". Unquoted expansions word-split and glob-expand — the source of nearly every "works until a path has a space" bug. Use "$@" (not $, not unquoted $@) to forward arguments — it preserves each argument as a separate quoted word. $ joins them into one string. Use [[ ...…
Treat each hardware encode/decode session as an explicitly-owned scarce resource with a defined create→use→destroy lifetime; release it deterministically, never on GC/finalizer timing. Hardware codec engines (NVENC/NVDEC, VideoToolbox, MediaCodec) expose a small fixed number of concurrent sessions; a leaked session…
Why: the corpus already does this eight times over (leak scan, residue check, projection drift, byte and token budgets, symlink drift, stale spec pins, agent output contract) without ever having named it, so new contracts get written as prose by default and the pattern is rediscovered per-case. Naming it makes the…
Use RAII lock guards (std::lockguard, std::scopedlock, std::uniquelock) — never bare mutex.lock() / unlock(). A manual unlock is skipped on every early return and every throw. (CP.20) Acquire multiple locks with std::scopedlock (or std::lock) in one statement — it orders acquisition to avoid deadlock. Never hand-order…
Async methods return Task / Task (or ValueTask for hot paths). Never async void except event handlers — an exception in async void cannot be caught and tears down the process. Name async methods with the Async suffix (LoadAsync). The suffix is the contract that the method is awaitable. Library code calls…
Expose inspector-editable fields with [Export] on a C# property/field, the binding equivalent of GDScript's @export. Plain C# fields are invisible to the editor. (Godot docs — C# basics) Declare signals as [Signal] public delegate void NameEventHandler(...). The generated event is the typed, editor-visible signal…
In a signal handler, call ONLY functions listed in the async-signal-safe set (man 7 signal-safety); malloc, printf, and most libc functions are NOT safe — they may hold internal locks that the signal interrupted, causing deadlock. (man 7 signal-safety, POSIX.1-2017 §2.4.3).
Call xrEnumerateInstanceExtensionProperties before constructing XrInstanceCreateInfo::enabledExtensionNames. Never pass extension names that have not been confirmed present; xrCreateInstance will return XRERROREXTENSIONNOTPRESENT and fail. (OpenXR: xrEnumerateInstanceExtensionProperties, XrInstanceCreateInfo…
Catch the most specific exception type. Never a bare except: — it swallows SystemExit and KeyboardInterrupt. Use except Exception: only at a top-level boundary, and re-raise or log. Keep the try body minimal — only the line that can raise. A fat try block catches failures you didn't mean to catch. Manage resources…
All lighting and shading calculations must be performed in linear light (scene-linear color space); sample sRGB textures through hardware linearization (GLSRGB8ALPHA8 / DXGIFORMATSRGB / MTLPixelFormatRGBA8UnormsRGB) so the hardware converts on read. Mixing gamma-encoded values with linear math produces physically…
Why: dependability and debuggability are paid for in the type definition, not at the bug site. A panicking destructor or a Debug impl that returns "" are not noticed until production, by which point the cost of fixing is enormous.
Reserved keywords in UPPERCASE (SELECT, FROM, WHERE, JOIN); identifiers in lowersnakecase. The case split makes structure scannable at a glance. Right-align root keywords to a "river" so clause bodies start at a common column. Keeps multi-clause queries readable as a block. One column per line in long SELECT lists…
Never leave a promise floating — await it, return it, or explicitly void it. An unawaited promise drops its rejection on the floor (unhandled rejection) and breaks ordering assumptions. Prefer async/await over .then() chains for sequential work — flatter, debuggable, and error handling is one try/catch instead of…
Why: async bugs dominate production incidents in web apps. Explicit patterns catch them at review time. Source: MDN AbortController; WHATWG HTML unhandledrejection.
Choose ordered/reliable vs unreliable per use case deliberately. Set maxRetransmits or maxPacketLifeTime (never both) for partial reliability; leave both unset only when full reliability is actually required. State sync wants reliable; real-time telemetry wants unreliable. (W3C WebRTC — RTCDataChannel /…
★not rated 2 yesterdayA0 tokens
originalMIT
At most 3 mods per repository are shown here, and a mod shipped inside a plugin is left to that plugin's page — the rest are on their repository pages: