Results for “script”
Small, practical examples. Search by task or narrow things down below.
Return the first item with a generic function
Preserve the element type while allowing empty arrays.
generics✓ Tested
Return typed data from an async function
Await a Promise and handle failures explicitly.
async✓ Tested
Safely read a caught error
Check the error type before accessing its message.
unknown✓ Tested
Select fields with the Pick utility type
Expose a smaller view of a larger object type.
Pick✓ Tested
Serialize nested objects with an explicit depth
PowerShell: Select a sufficient depth so nested data is retained instead of converted into a descriptive string.
PowerShell✓ Tested
Set the open-file limit for a process
Docker / Compose: The nofile ulimit sets soft and hard file descriptor limits.
Docker / Compose✓ Tested
Split a line into named fields
Read a simple delimiter-separated line into variables.
read✓ Tested
Start a disclosure open while keeping it collapsible
HTML: The open attribute sets the initial details state without JavaScript.
HTML✓ Tested
Store a value in a named variable
Python: Give a value a descriptive name and print it.
Python✓ Tested
Store a value in a named variable
C#: Give a value a descriptive name and print it.
C#✓ Tested
Store a value in a named variable
Java: Give a value a descriptive name and print it.
Java✓ Tested
Store a value in a named variable
C++: Give a value a descriptive name and print it.
C++✓ Tested