Skip to content

Instantly share code, notes, and snippets.

View Shaxadhere's full-sized avatar
🎯
Focusing

Shehzad Ahmed Shaxadhere

🎯
Focusing
View GitHub Profile
@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,
};
//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 / 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
@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;
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');
const handleQueryChange = (updatedQuery) => {
setQuery({ ...query, ...updatedQuery })
}
const debounceFn = useCallback(_.debounce(handleQueryChange, 500), []);
image: node:18
pipelines:
branches:
release/prod:
- step:
deployment: production
name: Build and Deploy to Azure Blob Storage
caches:
- node
import React, { useState } from "react";
import {
Flex,
Box,
Text,
IconButton,
Icon,
SimpleGrid,
VStack,
} from "@chakra-ui/react";
<?php
// error_reporting(E_ALL);
// ini_set('display_errors', 1);
set_time_limit(30); // Increase timeout to 30 seconds
// Include PHPMailer files manually
// Download these from https://github.com/phpmailer/phpmailer/releases version 6.9.3
require '../assets/phpmailer/src/PHPMailer.php'; // Path to the PHPMailer class
require '../assets/phpmailer/src/Exception.php'; // Path to the Exception class
require '../assets/phpmailer/src/SMTP.php'; // Path to the SMTP class