Skip to content

Instantly share code, notes, and snippets.

View kaleem-elahi's full-sized avatar
🌍
Remote Frontend Engineer

Kaleem Elahi Shaikh kaleem-elahi

🌍
Remote Frontend Engineer
View GitHub Profile
@kaleem-elahi
kaleem-elahi / mac_setup.sh
Created October 15, 2021 17:19
mac_setup.sh
#Install oh-my-zsh
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
#Install Xcode command line tools
read -rep "Installing Developer Tools, Press any key to continue..." -n1 -s
xcode-select --install
#Install homebrew
read -rep "Installing Homebrew, Press any key to continue..." -n1 -s
@kaleem-elahi
kaleem-elahi / gist:48cc0403c04f20e45498de38b0dfbc2d
Created August 24, 2021 12:14
Interview Question for Anagram
// Coding Questions, and Instructions
// * Please author your code as if it is intended to be shipped to production.
// The details matter. Code will be evaluated on its correctness, simplicity,
// idiomaticity, completeness, and test coverage.
// * Code should be written in JavaScript/NodeJS. You can use a testing
@kaleem-elahi
kaleem-elahi / getRandomIntInRange.js
Created June 17, 2021 07:33
how to get a Random number in a Range of Values
const getRandomIntInRange = (min, max) => Math.floor(Math.random() * (max-min +1)) + min;
// 3 examples added to show how to use it:
/*
getRandomIntInRange(1, 5);
Output: 1
@kaleem-elahi
kaleem-elahi / passwordStrength.js
Created October 29, 2020 16:52
Password strength check (javascript)
export function passwordStrength(value) {
let text;
let strengthClass;
if (
value.length >= 8 &&
/[A-Z]/.test(value) &&
/[a-z]/.test(value) &&
/[0-9]/.test(value) &&
/[!@#$%^&*()_+\-=[\]{};':"\\|,.<>/?]/.test(value)
) {
@kaleem-elahi
kaleem-elahi / seating-table-raphael.js
Created February 20, 2020 11:38
creating seating table with top, left, bottom, left.
const paper = Raphael(0, 0, 3200, 3200);
const topSeatSet = paper.set();
Raphael.fn.seatingTable = {
generateHorizontally: function (x, y, count, space) {
const circleSet = paper.set();
let s = space;
@kaleem-elahi
kaleem-elahi / generate-arrays-by-values.js
Last active February 20, 2020 07:53
generate number by Values and alphabets by counts
/**
*
* Author : Kaleem Elahi Shaikh
* Email: [email protected]
*
* /
/**
{
"chart": {
"id": 1,
"name": "Yapsody Theatre",
"row_chair_spacing": 4,
"row_spacing": 8,
"section_floors": [{
"focal_points": {
"x": 1067.5,
"y": 1915
/**
* Author: kailash kumar
* define seating chart
*/
import {
Raphael,
Paper,
Set,
Circle,
Ellipse,
@kaleem-elahi
kaleem-elahi / DraggableWrapperHOC.jsx
Created January 31, 2020 09:34
Draggable Wrapper HOC react
import React, { Component } from 'react';
import ReactDOM from 'react-dom';
import PropTypes from 'prop-types';
import './DraggableWrapperHOC.css';
const DraggableWrapperHOC = (WrappedComponent) => {
return class DraggableWrapperHOC extends Component {
constructor(props) {
super(props);
@kaleem-elahi
kaleem-elahi / isElementInViewport.js
Last active October 10, 2019 12:30
Check if Element is visible in Viewport
export const isElementInViewport = (el) => {
var rect = el.getBoundingClientRect();
return rect.bottom > 0 &&
rect.right > 0 &&
rect.left < (window.innerWidth || document.documentElement.clientWidth) /* or $(window).width() */ &&
rect.top < (window.innerHeight || document.documentElement.clientHeight) /* or $(window).height() */;
}