FIND YOUR NEXT FEW LINES

Results for “New-Item”

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

210 snippets foundClear filters
TypeScriptArray traversal & selection

Check whether any item matches

TypeScript: some stops once a predicate succeeds.

TypeScript✓ Tested
JavaScriptArray traversal & selection

Check whether every item matches

JavaScript: every stops at the first failed predicate and returns true for an empty array.

JavaScript✓ Tested
TypeScriptArray traversal & selection

Check whether every item matches

TypeScript: every stops at the first failed predicate and returns true for an empty array.

TypeScript✓ Tested
GitMerging & replaying changes

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
PowerShellArray operations

Count a result even when it is empty or has one item

PowerShell: Wrap pipeline results in an array subexpression for consistent Count behavior.

PowerShell✓ Tested
PowerShellCollections & objects

Count items by group

Group repeated values and report each count.

Group-Object✓ Tested
CFiles

Count newline characters

Count newline bytes in a C file while retaining EOF as an int.

C✓ Tested
Linux CommandsGetting Started

Count newline-terminated records

Linux Commands: Count newline-terminated records using GNU/Linux commands in an empty practice directory.

Linux Commands✓ Tested
PythonGetting Started

Count the items in a collection

Python: Read the collection’s length instead of hard-coding the loop limit.

Python✓ Tested
C#Getting Started

Count the items in a collection

C#: Read the collection’s length instead of hard-coding the loop limit.

C#✓ Tested
JavaGetting Started

Count the items in a collection

Java: Read the collection’s length instead of hard-coding the loop limit.

Java✓ Tested
JavaScriptGetting Started

Count the items in a collection

JavaScript: Read the collection’s length instead of hard-coding the loop limit.

JavaScript✓ Tested