Results for “path”
Small, practical examples. Search by task or narrow things down below.
Resolve a relative URL against a base
TypeScript: A trailing slash makes the final base path component a directory.
TypeScript✓ Tested
Restore an environment value after temporary use
PowerShell: Use finally so temporary process configuration does not leak to subsequent work; remove the entry when it was originally absent.
PowerShell✓ Tested
Restore the working location after an operation
PowerShell: Push-Location and Pop-Location manage a directory stack; finally ensures restoration.
PowerShell✓ Tested
Restrict a function parameter to known choices
PowerShell: ValidateSet rejects unsupported values before the function body executes.
PowerShell✓ Tested
Return a collection as one pipeline object
PowerShell: The unary comma prevents the returned array from being enumerated at this boundary.
PowerShell✓ Tested
Reverse a copy while preserving the source
PowerShell: Clone the array before using Array.Reverse because Reverse mutates its argument.
PowerShell✓ Tested
Round a decimal with a chosen midpoint rule
PowerShell: Use decimal input and an explicit rounding policy for a reproducible decimal result.
PowerShell✓ Tested
Run a first PowerShell statement
PowerShell: Run a first PowerShell statement using PowerShell 7.
PowerShell✓ Tested
Run an image as a non-root user
Choose an unprivileged numeric identity for the default process.
Dockerfile✓ Tested
Run cleanup after a caught exception
PowerShell: Use finally for cleanup that must occur after either success or failure.
PowerShell✓ Tested
Select elements by an index range
PowerShell: An index range selects the requested array positions in order.
PowerShell✓ Tested
Select object properties
Create a smaller object with only the fields you need.
Select-Object✓ Tested