Skip to content

Instantly share code, notes, and snippets.

View mssoheil's full-sized avatar

Soheil Pasbakhsh mssoheil

View GitHub Profile
@mssoheil
mssoheil / retryDynamicImport.ts
Created October 13, 2024 11:41 — forked from mberneti/retryDynamicImport.ts
This utility function retryDynamicImport enhances React’s lazy loading mechanism by adding retry logic with a versioned query parameter. It retries importing a component multiple times in case of failure, which can be useful for bypassing browser cache or dealing with intermittent network issues. It can be used as a drop-in replacement for React…
// Usage:
// Replace React.lazy(() => import('x'));
// with retryDynamicImport(() => import('x'));
import { ComponentType, lazy } from 'react';
const MAX_RETRY_COUNT = 15;
const RETRY_DELAY_MS = 500;
// Regex to extract the module URL from the import statement
@mssoheil
mssoheil / GoogleDorking.md
Created October 8, 2024 18:56 — forked from sundowndev/GoogleDorking.md
Google dork cheatsheet

Google dork cheatsheet

Search filters

Filter Description Example
allintext Searches for occurrences of all the keywords given. allintext:"keyword"
intext Searches for the occurrences of keywords all at once or one at a time. intext:"keyword"
inurl Searches for a URL matching one of the keywords. inurl:"keyword"
allinurl Searches for a URL matching all the keywords in the query. allinurl:"keyword"
intitle Searches for occurrences of keywords in title all or one. intitle:"keyword"
@mssoheil
mssoheil / node_nginx_ssl.md
Created April 6, 2023 10:39 — forked from bradtraversy/node_nginx_ssl.md
Node app deploy with nginx & SSL

Node.js Deployment

Steps to deploy a Node.js app to DigitalOcean using PM2, NGINX as a reverse proxy and an SSL from LetsEncrypt

1. Sign up for Digital Ocean

If you use the referal link below, you get $10 free (1 or 2 months) https://m.do.co/c/5424d440c63a

2. Create a droplet and log in via ssh

I will be using the root user, but would suggest creating a new user

@mssoheil
mssoheil / class methods and properties
Last active November 4, 2023 15:30
Tags: JavaScript
Private methods: are only accessible inside the class that they are defined.
Protected methods: are only accessible inside the class that they are defined and also accessible inside
of any class that extends their class.
Static methods and properties: are not accessible on instance of their class(`new keyword`) and only accessible directly on the class(`MyClass.method`)
and inside their class are only accessible
inside of another static property (unless we don't use the this keyword).
for e.g. Math Class. we add static keyword to the method inside the class
andorid studio: build -> generate signed bundle/apk
if we created keystore we should add it in gradle.properties and app/build.gradle
in gradle.properties instead of myrelease-key.keystore change myrelease-key.jks
@mssoheil
mssoheil / gist:be3d0a38b444e528b55207a2e02bf901
Last active May 9, 2022 08:42
sum of n consequetive numbers
sum of n consequetive numbers is (n / 2)(first number + last number)
@mssoheil
mssoheil / scheduleMeetingChecker
Last active March 6, 2020 07:15
check if a meeting is in workDay bound or not
/**
* @param {string} dayStart - start day hour in 24 hours format
* @param {string} dayEnd - end day hour in 24 hours format
* @param {string} startTime - start meeting hour in 24 hours format
* @param {number} durationMinutes - meeting duration in minutes
* @returns {boolean} - if the meeting is in work hours bound return true
*/
function scheduleMeeting(dayStart: string, dayEnd: string, startTime: string,durationMinutes: number): boolean {
const getHourMinutes = (item: string): {hours: string, minutes: string} => {