Skip to content

Instantly share code, notes, and snippets.

View kumarsonsoff3's full-sized avatar
🎯
Focusing

Priyanshu kumawat kumarsonsoff3

🎯
Focusing
View GitHub Profile
const randomInt = (min, max) => Math.floor(Math.random() * (max - min) + min);
const randomColor = () =>
`rgb(${randomInt(0, 255)}, ${randomInt(0, 255)}, ${randomInt(0, 255)})`;
@kumarsonsoff3
kumarsonsoff3 / package-lock.md
Last active September 14, 2023 05:23
Explained the easiest ways to revert the changes in package-lock.json file! This Gist is specially created for the contributors for the EddieHub LinkFree Project!

While contributing to open-source, we often encounter an issue that leads to changes in the package-lock.json file, and maintainer or the owners of the repository may ask you to Revert those changes in the package-lock.json file while reviewing your PR.

Eventhough you've not committed anything in your package-lock.json file, but since you run NPM when you start, it automatically updates the package version to the latest. It then sometimes leads to conflicts with the main branch, or distrubs the workflows in somecases!

Remember to only commit the file you're making changes in!

How to revert those?

Method - 1 (Click Here to view a video demo)

  • Go to Files changed section in your PR image
@kumarsonsoff3
kumarsonsoff3 / randomNumber.js
Last active May 8, 2022 07:39
Generate a Random integer with Recursion
// Normally this could be used for Random number generation
function getRandomArbitrary(min, max) {
return Math.trunc(Math.random() * (max - min) + min);
}
// The idea is to recursive-ise this so that a running total of the number of max hits is stored, combined, and then returned.
// To do this recursively is simple, just call the method from itself:
function generateNumber(max, min) {