Skip to content

Instantly share code, notes, and snippets.

View montasim's full-sized avatar
💭
𝗟𝗢𝗢𝗞𝗜𝗡𝗚 𝗙𝗢𝗥 𝗡𝗘𝗪 𝗢𝗣𝗣𝗢𝗥𝗧𝗨𝗡𝗜𝗧𝗜𝗘𝗦.

M♢NTΛSIM montasim

💭
𝗟𝗢𝗢𝗞𝗜𝗡𝗚 𝗙𝗢𝗥 𝗡𝗘𝗪 𝗢𝗣𝗣𝗢𝗥𝗧𝗨𝗡𝗜𝗧𝗜𝗘𝗦.
View GitHub Profile
@montasim
montasim / addUseStrict.js
Last active August 14, 2024 12:59
Adds the 'use strict'; directive to the top of a JavaScript file if it's not already there.
'use strict';
import fs from 'fs';
import path from 'path';
/**
* The starting directory path where the script will begin processing.
* Adjust this path based on your project's structure.
*/
const directoryPath = path.join(path.resolve(), 'src');

CONTRIBUTOR LICENSE AGREEMENT (CLA)

Thank you for your interest in contributing to our project! To ensure that our project remains sustainable and that contributions can be integrated smoothly, we require all contributors to agree to the following Contributor License Agreement ("Agreement"). This Agreement helps us maintain the quality and integrity of the project while respecting your rights as a contributor.


Table of Contents

@montasim
montasim / generate-project-structure.js
Created August 13, 2024 16:19
Recursively generates a tree structure of the directory.
import fs from 'fs';
import path from 'path';
/**
* Recursively generates a tree structure of the directory.
*
* @param {string} dir - The directory to scan.
* @param {string} [prefix=''] - The prefix used for formatting the tree structure.
* @param {string} [output=''] - The accumulated output string containing the directory structure.
* @returns {string} - The complete directory structure as a string.
import errorResponse from '../utilities/errorResponse.js';
import httpStatus from '../constant/httpStatus.constants.js';
import sendResponse from '../utilities/sendResponse.js';
import loggerService from '../service/logger.service.js';
import toSentenceCase from '../utilities/toSentenceCase.js';
const getResourceById = async (model, populateMethod, resourceId, resourceType) => {
try {
const resource = await populateMethod(model.findById(resourceId));
if (!resource) {
import { Schema } from 'mongoose';
import constants from '../constant/constants.js';
import userConstants from '../modules/api/users/users.constants.js';
import patterns from '../constant/patterns.constants.js';
// Define the shared username schema
const usernameSchema = {
type: String,
trim: true,
import asyncErrorHandlerService from '../utilities/asyncErrorHandler.js';
import getRequesterId from '../utilities/getRequesterId.js';
import loggerService from '../service/logger.service.js';
import getHostData from '../utilities/getHostData.js';
import getRequestedDeviceDetails from '../utilities/getRequestedDeviceDetails.js';
// TODO: Implement the `entity` log
// TODO: utilize the hostData for every entity
const createNewUserEntity = (service, createFunction) =>
import NodeCache from 'node-cache';
import loggerService from '../service/logger.service.js';
const cache = new NodeCache();
const create = (duration = 3600) => {
return (req, res, next) => {
let key;
@montasim
montasim / List of common passwords
Last active July 29, 2024 07:11
🔐 This gist provides a curated list of commonly used passwords, compiled to assist developers, security professionals, and enthusiasts in understanding common security vulnerabilities associated with weak password practices. Useful for educational purposes, penetration testing, and security training. Note: Do not use these passwords for personal…
123456
password
12345678
qwerty
123456789
12345
1234
111111
1234567
dragon
@montasim
montasim / List of temporary email domains
Last active July 29, 2024 07:18
📧 This gist contains a comprehensive list of domains used by temporary email services. It's intended to help developers and security analysts filter out or monitor temporary email addresses in their applications, enhancing security measures and maintaining the integrity of user data. Ideal for use in signup processes, form validations, and anywh…
0-mail.com
027168.com
0815.ru
0815.ry
0815.su
0845.ru
0box.eu
0clickemail.com
0n0ff.net
0nelce.com
@montasim
montasim / .prettierignore
Last active July 16, 2024 09:03
This file specifies patterns of files and directories that Prettier should ignore.
####################################################
# Prettier Ignore Configuration File
####################################################
# This file specifies patterns of files and directories that Prettier should ignore.
# Using this file helps avoid formatting conflicts and unnecessary processing of files not meant for modification.
####################################################
# IDE and Project Files
# Purpose: Prevent Prettier from formatting project and IDE configuration files.
# Use: Ensures that configurations and settings files are not altered unintentionally.