The snippet library.
Small, practical examples. Search by task or narrow things down below.
Collect ordered values into an array
Build a sorted array from query rows.
array_agg✓ Tested
Collect repeated form field names
jQuery: serializeArray preserves multiple values as name-value records.
jQuery✓ Tested
Collect selected options from a multi-select
Collect selected options from a multi-select with a small React component and explicit browser behavior.
React✓ Tested
Collect several checked values under one name
HTML: Only checked named checkboxes become successful form controls.
HTML✓ Tested
Collect two independent background results
Bash Scripts: Write each job’s output separately and wait for both before combining results.
Bash Scripts✓ Tested
Collect unique sorted values
Collect unique sorted values in a complete Rust program using the standard library.
Rust✓ Tested
Combine a branch’s changes into one new commit
Git: Squash prepares the combined changes in the index without recording a merge parent.
Git✓ Tested
Combine a fixed sidebar with a flexible content track
CSS: Minmax zero avoids an intrinsic minimum forcing the flexible track wider than its container.
CSS✓ Tested
Combine a stable entrypoint with default arguments
Docker / Compose: CMD supplies default arguments to an exec-form ENTRYPOINT.
Docker / Compose✓ Tested
Combine Boolean conditions
Combine Boolean conditions in a complete Rust program using the standard library.
Rust✓ Tested
Combine collections as a distinct set
C#: Union retains each value once across both inputs.
C#✓ Tested
Combine conditions with and
PowerShell: Combine conditions with and using PowerShell 7.
PowerShell✓ Tested