Skip to content

Instantly share code, notes, and snippets.

@edoves
edoves / export_index_sample.md
Created October 30, 2024 15:18
Better export setting up inside index.js

Better export setting up inside index.js

export { default as Navbar } from './Navbar/Navbar';
export { default as Footer } from './Footer/Footer';
export { default as InfoSection } from './InfoSection/InfoSection';
export { default as Pricing } from './Pricing/Pricing';
@edoves
edoves / createRoutesFromElements.md
Created October 30, 2024 15:16
createRoutesFromElements

createRoutesFromElements.js

import {
  createBrowserRouter,
  createRoutesFromElements,
  RouterProvider,
} from "react-router-dom";

// You can do this:
const router = createBrowserRouter(
@edoves
edoves / mongodb_cheat_sheet.md
Last active October 30, 2024 15:22 — forked from bradtraversy/mongodb_cheat_sheet.md
MongoDB Cheat Sheet

MongoDB Cheat Sheet

Show All Databases

show dbs

Show Current Database

@edoves
edoves / StoryBook.md
Last active November 14, 2024 08:27
Initial Stoybook setup

StoryBook Gist

import { Meta, StoryObj } from "@storybook/react"
import { Component } from "./GameScreen"

const meta: Meta<typeof Component> = {
  component: Component,
  title: "Formapp/Player/Sessions/DefaultStoryName",
  tags: ["autodocs"],
}
@edoves
edoves / tanstackquery.md
Created October 30, 2024 15:07
TanStack Query Code samle

useMutation use for editing adding updatting or deleting data in the database

useMutationHook.js

import { useMutation, useQueryClient } from '@tanstack/react-query'
import { addMemberPayment as addMemberPaymentApi } from 'api/services'

function useHookName() {
  const queryClient = useQueryClient()
  const { mutate: addMemberPayment, isPending } = useMutation({
@edoves
edoves / mongodb_shell_commands.md
Created October 30, 2024 14:53 — forked from michaeltreat/mongodb_shell_commands.md
Quick Cheat Sheet for Mongo DB Shell commands.

MongoDB Shell Commands Cheat Sheet.

This is a Cheat Sheet for interacting with the Mongo Shell ( mongo on your command line). This is for MongoDB Community Edition.

Preface:

Mongo Manual can help you with getting started using the Shell.

FAQ for MongoDB Fundamentals and other FAQs can be found in the side-bar after visiting that link.

@edoves
edoves / mongodb_cheat_sheet_2022.md
Created October 30, 2024 14:53 — forked from codeSTACKr/mongodb_cheat_sheet_2022.md
MongoDB Cheat Sheet 2022

Express Template

app.ts

const cors = require('cors')
const cookieParser = require('cookie-parser')
const app = express()

const postRoute = require('./routes/post.route.js')
@edoves
edoves / mongoose-cheatsheet.md
Created October 30, 2024 14:49 — forked from subfuzion/mongoose-cheatsheet.md
mongoose cheatsheet

Definitely not comprehensive. This is meant to be a basic memory aid with links to get more details. I'll add to it over time.

Install

$ npm install mongoose --save

Connect

const mongoose = require('mongoose');
@edoves
edoves / 1mongoose.md
Last active October 30, 2024 14:47
MongoDB and Mongoose Cheatsheet

MongoDB and Mongoose Cheatsheet

Beautifully-designed print-ready PDF

MongoDB

  • $ mongod: start MongoDB server (localhost:27017)
  • $ mongo: open MongoDB console (connect to local server by default)