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 AllocationsAvoiding String Allocations | How to avoid String allocations in Rust with Cow | Rust | |
Simplify Match StatementsSimplify Match Statements | How to simplify match statements by not using match at all in certain situations | Rust | |
Sorting Numbers CorrectlySorting Numbers Correctly | How to sort numbers correctly | JavaScript | |
Checking URL PatternsChecking URL Patterns | How to test URL patterns | JavaScript | |
Using The ClipboardUsing The Clipboard | How to access the clipboard inside the browser | JavaScript | |
Syncing Multiple Browser Tabs LocallySyncing Multiple Browser Tabs Locally | How to kep multiple browser tabs in sync without any remote calls | JavaScript | |
Check If An Object Contains A PropertyCheck If An Object Contains A Property | How to check whether an object contains a specific property | JavaScript | |
Destructure From An Undefined ObjectDestructure From An Undefined Object | How to safely destructure from possibly undefined objects without risking errors | JavaScript | |
Infinitely Flatten Any ArrayInfinitely Flatten Any Array | How to infinitely flatten any array in JavaScript | JavaScript | |
Object Destructuring With Dynamic PropertiesObject Destructuring With Dynamic Properties | How to destructure an object using a dynamically assignable property | JavaScript | |
Optional Chaining With FunctionsOptional Chaining With Functions | How to use optional chaining with functions | JavaScript | |
Random IntegerRandom Integer | How to generate an unsafe (not cryptographically usable) random integer | JavaScript | |
Random NumberRandom Number | How to generate an unsafe (not cryptographically usable) random number | JavaScript | |
Secure Integers In NodeSecure Integers In Node | How to create cryptographically secure random integers in Node.js | Node.js | |
Secure UUIDs In NodeSecure UUIDs In Node | How to create nearly collision-free UUIDs in Node.js | Node.js | |
Swap Array Elements InlineSwap Array Elements Inline | How to swap array elements inline | JavaScript | |
Lazy RangeLazy Range | How to create a lazy range in JavaScript for larger ranges than an eager range can contain | JavaScript | |
RangeRange | How to create a range in JavaScript | JavaScript | |
Unpack Nested OptionsUnpack Nested Options | How to unpack nested Options without cluttering your code | Rust | |
Unpack Nested ResultsUnpack Nested Results | How to unpack nested Options without cluttering your code | Rust |