Oliver Jumpertz

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.

TitleDescriptionCategoryLast Updated
Avoiding String AllocationsHow to avoid String allocations in Rust with CowRust
Simplify Match StatementsHow to simplify match statements by not using match at all in certain situationsRust
Sorting Numbers CorrectlyHow to sort numbers correctlyJavaScript
Checking URL PatternsHow to test URL patternsJavaScript
Using The ClipboardHow to access the clipboard inside the browserJavaScript
Syncing Multiple Browser Tabs LocallyHow to kep multiple browser tabs in sync without any remote callsJavaScript
Check If An Object Contains A PropertyHow to check whether an object contains a specific propertyJavaScript
Destructure From An Undefined ObjectHow to safely destructure from possibly undefined objects without risking errorsJavaScript
Infinitely Flatten Any ArrayHow to infinitely flatten any array in JavaScriptJavaScript
Object Destructuring With Dynamic PropertiesHow to destructure an object using a dynamically assignable propertyJavaScript
Optional Chaining With FunctionsHow to use optional chaining with functionsJavaScript
Random IntegerHow to generate an unsafe (not cryptographically usable) random integerJavaScript
Random NumberHow to generate an unsafe (not cryptographically usable) random numberJavaScript
Secure Integers In NodeHow to create cryptographically secure random integers in Node.jsNode.js
Secure UUIDs In NodeHow to create nearly collision-free UUIDs in Node.jsNode.js
Swap Array Elements InlineHow to swap array elements inlineJavaScript
Lazy RangeHow to create a lazy range in JavaScript for larger ranges than an eager range can containJavaScript
RangeHow to create a range in JavaScriptJavaScript
Unpack Nested OptionsHow to unpack nested Options without cluttering your codeRust
Unpack Nested ResultsHow to unpack nested Options without cluttering your codeRust