FIND YOUR NEXT FEW LINES

Results for “one-off”

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

621 snippets foundClear filters
PythonDates & time zones

Find the number of days in a month

Python: Use calendar.monthrange to account for leap years.

Python✓ Tested
ReactComponents & props

Forward input props to a reusable field

Forward input props to a reusable field with a small React component and explicit browser behavior.

React✓ Tested
JavaDates & time zones

Generate a half-open range of dates

Java: datesUntil includes the starting date and excludes the end date.

Java✓ Tested
JavaScriptRegular expressions & URL encoding

Inspect the parsed pieces of a URL

JavaScript: Use URL properties rather than splitting a URL at punctuation.

JavaScript✓ Tested
TypeScriptRegular expressions & URL encoding

Inspect the parsed pieces of a URL

TypeScript: Use URL properties rather than splitting a URL at punctuation.

TypeScript✓ Tested
JavaDates & time zones

Measure a duration between instants

Java: Use Duration for elapsed timeline time and retrieve total seconds.

Java✓ Tested
AngularComponents & communication

Normalize an input with a transform

Normalize an input with a transform with a standalone Angular component and explicit browser behavior.

Angular✓ Tested
ReactComponents & props

Notify a parent with a callback prop

Notify a parent with a callback prop with a small React component and explicit browser behavior.

React✓ Tested
SQL ServerSelect & page

Page an ordered result

Skip rows and fetch a bounded page.

OFFSET✓ Tested
JavaDates & time zones

Parse a date with an explicit input pattern

Java: Use DateTimeFormatter for a non-ISO date representation.

Java✓ Tested
PythonDates & time zones

Parse an ISO calendar date

Python: Use date.fromisoformat and inspect the calendar components.

Python✓ Tested
ReactComponents & props

Pass an input ref as a React 19 prop

Pass an input ref as a React 19 prop with a small React component and explicit browser behavior.

React✓ Tested