Skip to content

Instantly share code, notes, and snippets.

View Shaxadhere's full-sized avatar
my apps fast like a lightning of a thunder

Shehzad Ahmed Shaxadhere

my apps fast like a lightning of a thunder
View GitHub Profile
import React, { useState } from "react";
import {
Flex,
Box,
Text,
IconButton,
Icon,
SimpleGrid,
VStack,
} from "@chakra-ui/react";
image: node:18
pipelines:
branches:
release/prod:
- step:
deployment: production
name: Build and Deploy to Azure Blob Storage
caches:
- node
const handleQueryChange = (updatedQuery) => {
setQuery({ ...query, ...updatedQuery })
}
const debounceFn = useCallback(_.debounce(handleQueryChange, 500), []);
function copyStyledText(elementId) {
// Step 1: Identify the element
const element = document.getElementById(elementId);
if (element) {
// Step 2: Get the text content
const text = element.textContent;
// Step 3: Create a temporary element
const tempElement = document.createElement('div');
@Shaxadhere
Shaxadhere / ImageSequence.jsx
Last active May 15, 2023 08:50
animate image sequence via scroll
import { CSSProperties } from "react";
import { clamp, MotionValue, useMotionValueEvent } from "framer-motion";
import React, { useEffect, useRef } from "react";
interface ImageSequenceProps {
progress: MotionValue<number>;
images: string[];
height: number;
width: number;
style?: CSSProperties;
@Shaxadhere
Shaxadhere / trapping_water.js
Created March 6, 2023 14:04
this is my attempt to solve trapping water with javascript, but it fails at 319th test case, saved this just in case i feel about improving the solution later.
/**
* @param {number[]} height
* @return {number}
*/
var trap = function (height) {
function measureWater(currentValue, prevItems, nextItems) {
const lastPrev = isFinite(Math.max(...prevItems)) ? Math.max(...prevItems) : 0
//Define lists of words and symbols to filter out
//Numbers and similar
var stopwordnumbers = [“once”, “twice”, “thrice”, “first”, “second”, “third”, “fourth”, “fifth”, “sixth”, “seventh”, “nineth”, “tenth”, “1”, “2”, “3”, “4”, “5”, “6”, “7”, “8”, “9”, “0”, “one”, “two”, “three”, “four”, “five”, “six”, “seven”, “eight”, “nine”, “ten”, , “eleven”, “twelve”, “thirteen”, “fourteen”, “fifteen”, “sixteen”, “seventeen”, “eighteen”, “tweenty”, “thirty”, “fourty”, “fifty”, “sixty”, “seventy”, “eighty”, “ninety”, “hundred”, “hundreds”, “and”, “-”, “thousand”, “thousands”, “million”, “millions”, “billion”, “billions” ];
//Symbols
var stopwordsymbols = [“+”,”-”,”*”,”%”,”/”,”?”,”!”,”^”,”’”,”\””,”,”,”;”,”\\”,”.”]
//Very short words and others, compiled by me from several resources including https://github.com/Yoast/YoastSEO.js/blob/develop/src/config/stopwords.js and https://gist.github.com/sebleier/554280
var stopwordsmin3=["if", "or", "in", “a”,”an”,”cool”,”good”,”yep”,”yeah”,”but”,”yes”,”no”,”nop”,”nope”,”sth”,”somethi
@Shaxadhere
Shaxadhere / babel.config.js
Created January 18, 2023 14:30
remove console logs on production in react
module.exports = api => {
const babelEnv = api.env();
const plugins = [];
if (babelEnv !== 'development') {
plugins.push('transform-remove-console');
}
return {
presets: ['module:metro-react-native-babel-preset'],
plugins,
};
let link = document.querySelector("link[rel*='icon']") || document.createElement('link');
link.type = 'image/x-icon';
link.rel = 'shortcut icon';
link.href = msgRecivedIcon; //imported icon
document.getElementsByTagName('head')[0].appendChild(link);
@Shaxadhere
Shaxadhere / deployReactAppToCpanel.yml
Last active August 21, 2023 08:14
Deployment pipeline for react app to be deployed on cpanel via github actions, ftp and action secrets.
name: 🚀 Deploy File to cPanel
on:
push:
branches:
- master
jobs:
FTP-Deploy-Action:
name: 🎉 Deploy
runs-on: ubuntu-latest