Skip to content

Instantly share code, notes, and snippets.

View bkanhu's full-sized avatar

B Kanhu Charan bkanhu

View GitHub Profile
@bkanhu
bkanhu / JavaScript.md
Last active December 31, 2021 10:07
JavaScript Zero to Hero

JavaScript Zero to Hero

If I were to restart Javascript again from scratch then I will follow this roadmap.

JavaScript basic steps:

  • What is JavaScript?
  • Declaring JavaScript Variables: var, let, and const
  • Basic math in JavaScript — Numbers and operators
  • JavaScript syntax
  • ES6 let VS const variables Var, Let, and Const - freeCodeCamp
@bkanhu
bkanhu / REGEX.md
Last active January 28, 2025 20:28
REGEX

INDIAN PIN CODE:

/^[1-9][0-9]{5}$/

Here's what this regex means:

  • ^: This anchor matches the start of the string.
  • [1-9]: This character set matches any digit from 1 to 9 (the first digit of the PIN code cannot be 0).
  • [0-9]{5}: This character set matches any five digits from 0 to 9 (the remaining digits of the PIN code).
  • $: This anchor matches the end of the string. Put together, this regular expression matches any six-digit string that starts with a digit from 1 to 9 and ends with five digits from 0 to 9, which is the format of a valid Indian PIN code.
@bkanhu
bkanhu / Cloudinary-MongoDB-upload.md
Created July 4, 2023 17:31
Upload product data to MongoDB and images to Cloudinary in a MERN stack application.

To upload product data to MongoDB and images to Cloudinary in a MERN stack application, you can follow these steps:

  1. Set up your MongoDB and Cloudinary accounts: Ensure that you have created accounts and obtained the necessary credentials for both MongoDB and Cloudinary.

  2. Set up the server-side (Node.js) code:

  • Create an Express server to handle API requests.
  • Install the necessary dependencies: express, mongoose, multer, cloudinary.
  • Create a schema for your product in a Product.js file, using Mongoose:
const mongoose = require('mongoose');
@bkanhu
bkanhu / README.md
Last active October 24, 2024 06:57
NodeJS Backend production issues and fixes.

Production Bugs and Fixes

1. Avoid Using Nodemon in Production

Do not use Nodemon in the production environment as it is intended for development purposes only.

2. Configure PM2 with Ignore Paths

When running the backend using the Process Manager (PM2), ensure that all folder names are included as values of the ignore_path property in the ecosystem.config.js file.

@bkanhu
bkanhu / FilterPanel.jsx
Created June 10, 2025 19:00
NextJS Filter component with SearchParams and Custom Hooks.
"use client";
import { useRouter, useSearchParams } from "next/navigation";
import React from "react";
const FilterPanel = () => {
const router = useRouter();
const searchParams = useSearchParams();
const handleFilterChange = (e) => {
const params = new URLSearchParams(searchParams.toString());