I have (again) an indiscreet question: what do your dependency injections look like in your Node apps? Have you ever taken the time to think about this topic? Are you the kind of dev who simply relies on ECMAScript modules to import and export functions and underlying logic across the whole application? Randomly passing data… Continue reading Node Dependency Injection.
Tag: javascript
Understanding JavaScript Execution with some Pizza
Welcome back, fellow developers! I’m excited to have you here for the next part of our JavaScript deep-dive series. The previous article explored the fundamental concepts and core features that make JavaScript a powerful language. Don’t worry if you missed it – you can catch up here. I was all set to explore JavaScript code execution.… Continue reading Understanding JavaScript Execution with some Pizza
Callbacks vs Promises vs Async/Await: The Ultimate Guide to Asynchronous Javascript
What are callbacks? A callback is a function passed as an argument to another function, which is then executed later (synchronously or asynchronously). Callbacks are fundamental in JavaScript for handling asynchronous operations, event listeners, and functional programming. Sample codes Basic example function saveOrder(orderId, userMail, callback) { const order = { orderId, userMail } scrib.show(order) callback(userMail);… Continue reading Callbacks vs Promises vs Async/Await: The Ultimate Guide to Asynchronous Javascript
Top 5 Node.js Design Patterns for Scalable Application
Node.js is a powerhouse for building scalable applications, but writing efficient and maintainable code requires more than just asynchronous magic. To truly level up, you need design patterns — proven solutions to common software architecture challenges. Whether you’re working on a microservices system, an API backend, or a real-time application, using the right design patterns will make… Continue reading Top 5 Node.js Design Patterns for Scalable Application
Promise.all(), Promise.any(), and More: Handling Multiple Promises in JavaScript
Promise Let’s have an overview of Promise first. In JavaScript, Promise is used to perform asynchronous operations. It’s an object that contains a status & represents the eventual completion (or failure) of an asynchronous operation and its resulting value. For example, uploading an image to the server is an asynchronous operation. When the image upload process is done, it can return… Continue reading Promise.all(), Promise.any(), and More: Handling Multiple Promises in JavaScript
Color management in three.js
Definitions Linear-sRGB / THREE.LinearEncoding: Linear transfer functions, Rec. 709 primaries, D65 white point. sRGB / THREE.sRGBEncoding: sRGB transfer functions, Rec. 709 primaries, D65 white point. Best practices Textures with color data (.map, .emissiveMap, …) should be configured with .encoding = sRGBEncoding. Non-color textures use LinearEncoding. Exceptions exist for some formats (like OpenEXR), which typically use LinearEncoding for color data. Vertex colors should… Continue reading Color management in three.js
Earcut
An implementation of the earcut polygon triangulation algorithm. The code is a port of mapbox/earcut. Methods .triangulate ( data, holeIndices, dim ) : Array data — A flat array of vertex coordinates. holeIndices — An array of hole indices if any. dim — The number of coordinates per vertex in the input array. Triangulates the given shape definition… Continue reading Earcut
Retrieve only the child subsidiary name from the Subsidiary field using a search.
result.getText({ name: ‘subsidiary’ }).split(‘:’).pop().trim() || “” result.getText({ name: ‘subsidiary’ }) Retrieves the text representation of the subsidiary field from the search result. In NetSuite, getText is used to fetch the displayed text instead of the internal ID. .split(‘:’) Splits the retrieved text by the colon (:) separator. Some NetSuite fields (like subsidiary) can return values… Continue reading Retrieve only the child subsidiary name from the Subsidiary field using a search.
Capitalizing Strings in JavaScript
/** * @description Capitalizes the first letter of a given string * @param {string} str – The string to capitalize * @returns {string|boolean} – Capitalized string or false if invalid */ function capitalizeFirstLetter(str) { if (typeof str !== “string” || str.length === 0) return false; return str.charAt(0).toUpperCase() + str.slice(1);… Continue reading Capitalizing Strings in JavaScript
Rounding Numbers in JavaScript
/** * @description Rounds a number to the specified decimal places * @param {number} num – The number to round * @param {number} decimals – Number of decimal places * @returns {number|boolean} – Rounded number or false if invalid */ function roundToDecimals(num, decimals) { if (typeof num !== “number” || typeof decimals !==… Continue reading Rounding Numbers in JavaScript