How to capitalize each word of a string in TypeScript

In the world of web development and application design, small details can make a big difference. One such detail is the proper capitalization of text, especially when dealing with user-generated content or dynamic data. Ensuring that text appears neat and consistent can significantly enhance the user experience. In this blog post, we’ll introduce you to a handy utility function called capitalizeEachWord that can help you achieve just that. What is capitalizeEachWord? The capitalizeEachWord function is a TypeScript utility that capitalizes the first letter of each word in a given string while keeping the rest of the letters in lowercase. This function also allows you to specify a word separator, which can be useful when dealing with text containing multiple words separated by a character or whitespace. ...

How to bump version number on Git push for projects using npm

Note: This works only from command line as user feedback is needed from keyboard to know which part of the version number to bump. It should not break pushing from a GUI tool (e.g. TortoiseGit), but you will not be prompted to update the version number. The positive thing is that the version change is done neatly as a separate commit. Install husky as dev-dependency See instructions. Add the following script into new file .husky/pre-push ...

How to collect all npm licenses from multiple subdirectories with Powershell

Install license-report (https://www.npmjs.com/package/license-report) npm install -g license-report run the script Get-ChildItem -Directory | foreach { $_ >> ./licenses.csv ; license-report --output=csv --only=prod --package=./$_/package.json >> ./licenses.csv } You can use the same idea to run other stuff in subdirectories. Just replace the command. Here is an example of git pull. Get-ChildItem -Directory -Force -Recurse *.git | ForEach-Object { cd $_.Parent.FullName; Write-Host $_.Parent.FullName; git pull }

How to update a specified item in a nested array with Mongoose

In this blog post, we’ll go over how to update a specified item in a nested array inside a Mongoose document. ##Setting up the environment First, let’s set up the environment by creating a Mongoose schema and model. Here’s an example schema that has a nested array of items: const mongoose = require('mongoose'); const schema = new mongoose.Schema({ items: [{ name: String, quantity: Number }] }); const Model = mongoose.model('Model', schema); ##Updating a specified item in a nested array ...

How to Set Up a Codeserver on Synology NAS

Have you ever missed the VSCode on your tablet? Now there is a solution: run the VSCode on your NAS at home and access it with a browser. That will be possible when you run the Codeserver Docker container on your NAS. Before you do this, you probably want to set up a wildcard certificate and a proxy server on your NAS. That will enable you to access the NAS outside your local network using HTTPS. How to do it, check this: How to Set Up Wildcard Certificate and Reverse Proxy on Synology NAS ...