Recently at work, We were looking for a way to generate unique IDs across a distributed system that could also be used as the primary keys in the MySQL tables.

We knew in a single MySQL database we can simply use an auto-increment ID as the primary key, But this won’t work in a sharded MySQL database.

So I looked at various existing solutions for this and finally learned about Twitter Snowflake — a simple 64-bit unique ID generator.

Why don’t you use UUID? 🤔

UUIDs are 128-bit hexadecimal numbers that are globally unique. The chances of the same UUID getting generated twice are negligible.


myth busting mathematics

Sum of all positive integers

What is 1+2? Ah, who doesn’t know, it’s 3. What is 1+2+3? Well, it’s 6. (easy peasy lemon squeezy)

Now, what if I asked you to count the sum of all positive integers which is: 1+2+3+4…to infinity?

That’s it. This is the crux of this blog post.

Wait a minute, what?

All positive numbers when add up together should be infinite, right?

But now what if I tell you, there is a definite answer for this and it’s not something indefinite like infinity.

It has a fixed value assigned to it🤯

In this blog post, I am going to give…

In this article, I’ll share 10 JavaScript tips, tricks, and best practices that I follow and found useful.

1. Use Numeric Separators

This is one of the most used operators when I have to deal with large numbers. When using a separator (with just an _) in number it looks better than an unseparated number.

For example:

let number = 98234567

to ⬇

let number = 98_234_567

And it works for any other numeric base as well:

const binary = 0b1000_0101;
const hex = 0x12_34_56_78;

Few caveats :

  • More than one underscore in a row is not allowed let num= 100__00
  • Can not be…

❓ Did you know you can’t name a file “Con” in Windows

If you’re running a Windows machine, try it right now. Go to File Explorer -> create a new folder -> name it “Con”

Did it work? Now try with “PRN”, “AUX” or “NUL”. What did you get?

Probably this ⬇

In this article, we will see what’s the difference between a Nullish Coalescing Operator (??) and a Logical OR (||)

But before going further, let us refresh ourselves with one very common concept in Javascript which is, what are the truthy/falsy values.

In JavaScript, there are 6 values that are considered to be falsy:

  • undefined
  • null
  • NaN
  • 0
  • “” (empty string)
  • false

All other JavaScript values will produce true and are thus considered truthy.

Here are few examples 👇

const value1 = 1;
const value2 = 2;
const result = value1 || value2;console.log(result); // 1

Both value1 and value2…

What is the most famous interview question?

FizzBuzz is the most popular coding problem, and perhaps also one of the easiest.

For those of you who don’t know, here’s the problem statement :

Write a short program that prints each number from 1 to 100 on a new line. For each multiple of 3, print “Fizz” instead of the number. For each multiple of 5, print “Buzz” instead of the number. For numbers that are multiples of both 3 and 5, print “FizzBuzz” instead of the number.

Recently, Digital collectibles have exploded in popularity because of NFTs. You’ve probably seen people in your social media feeds talking about NFTs too.

The growing market for NFT is turning the art, music, gaming, and finance industries upside down.

NFTs can be confusing to understand for someone who is hearing it for the first time.

So today let’s unwrap what is NFT and why suddenly it is becoming the next big thing on the Internet.

We will be running through everything you need to know about them.🙂

What the heck is NFT?

You’re probably familiar with this famous tweet by Jack Dorsey, the billionaire co-founder…

Github Chrome Extensions

As a developer, we use GitHub every day and it is already a great tool, but what if we can make it even better with some chrome extensions!

Let’s have a look at some of them 🔽

1. Octotree

It enhances GitHub code review and exploration with features like:

  • IDE-like code tree
  • Folder and file search
  • Issues and Pull Request bookmarking
  • Support for private repositories

I like this extension very much! It lets you explore the files and folders of a repository with a tree like structure.


Learning web development is like learning to drive a car. No matter how much you do not enjoy it, learning these skills sometimes can help you a lot and can even act as a great skill to put on your resume.

It’s been over 3 years since I last touched anything related to HTML, CSS, or any Javascript front-end framework but recently I happen to come across all of them at once.

I needed to create some landing pages, custom logos, and mockups.

So I decided to go through all these technologies once again and during that process, I found…


This is just a small post to let you know, where you all can find me apart from “medium”

Feel free to @ me on any of these platforms 😀

Apoorv Tyagi

Fledgling software developer. I write about algorithmic solutions for software engineering problems (May also include machine learning & blockchain)

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store