TIL
Manage multiple Python versions on macOS using asdf, a unified version manager replacing pyenv, nvm, and language-specific tools.
Optimize Django model saves with update_fields parameter to generate leaner SQL queries and improve performance in tight update loops.
Understand how return values work in Bash functions. Learn exit codes, status evaluation patterns, and proper boolean returns with true/false commands.
Combine session and function-scoped pytest fixtures to avoid expensive test setup while maintaining test isolation and preventing state coupling.
Fix divergent branch errors with git pull --rebase. Learn when to rebase local commits on top of remote changes for cleaner Git history.
View git commit history for a single file with git log --follow. Learn to track multiple files with xargs and concatenate their commit logs.
Run background health checks in CI with nohup and ampersand. Test server readiness with retry loops and automatic cleanup on success or failure.
Learn efficient patterns for caching database connection objects in Python without import-time side effects or lru_cache complexity.
Optimize Python dictionary slicing from O(DK) to O(K) complexity using direct key lookups instead of iterating through all items.
Test literal booleans correctly in Python unittest using assertIs instead of assertTrue/assertFalse to avoid truthy/falsy confusion.
Use Python's bit_count() method to elegantly check if an integer is a power of two by counting on-bits in binary representation.
Standardize Django REST Framework error responses using custom exception handlers to match Microsoft's REST API guidelines format.
Understand when to use constrained TypeVar vs Union in Python type hints for consistent types across function parameters and return values.
Avoid memory leaks when caching instance methods with lru_cache by making cache containers local to instances instead of global.
Crop text to character limits without breaking words using Python's textwrap.shorten for clean truncation with customizable placeholders.