FIND YOUR NEXT FEW LINES

Results for “New-Item”

Small, practical examples. Search by task or narrow things down below.

210 snippets foundClear filters
PythonIteration & sequences

Flatten one level of nested lists

Python: Use a nested comprehension when each input item is itself an iterable.

Python✓ Tested
C#Data & dates

Format a decimal amount

Use invariant culture to print a C# decimal with two places.

C#✓ Tested
GitStashing selected work

Include untracked files in a stash

Git: The include-untracked option saves new files along with tracked edits.

Git✓ Tested
JavaQueues & collection operations

Initialize a map entry only when absent

Java: Use computeIfAbsent when creating a collection for a new key.

Java✓ Tested
GitBranches & ancestry

Inspect a revision with detached HEAD

Git: Detached mode is useful for inspection; create a branch before keeping new work.

Git✓ Tested
PythonStrings & dates

Join strings with a separator

Combine a list of strings into one readable string with a separator between each item.

string✓ Tested
C#Files & paths

List matching files

Enumerate immediate text files and sort their names in C#.

C#✓ Tested
C#Collections

Look up a dictionary value

Use TryGetValue for a C# dictionary lookup with a fallback.

C#✓ Tested
PythonCollections

Merge two dictionaries

Combine two dictionaries into a new dictionary. When a key appears in both inputs, the value from the second dictionary wins.

dictionary✓ Tested
PowerShellFile operations & integrity

Move a file into another directory

PowerShell: Move-Item transfers an existing file to the chosen destination directory.

PowerShell✓ Tested
Bash ScriptsInput streams & redirection

Pass a variable to standard input

Bash Scripts: A here-string supplies the expanded value followed by a newline.

Bash Scripts✓ Tested
CSSType & reading flow

Preserve line breaks while collapsing repeated spaces

CSS: Pre-line retains newlines but does not preserve all whitespace like pre-wrap does.

CSS✓ Tested