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)})`;
@tamalCodes
tamalCodes / Interviews.md
Last active December 29, 2022 20:29
This is a gist containing some helpful resources for interviews !

What is this ? πŸ€”

These are some links which can help you for the next interview. TBH i have checked out the Frontend Interview Handbook and Tech Interview Handbook too. All of these are quite popular. So thought of sharing !

Links to the github repos πŸ”—

  • Coding Interview University: A complete computer science study plan to become a software engineer : Link to repo

  • Frontend Interview Handbook: Front End interview preparation materials for busy engineers. : Link to repo

@kumarsonsoff3
kumarsonsoff3 / package-lock.md
Last active March 5, 2025 11:51
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) {
@gaearon
gaearon / minification.md
Last active January 28, 2025 19:19
How to Set Up Minification

In production, it is recommended to minify any JavaScript code that is included with your application. Minification can help your website load several times faster, especially as the size of your JavaScript source code grows.

Here's one way to set it up:

  1. Install Node.js
  2. Run npm init -y in your project folder (don't skip this step!)
  3. Run npm install terser

Now, to minify a file called like_button.js, run in the terminal: