In this tutorial, we’ll explore various methods to obtain the current date and time in Node.js applications. Node.js utilizes the JavaScript Date object, which is built-in and requires no additional module imports. We’ll cover how to retrieve the current date, month, year, hour, minutes, and seconds, as well as formatting options like YYYY-MM-DD hh:mm:ss, YYYY-MM-DD, […]
Read MoreHow to Keep Server Processes Running After Closing SSH
We’ve all experienced it: you’ve SSH-ed into a server and started a long-running task. Unexpectedly, it’s taking much longer than anticipated, and now you can’t close your laptop without interrupting the process. Fortunately, there’s a simple solution to close the terminal window without killing the ongoing task. Quick and Easy Method Follow these steps to […]
Read MoreSearch in the Database Without Considering HTML Tags in MySQL
Have you ever needed to search your database for specific text, but HTML tags got in the way? Here’s a nifty MySQL query that solves this problem: This query uses REGEXP_REPLACE to strip out HTML tags before performing the search. Let’s break it down: This approach allows you to search your content as if it […]
Read MoreGet element by XPath: Tutorial for Web Scraping
Introduction to XPath Hey there! Let’s talk about XPath, a powerful tool for web scraping. XPath is a language that helps you navigate through XML and HTML documents. It’s especially useful when you’re using Scrapy, a popular web scraping framework. Why use XPath? The Basics Imagine HTML as a tree. The root isn’t part of […]
Read MoreUnderstanding Global Variables in TypeScript: A Beginner’s Guide
Hey there, fellow TypeScript enthusiasts! Today, I want to share something that often confuses newcomers to TypeScript: working with global variables. Don’t worry, I’ve been there too, and I’m here to help you to make global variables in Node.js using TypeScript and make sure the types are correct. Prerequisites: VSCode and TypeScript should be already installed. Let’s start […]
Read MoreHow to Handle Global Variables in TypeScript
Hey there, fellow developers! Today, I want to share something that tripped me up when I first started using TypeScript: dealing with global variables. Specifically, I’m going to show you how to work with global variables that are defined outside your TypeScript code. Let’s set the scene. Imagine you’re building a web app where you […]
Read MoreUsing relative paths in Vite builds
I have a simple project setup using Vite: I’m using Vite’s default configuration without a custom config file. After building the project, the index.html in the dist folder uses static paths for assets: This also affects url() paths in CSS, converting them to static paths. I want Vite to output relative paths instead, like this: […]
Read MoreCSS Viewport Units: vh, vw, vmin, and vmax
In this article, we’ll look in detail at four handy length units that are relative to the browser viewport: vh, vw, vmin and vmax. These are truly “responsive length units” in the sense that their value changes every time the browser resizes, and they introduce incredibly useful options for sizing elements in CSS.
Read More