Skip to content

Instantly share code, notes, and snippets.

View mortezasabihi's full-sized avatar
💻
Working From Home

Morteza Sabihi mortezasabihi

💻
Working From Home
View GitHub Profile
@mberneti
mberneti / retryDynamicImport.ts
Last active March 16, 2025 07:13
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
@jengel3
jengel3 / authentication-1.controller.ts
Last active April 23, 2024 19:26
NestJS - Implementing Access & Refresh Token Authentication
// app/modules/authentication/authentication.controller.ts
import { Body, Controller, Post } from '@nestjs/common'
import { RegisterRequest } from './requests'
import { User } from '../../modules/user'
import { UsersService } from '../users/users.service'
@wiegertschouten
wiegertschouten / grid.scss
Created October 1, 2020 18:38
A very simple grid system built with SASS and CSS grid
$columns: 12;
$gap: 30px;
$breakpoints: (
xs: 480px,
sm: 768px,
md: 960px,
lg: 1170px,
xl: 1280px
);
@kstevenson722
kstevenson722 / Mount USB Drive for Proxmox Backup.md
Last active May 13, 2025 23:49
Mount UBS Drive for Proxmox Backup
@mahmoud-eskandari
mahmoud-eskandari / README.md
Last active March 11, 2025 16:59
SSH Tunnel as systemd service

${LOCAL_ADDR IP:PORT}

یعنی سرور ایرانتون و پورت داخلی که میخواهید روش ساکس داشته باشید و باید با این جایگزین بشود.

مثال:

10.10.10.10:9090

و قسمت پایین هم یوزر سرور خارجتون و آدرس IP سرور خارجیتونه که باید جایگزین کنید تو خط 7 فایل ssh-tunnel-as-systemd.sh

@TimVosch
TimVosch / app.controller.ts
Last active February 22, 2024 05:00
Get request parameters in FileInterceptor
import { Controller, UseInterceptors, Post } from '@nestjs/common';
import { AppService } from './app.service';
import { diskStorage } from 'multer';
import { Request } from 'express';
import { MyNewFileInterceptor } from './file.interceptor';
@Controller()
export class AppController {
constructor(private readonly appService: AppService) {}
@lewebsimple
lewebsimple / nuxtjs-nestjs.md
Last active January 19, 2024 16:14
NuxtJS / NestJS fullstack development

This is my take on fullstack development using NuxtJS and NestJS.

Development steps

  • Lerna monorepo
  • TypeScript linting and formatting
  • Minimal NestJS server
  • Minimal NuxtJS client
  • Environment configuration
  • TypeGraphQL
  • TypeORM / MySQL

MongoDB Cheat Sheet

Show All Databases

show dbs

Show Current Database

@evvvritt
evvvritt / package.json
Last active December 20, 2019 15:52
Simple purgecss implementation for Vue CLI 3
// using in a Vue CLI 3, tailwindcss app but can be adjusted
"scripts": {
"build": "vue-cli-service build",
"postbuild": "yarn purgecss",
"purgecss": "node_modules/purgecss/bin/purgecss --config ./purgecss.config.js --out ./dist/css"
},
@hadisfr
hadisfr / outline-server-setup.md
Last active December 23, 2024 16:30 — forked from okeehou/outline-server-setup.md
How to setup an Outline VPN Server on Ubuntu 16.04

How to setup an Outline VPN Server on Ubuntu 16.04 Server

This guide will show you how to install Outline Server on an Ubuntu 16.04 Server and use Outline Manager.

Install Outline Manager

Outline Manager supports Windows, macOS and Linux.

Outline Manager for Windows