Skip to content

Instantly share code, notes, and snippets.

View hereisfahad's full-sized avatar
🎯
Focusing

Fahad Jabbar hereisfahad

🎯
Focusing
View GitHub Profile
@hereisfahad
hereisfahad / eslint_prettier_airbnb.md
Created January 20, 2024 18:17 — forked from bradtraversy/eslint_prettier_airbnb.md
ESLint, Prettier & Airbnb Setup

VSCode - ESLint, Prettier & Airbnb Setup

1. Install ESLint & Prettier extensions for VSCode

Optional - Set format on save and any global prettier options

2. Install Packages

npm i -D eslint prettier eslint-plugin-prettier eslint-config-prettier eslint-plugin-node eslint-config-node
@hereisfahad
hereisfahad / s3-move-files.js
Created October 15, 2023 21:57
Move files from one folder to the other AWS S3
const AWS = require("aws-sdk");
const { MongoClient } = require("mongodb");
const dotenv = require("dotenv");
dotenv.config();
const s3 = new AWS.S3({
region: "us-west-2",
});
import * as React from 'react';
import Box from '@mui/material/Box';
import Stepper from '@mui/material/Stepper';
import Step from '@mui/material/Step';
import StepLabel from '@mui/material/StepLabel';
import Button from '@mui/material/Button';
import Typography from '@mui/material/Typography';
import { styled } from '@mui/material/styles';
import StepConnector, {
stepConnectorClasses,
@hereisfahad
hereisfahad / FocusError
Created September 20, 2022 11:05
Focus first error, formik, reactjs, dom
// add custom attribute on the input element or wrapper div data-valid={`${error ? "false" : "true"}}
import { useEffect } from 'react';
import { useFormikContext } from 'formik';
const FocusError = () => {
const { errors, isSubmitting, isValidating } = useFormikContext();
useEffect(() => {
@hereisfahad
hereisfahad / enum-access.js
Created March 29, 2020 19:37 — forked from bnoguchi/enum-access.js
How to access enumValues in mongoose from a Model or Document
var mongoose = require('./index')
, TempSchema = new mongoose.Schema({
salutation: {type: String, enum: ['Mr.', 'Mrs.', 'Ms.']}
});
var Temp = mongoose.model('Temp', TempSchema);
console.log(Temp.schema.path('salutation').enumValues);
var temp = new Temp();
console.log(temp.schema.path('salutation').enumValues);

MongoDB Cheat Sheet

Show All Databases

show dbs

Show Current Database