Gists
Share and discover code snippets417 gists
re.sub cleanup string
This Python snippet uses regex to remove unwanted characters or patterns from a string.
Move Semantics Example
This snippet demonstrates efficient resource transfer by using move semantics to avoid expensive deep copies when passing temporary objects.
RefCell runtime borrow
Provides interior mutability with runtime borrow checking, ensuring safe mutation of values behind shared references.
Practical lambda invoke
This snippet demonstrates how to immediately invoke a C++ lambda expression to execute a block of code inline.
list comprehension flatten
Flattens a nested list into a single list using a list comprehension with two for clauses.
INDEX with included columns
Creates a non-clustered index that stores additional column data at the leaf level to cover queries without accessing the table.
Flex Centering Trick
Uses flexbox properties to perfectly center any element both horizontally and vertically within its container.
Array destructuring merge
PHP array destructuring merge combines two arrays by unpacking one into another using the spread operator inside square brackets.
Rust Clap Subcommand
A Rust code snippet using the Clap library to define and parse subcommands in a command-line application.
hello world program
A C hello world program prints "Hello, World!" to the console using the printf function inside the main function.
Check if directory exists
This Bash snippet checks if a specified directory exists using a simple conditional statement.
Two Column Grid
A responsive two-column grid layout using CSS Grid that automatically stacks into a single column on smaller screens.
shuffle array Fisher-Yates
Shuffles an array in-place using the Fisher-Yates algorithm for unbiased random ordering.
Swap two numbers
This C code snippet swaps the values of two integer variables using a temporary variable.
UTF-8 BOM strip
This C code snippet removes the UTF-8 Byte Order Mark (BOM) from the beginning of a file or string.
Sort slices stable
This code snippet performs a stable sort on a slice in Go, preserving the original order of equal elements.