FIND YOUR NEXT FEW LINES

Results for “new”

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

88 snippets foundClear filters
GitRestoring & revising local work

Correct the latest unpublished commit message

Git: Amend replaces the current commit while preserving its tree when no new changes are staged.

Git✓ Tested
Linux CommandsText processing

Count lines in a file

Count newline characters in a text file, printing only the count without the filename.

lines✓ Tested
C#Collections

Count words with GroupBy

Group repeated C# words and print ordered counts.

C#✓ Tested
C#File operations & paths

Create a file only when it does not exist

C#: FileMode.CreateNew prevents accidental replacement of existing content.

C#✓ Tested
GitBranches & recovery

Create and switch to a branch

Start an isolated feature branch from the current commit.

switch✓ Tested
C#Files & paths

Create nested directories

Create a directory tree using the .NET Directory API.

C#✓ Tested
PythonCollections

Filter a list with a condition

Build a new list containing only the values that satisfy a condition using a list comprehension.

list✓ Tested
TypeScriptCollections & records

Filter and transform an array

Keep active objects and extract their names.

filter✓ Tested
C#Collections

Filter even numbers

Use LINQ Where to keep even C# values.

C#✓ Tested
C#Strings

Find text ignoring case

Use ordinal case-insensitive comparison for a C# substring search.

C#✓ Tested
JavaScriptArray restructuring

Flatten a single nesting level

JavaScript: flat defaults to a depth of one and creates a new array.

JavaScript✓ Tested
TypeScriptArray restructuring

Flatten a single nesting level

TypeScript: flat defaults to a depth of one and creates a new array.

TypeScript✓ Tested