Snippets
A searchable catalogue of reusable code snippets and helpers, organised by language and tags, providing developers with a central place to discover practical examples, reusable utilities, and ready-to-use solutions for common programming tasks and everyday development workflows.
Latest Snippets
-
List version-sorted remote tags that match a dotted triple and print the highest name, skipping peeled annotated-tag objects.
-
Print the default branch name that origin reports as HEAD, trimmed of surrounding whitespace.
-
Sort mappings by column names. A leading minus on a name sorts that column descending.
-
Cut a list to a target length, or extend it with a fill value when it is shorter.
-
Register an error handler that emails the number, file, line, and message to a chosen address, then stops on anything more severe than a notice.
-
Parse help, version, aflag, and b from short or long flags, and return the values keyed by the long name.
-
Search an expanded PATH for each command name and return its full path, or raise when any name is missing.
-
Parse a GitHub repository URL and return its default branch name from the GitHub API.
-
Return /N for a dotted IPv4 netmask, and reject masks whose 1-bits are not a contiguous prefix.