Skip to content

Dev#

pnpm - a fast disk space efficient package manager

I came across into a scenario where I have multiple Node.js projects or directories and turns out that it has its own copies of node_modules for each folder which accumulates large sizes on disk.

Learning about pnpm package manager made me realize that it is fast as it reuses packages already installed instead of creating another copy of the package which adds space in disk.

structuredClone() a deep copy of the original value

Is a method of that creates deep clone of a given object (includes nested fields).

This is useful when its tedious to use the spread operator { ...obj } on a deeply nested object.

The purpose of cloning is that you would not have to accidentally mutate the original.

TOTP Algorithm

I was using Microsoft Authenticator app and got surprised that it was working offline! At this moment, I got curious how time-based OTP works and later found out that the same algorithm works for other authenticator apps such as Google Authenticator and Duo Mobile and more.

Learning the algorithm with Node.js and JavaScript requires you to have at least prior knowledge on the following: Base 32 encoding, Binary Numbers, Bitwise Operators and Node.js Buffer.

Binary Numbers

Know more about binary numbers and how computers actually works by playing around with numbers and hexadecimal values.

This post will help you realize and understand more about what is Base 2, Base 10, Base 16 and how to manually compute and convert each value between binary, and decimal.

Bitwise Operators

Before you proceed, you should have a better understanding about Binary Numbers. See this blog post to learn more.

Bitwise operators is best suited when dealing with binary values and writing algorithms for encoding/encryption.

Base 32 Encoding

Using JavaScript/Typescript and Node.js to understand the basics on how Base32 encoding and decoding works that follows the RFC 4648 standard format.

This may be a good exercise for your programming language when you want to play around with encoding and binary data.

Buffer class in Node.js

Wander into Node.js built-in class Buffer and explore the world of binary data, and play around the equivalent conversion between hexadecimal, decimal, plus other characters at easy level.

💻 01001001 01010101

Charge Battle Royale

Charge Battle Royale

QR code - Charge Battle Royale

Introduction

Since my previous projects with real time interaction between players, my team is enjoying using it to have fun with friends and colleagues.

However, they are now asking me if I could think of something that allow them to interact all at the same time. It means that there will be no more "2-player game only" but rather multi-player.