FIND YOUR NEXT FEW LINES

Results for “type”

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

218 snippets foundClear filters
jQueryEvents

Mirror input text

Update a result as the user types using a jQuery input event.

jQuery✓ Tested
Docker / ComposeCompose service options

Mount a local input directory with long syntax

Docker / Compose: Long mount syntax makes the bind type and read-only intent explicit.

Docker / Compose✓ Tested
CStructures & function interfaces

Pass a function as a callback

C: A typed function pointer permits behavior to be supplied to another function.

C✓ Tested
PythonFunctions & error handling

Raise and catch a domain-specific exception

Python: Give a validation failure its own exception type so callers can handle it narrowly.

Python✓ Tested
TypeScriptSafe data handling

Read a nested optional value

Avoid dereferencing a missing nested object.

optional chaining✓ Tested
TypeScriptUtilities & async

Read a property with keyof

Keep the key and returned value tied to an object type.

keyof✓ Tested
PythonStructured data & serialization

Read a small INI configuration

Python: Use ConfigParser typed accessors for configuration values stored as text.

Python✓ Tested
TypeScriptCollections & records

Remove duplicate values with a Set

Keep the first occurrence order while deduplicating.

Set✓ Tested
PythonStructured data & serialization

Represent a record with a dataclass

Python: Generate initialization and convert a typed record to a dictionary.

Python✓ Tested
TypeScriptTypes & functions

Return the first item with a generic function

Preserve the element type while allowing empty arrays.

generics✓ Tested
TypeScriptSafe data handling

Safely read a caught error

Check the error type before accessing its message.

unknown✓ Tested
Arduino / CEEPROM & program memory

Store and retrieve a multibyte integer

Arduino / C: put and get copy the bytes of a typed value.

Arduino / C✓ Tested