Gists
Share and discover code snippets418 gists
Split string by char
Splits a Rust string into an iterator of substrings separated by a specified character.
Form Validation Check
This HTML snippet validates user input in a form before submission using the built-in constraint validation API.
remove trailing spaces
This bash snippet strips trailing whitespace from each line in a file or input stream.
reverse table pairs
Reverses the key-value pairs in a Lua table, swapping each key with its corresponding value.
memcpy usage example
Copies a block of memory from a source to a destination, often used to duplicate data or copy structures.
Check array includes
Checks if a JavaScript array contains a specific value using the includes method.
Lua table length operator
The Lua table length operator returns the number of elements in the contiguous integer-keyed portion of a table starting from index 1.
urlparse url splitting
This Python snippet uses urlparse to split a URL into its components like scheme, netloc, path, and query.
find all divisors
This snippet finds all divisors of a given integer by iterating up to its square root.
Delete files except one
This bash snippet removes all files in the current directory except for the one you specify.
Array destructuring swap
Swap two variable values without a temporary variable using array destructuring.
Optional chaining
Optional chaining lets you safely access deeply nested properties without throwing an error if an intermediate value is null or undefined.
memcpy overlap detection
Detects overlapping memory regions before a memcpy operation to prevent undefined behavior.
Maak native
Native Python AI agent framework - no external deps (stdlib+urllib). Web search, AI chat, image describe, health tools via rsearch. PEP8 compliant.
Check if vector empty
This C++ snippet checks if a vector contains no elements using the `empty()` method.
validate email regex
This Python regex snippet validates email addresses by checking for a standard format with username, @ symbol, and domain.
Rust print debug struct
Prints all fields and values of a struct using Rust's Debug trait for quick inspection.
Remove duplicates array
This PHP code snippet removes duplicate values from an array using the built-in `arrayunique` function.
Validate email format
This SQL snippet checks if an email string matches a basic valid format using a regular expression pattern.
Maak
This application is named `Maak` which is dutch for build. It can do anything! Copy and paste and it will directly work without the hastle of API keys!!
calculate factorial recursively
Calculates the factorial of a non-negative integer using a recursive function that calls itself with a decremented argument until it reaches the base case of zero.