Results for “du”
Small, practical examples. Search by task or narrow things down below.
Await several independent results
Preserve input order while awaiting multiple promises.
Promise.all✓ Tested
Blink the built-in LED three times
Alternate the built-in LED with a short blocking delay.
blink✓ Tested
Blink without blocking the loop
Use elapsed millis time instead of delay for a repeating action.
millis✓ Tested
Build a URL query string from values
TypeScript: URLSearchParams handles query escaping and repeated parameter appends.
TypeScript✓ Tested
Build an image with a default command
Docker / Compose: Build an image with a default command with a complete introductory Dockerfile.
Docker / Compose✓ Tested
Build an object from key-value entries
TypeScript: Object.fromEntries converts an iterable of pairs into ordinary own properties.
TypeScript✓ Tested
Calculate a least common multiple using a GCD
C: Divide before multiplying to reduce the risk of intermediate overflow.
C✓ Tested
Calculate a page count with ceiling division
TypeScript: Use Math.ceil for a nonnegative item count and a positive page size.
TypeScript✓ Tested
Calculate a simple total
TypeScript: Multiply a unit price by a quantity, then add a delivery fee.
TypeScript✓ Tested
Calculate differences between adjacent readings
TypeScript: Slice off the first value and compare each remaining value with its predecessor.
TypeScript✓ Tested
Calculate integers beyond Number’s precise range
TypeScript: Use BigInt operands together to avoid precision loss.
TypeScript✓ Tested
Call a library function
TypeScript: Use a standard absolute-value function with a small negative number.
TypeScript✓ Tested