Gists
Share and discover code snippets418 gists
HTML5 boilerplate
This HTML5 boilerplate provides a minimal, standardized starting template with essential meta tags, semantic elements, and cross-browser compatibility.
Box-sizing border-box
The box-sizing property with border-box value makes an element's total width and height include its padding and border, simplifying layout calculations.
array shuffle
This snippet randomly reorders the elements of an array in place using the Fisher-Yates shuffle algorithm.
deep clone utility
Creates an independent copy of any JavaScript object or array, including all nested properties, without referencing the original.
Parse integer from string
Quickly parse an integer from a string with `str::parse`, and handle invalid input with `unwrapor`.
swap ints using XOR
Swap two integer variables in place using bitwise XOR, avoiding a temporary variable.
if let Some
`if let Some` in Rust is a concise pattern for matching the `Some` variant of an `Option`, executing code only when the value is present and binding the inner value.
Optional orElseThrow
Use Optional's orElseThrow to elegantly retrieve a value or throw a custom exception if it's null.
find largest files
This bash snippet finds and displays the largest files in a directory tree, sorted by size.
Read file contents
This code snippet reads a file's entire contents into a string using `std::fs::readtostring`.
Debounce function
A handy debounce function that delays invoking a callback until after a specified wait period has elapsed since the last call, preventing rapid-fire execution.
String aggregation
Use STRINGAGG to combine values from multiple rows into a single string, optionally ordered and with a custom delimiter.
HTTP middleware pattern
HTTP middleware wraps an HTTP handler to add pre- or post-processing logic, such as logging, authentication, or rate limiting, in a reusable chain.
RAII lock guard
Automatically acquires a mutex lock on construction and releases it on destruction, ensuring exception-safe synchronization.
Async retry wrapper
A reusable async wrapper that automatically retries a failed asynchronous operation with configurable attempts and delays.
Handling Option with map
Safely transform the inner value of an `Option` by using `map` to apply a function only when it's `Some`, and keep it `None` otherwise.
Find duplicate files
This bash snippet helps you quickly identify duplicate files by comparing their checksums.
swap two integers
This snippet exchanges the values of two integer variables without using a temporary variable, leveraging XOR bitwise operations for an efficient in-place swap.
Option combinator chain
A handy way to transform and chain operations on Option values using combinators like map, andthen, and orelse without nested match statements.
deep copy table
This snippet recursively copies all keys and values from a Lua table into a new table, preserving structure and avoiding shared references.
List comprehension filter
This list comprehension filter lets you concisely generate a new list by including only items from an iterable that meet a specified condition.
DevPlace Autonomous Bot (OpenRouter) — Rust Edition
Autonomous Rust bot using OpenRouter LLM API to engage with the DevPlace social platform
DevPlace Autonomous Bot (OpenRouter) — C# Edition
Autonomous C# bot using OpenRouter LLM API to engage with the DevPlace social platform