Snippets
Snippets are just that...snippets. Here I share some code snippets that are not worth a full blog post.
They are still worth being shared because they are usually useful for my, and probably your, work.
| Title | Description | Category | Last Updated |
|---|---|---|---|
| Avoiding String Allocations Avoiding String Allocations | How to avoid String allocations in Rust with Cow | Rust | |
| Simplify Match Statements Simplify Match Statements | How to simplify match statements by not using match at all in certain situations | Rust | |
| Sorting Numbers Correctly Sorting Numbers Correctly | How to sort numbers correctly | JavaScript | |
| Checking URL Patterns Checking URL Patterns | How to test URL patterns | JavaScript | |
| Using The Clipboard Using The Clipboard | How to access the clipboard inside the browser | JavaScript | |
| Syncing Multiple Browser Tabs Locally Syncing Multiple Browser Tabs Locally | How to kep multiple browser tabs in sync without any remote calls | JavaScript | |
| Check If An Object Contains A Property Check If An Object Contains A Property | How to check whether an object contains a specific property | JavaScript | |
| Destructure From An Undefined Object Destructure From An Undefined Object | How to safely destructure from possibly undefined objects without risking errors | JavaScript | |
| Infinitely Flatten Any Array Infinitely Flatten Any Array | How to infinitely flatten any array in JavaScript | JavaScript | |
| Object Destructuring With Dynamic Properties Object Destructuring With Dynamic Properties | How to destructure an object using a dynamically assignable property | JavaScript | |
| Optional Chaining With Functions Optional Chaining With Functions | How to use optional chaining with functions | JavaScript | |
| Random Integer Random Integer | How to generate an unsafe (not cryptographically usable) random integer | JavaScript | |
| Random Number Random Number | How to generate an unsafe (not cryptographically usable) random number | JavaScript | |
| Secure Integers In Node Secure Integers In Node | How to create cryptographically secure random integers in Node.js | Node.js | |
| Secure UUIDs In Node Secure UUIDs In Node | How to create nearly collision-free UUIDs in Node.js | Node.js | |
| Swap Array Elements Inline Swap Array Elements Inline | How to swap array elements inline | JavaScript | |
| Lazy Range Lazy Range | How to create a lazy range in JavaScript for larger ranges than an eager range can contain | JavaScript | |
| Range Range | How to create a range in JavaScript | JavaScript | |
| Unpack Nested Options Unpack Nested Options | How to unpack nested Options without cluttering your code | Rust | |
| Unpack Nested Results Unpack Nested Results | How to unpack nested Options without cluttering your code | Rust |