The snippet library.
Small, practical examples. Search by task or narrow things down below.
Move overlapping bytes safely
C: memmove supports overlapping ranges, unlike memcpy.
C✓ Tested
Move owned data into a worker
Move owned data into a worker in a complete Rust program using the standard library.
Rust✓ Tested
Mutate a struct through a pointer receiver
Mutate a struct through a pointer receiver using a complete Go program with explicit sample inputs.
Go✓ Tested
Name a fixed configuration value
Name a fixed configuration value using a complete Go program with explicit sample inputs.
Go✓ Tested
Name a fixed configuration value
Arduino / C: Name a fixed configuration value on an Uno with the Serial Monitor set to 9600 baud.
Arduino / C✓ Tested
Name a meaningful image with alternative text
HTML: Alt supplies an accessible text alternative describing the image’s purpose.
HTML✓ Tested
Name a self-contained embedded document
HTML: Give an iframe a descriptive title and provide its small document with srcdoc.
HTML✓ Tested
Name a template expression with @let
Name a template expression with @let with a standalone Angular component and explicit browser behavior.
Angular✓ Tested
Name a value that stays fixed
Python: Use a constant declaration or the language’s constant naming convention for a fixed limit.
Python✓ Tested
Name a value that stays fixed
C#: Use a constant declaration or the language’s constant naming convention for a fixed limit.
C#✓ Tested
Name a value that stays fixed
Java: Use a constant declaration or the language’s constant naming convention for a fixed limit.
Java✓ Tested
Name a value that stays fixed
JavaScript: Use a constant declaration or the language’s constant naming convention for a fixed limit.
JavaScript✓ Tested