FIND YOUR NEXT FEW LINES

Results for “Functions & data types”

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

787 snippets foundClear filters
TypeScriptArray traversal & selection

Copy a range without changing the source

TypeScript: Array.slice returns a shallow copy of the selected half-open range.

TypeScript✓ Tested
TypeScriptUTC date operations

Count days between UTC-midnight dates

TypeScript: A day is exactly 86400000 milliseconds for these explicitly UTC-midnight inputs.

TypeScript✓ Tested
TypeScriptGetting Started

Count the items in a collection

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

TypeScript✓ Tested
TypeScriptText handling & Unicode

Count Unicode code points in a string

TypeScript: String iteration combines surrogate pairs, unlike the UTF-16 length property.

TypeScript✓ Tested
C#Types & reliable control flow

Create a modified copy of an immutable record

C#: A with expression creates a shallow copy with selected changed properties.

C#✓ Tested
Docker / ComposeNetworks & volume metadata

Create a network marked for internal connectivity

Docker / Compose: The internal option disables normal external routing for that network.

Docker / Compose✓ Tested
SQLiteTables & writes

Create a STRICT table

Require values compatible with declared column types.

STRICT✓ Tested
JavaFile operations & binary data

Create and clean up a temporary file

Java: Create a unique file and remove it in finally even when the operation fails.

Java✓ Tested
TypeScriptArray restructuring

Create independent rows in a matrix

TypeScript: Use a mapping function to create each row instead of sharing one array with fill.

TypeScript✓ Tested
Docker / ComposeCompose applications

Declare a named volume in Compose

Mount persistent storage at a service path.

Compose✓ Tested
HTMLMetadata & document links

Declare a preferred canonical URL

HTML: A canonical link identifies the preferred public URL for duplicate representations of a document.

HTML✓ Tested
HTMLMetadata & document links

Declare an indexing preference for a draft page

HTML: A robots meta element can request noindex while allowing link following.

HTML✓ Tested