Results for “only”
Small, practical examples. Search by task or narrow things down below.
Add a dictionary entry only if absent
C#: TryAdd reports a duplicate key without replacing its existing value.
C#✓ Tested
Append text only when the destination has enough capacity
C: Check the combined lengths including the terminator before using strcat.
C✓ Tested
Apply an enhancement only when a feature is supported
CSS: A supports rule preserves the baseline outside browsers that understand the selected declaration.
CSS✓ Tested
Change directory only for one operation
Bash Scripts: A subshell makes a temporary directory change without affecting later commands.
Bash Scripts✓ Tested
Create a file only when it does not exist
C#: FileMode.CreateNew prevents accidental replacement of existing content.
C#✓ Tested
Delete only a named scratch file
PowerShell: Use LiteralPath and avoid recursive removal for a single known file.
PowerShell✓ Tested
Delete only a selected local tag
Git: Deleting a local tag does not delete a corresponding remote tag.
Git✓ Tested
Enable saving only after a field changes
Enable saving only after a field changes with a standalone Angular component and explicit browser behavior.
Angular✓ Tested
Expose a read-only signal view
Expose a read-only signal view with a standalone Angular component and explicit browser behavior.
Angular✓ Tested
Expose service state through a read-only signal
Expose service state through a read-only signal with a standalone Angular component and explicit browser behavior.
Angular✓ Tested
Give a read-only container temporary storage
Docker / Compose: Give a read-only container temporary storage using a locally available Ubuntu image.
Docker / Compose✓ Tested
Give a read-only service writable scratch space
Docker / Compose: A tmpfs mount provides temporary storage independent of the root filesystem.
Docker / Compose✓ Tested