Results for “New-Item”
Small, practical examples. Search by task or narrow things down below.
Create a directory if needed
Ensure a directory exists before writing output.
New-Item✓ Tested
Append an item to a small array
PowerShell: The plus-equals operator builds a new array; use a generic list for repeated large additions.
PowerShell✓ Tested
Keep only the most recent items
Python: Use a bounded deque to discard the oldest item as new values arrive.
Python✓ Tested
Prepend items while preserving existing array values
Bash Scripts: Construct a new array with the new values before the quoted original expansion.
Bash Scripts✓ Tested
Transform each item with Select
C#: Project each input value into a new value without modifying the source array.
C#✓ Tested
Align flex items at the main-axis end
CSS: Flex-end uses the trailing edge of the flex container for packing.
CSS✓ Tested
Append a list item
Build a jQuery element with text and append it safely.
jQuery✓ Tested
Append a new member to an uncompressed tar
Linux Commands: Use tar -r for an existing uncompressed archive; compressed tar files cannot be appended this way.
Linux Commands✓ Tested
Append a safely constructed list item
jQuery: Learn how to append a safely constructed list item in a complete browser example.
jQuery✓ Tested
Append several items to an array
Bash Scripts: Array-plus-equals adds elements without losing spaces inside a quoted item.
Bash Scripts✓ Tested
Center a small item in a grid cell
CSS: Place-items sets both block-axis and inline-axis item alignment.
CSS✓ Tested
Check whether any item matches
JavaScript: some stops once a predicate succeeds.
JavaScript✓ Tested