Skip to content

Instantly share code, notes, and snippets.

View ShilpiMaurya's full-sized avatar


View GitHub Profile

CORS (Cross-Origin Resource Sharing)

  • CORS is a mechanism which uses additional http headers to tell the browser whether a specefic web app can share resource with another web app (only if they have different origin)

  • In same origin can share resources very easily

  • Back then, when CORS was not standardize browser never allow applications to share resources between different origins.

Some examples:


What is a redirect?

  • A url redirect is a process that navigates a user from one url to another
  • Sometimes we need to redirect a user to a different page in our website without them clicking on a link

Types of redirecting :

Redirecting through history api (Client-side redirect)

  • We can use javascript to navigate through the history
//Write a program to find out if two rectangles R1 and R2 are overlapping?
const overlappingRectangle = (

Dear product-owner/scrum-master

I would like to pitch few ideas and suggestions for the home page of the website.

  • I was thinking of splitting home page into two parts.

  • Part one would be like this, more of a welcome page, with your full size picture in it, so that people could feel instantly connected, nice and warm. People should feel like they know the person they are seeking advice from. (from empathy point of view)

Screen Shot 2020-12-17 at 12 53 35

//How to find the maximum occurring character in given String?
const maxOccuringChar = str => {
if (typeof str !== "string" || !str.length) {
return null;
const count = {};
let max = 0;
let maxChar = null;
//Inheritance example in js
class Rectangle {
constructor(length, width) {
this.length = length;
this.width = width;
Area() {
return this.length * this.width;
//In an array 1-100 exactly one number is duplicate how do you find it?
const findOneDuplicateNum = arr => {
if (!Array.isArray(arr) || !arr.length) {
return null;
let count = {};
for (let i = 0; i < arr.length; i++) {
// How do you find the length of the longest substring without repeating
const longestSubstring = str => {
if (typeof str !== "string" || !str.length) {
return null;
const letters = str