How to resize image and keep aspect ratio in SwiftUI

By understanding the different content modes and how to use custom aspect ratios, you can ensure your images look great on all devices and screen orientations.

Dec 03, 2023#swiftui#images

How to convert an object to an array in JavaScript

Whether you need to extract keys, values, or key-value pairs, Object.keys(), Object.values(), and Object.entries(), each serving a unique purpose in converting objects into arrays.

How to run shell commands in Node.js

Running shell commands allows you to script and automate various processes, interact with system-level commands or utilities that are available in the shell.

Nov 30, 2023#node#scripts

How to compare two strings in Swift

One of the basic operations in Swift is to compare two strings for equality or order. There are different ways to do that, depending on your needs.

Nov 28, 2023#swift#strings

Check if object property is undefined in JavaScript

There is no definitive answer to when you should check if an object property is null, undefined, or exists, as it depends on the context and the purpose of your code.

How to clone an object in JavaScript

Cloning an object is harder than you think as you have to handle reference types, circular references, functions, special objects, hidden properties.

Capitalize the first letter of a string in JavaScript

JavaScript provides several approaches to achieve this, ranging from basic techniques to more advanced methods involving functions or regular expressions.

How to use global variables in JavaScript

You can use global variables across multiple files by attaching them to the global object or by using a module system to import and export variables between files.

How to create a sleep or delay in Node.js

A sleep or delay function is a programming feature that allows you to pause the execution of a program or a specific part of a program for a specified amount of time.

Difference between tuples and arrays in TypeScript

Tuples can store only a fixed number of elements and types at each index, while arrays can store any combination of types and the order is not important.