Gists
Share and discover code snippets417 gists
Short HTML Snippet
This HTML snippet creates a basic webpage structure with a title and a paragraph of text.
Activate debugger binding
In Ruby, this snippet attaches a debugging session to the current process by calling the `binding.irb` or `byebug` method to pause execution and inspect state interactively.
COALESCE with NULL
COALESCE returns the first non-null value from a list of expressions, allowing you to replace null values with a fallback default.
Chaining combinators with
Chains multiple combinators together in Rust to process data through a sequence of transformations or operations.
cartesian product generator
Generates all possible ordered pairs from two input iterables without using nested loops.
Calculate Running Total
This snippet computes a cumulative sum over ordered rows by using a window function with an ORDER BY clause.
extract generic type
Extracts the underlying generic type from a TypeScript type, such as pulling `string` from `Promise<string>`.
bash function example
A bash function example defines a reusable block of commands that can be called by name to execute those commands in sequence.
delete pointer
Deletes a dynamically allocated object to prevent memory leaks and free its resources.
Sort Map by Values
This snippet sorts a Java Map by its values, returning the entries in a List ordered by value.
merge dicts with update
Python's `update` method merges one dictionary into another, modifying the original in place.
Flexbox Center Trick
This CSS snippet centers a child element both horizontally and vertically inside its parent using Flexbox.
Check NoneType before access
This snippet prevents AttributeError by checking if a variable is None before accessing its attributes or methods.
CSS Grid Center
A CSS Grid utility that perfectly centers any child element both horizontally and vertically within its parent container.
LEFT JOIN with Filter
Filters rows from the right table in a LEFT JOIN by applying conditions in the WHERE clause to exclude unmatched records.
`func ref mut`
Borrows a mutable reference to a value, allowing you to modify it through the pattern.
find duplicates by column
This SQL snippet finds rows with duplicate values in a specified column by grouping and counting occurrences.
Array map callback
PHP's `arraymap` applies a callback function to each element of an array, returning a new array with the transformed values.
print table contents
This snippet prints all key-value pairs in a Lua table for debugging or inspection.