Skip to content

Instantly share code, notes, and snippets.

View abhagsain's full-sized avatar
💻
Building

Anurag Bhagsain abhagsain

💻
Building
View GitHub Profile
@abhagsain
abhagsain / file.md
Last active February 5, 2021 14:19
Extensions that I use
  • alefragnani.Bookmarks
  • bradlc.vscode-tailwindcss
  • ChakrounAnas.turbo-console-log
  • CoenraadS.bracket-pair-colorizer
  • dbaeumer.vscode-eslint
  • donjayamanne.githistory
  • dsznajder.es7-react-js-snippets
  • eamodio.gitlens
  • Equinusocio.vsc-community-material-theme
  • Equinusocio.vsc-material-theme
@abhagsain
abhagsain / demo.js
Last active January 15, 2021 17:40
Rapid Poll
import React from "react";
import cx from "classnames";
const Label = ({ children }) => {
return (
<label className="mb-3 w-full font-semibold text-gray-600">
{children || "Label"}
</label>
);
};
const ErrorLabel = ({ children }) => {
@abhagsain
abhagsain / extensions.json
Created December 22, 2020 12:29
Extensions
{
"recommendations": [
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"VisualStudioExptTeam.vscodeintellicode",
"johnpapa.vscode-peacock"
]
}
@abhagsain
abhagsain / README.md
Created December 20, 2020 04:08
How to debug Typescript in VSCode

How to Debug TypeScript in VSCode

It was a pain for me to figure out how to debug TS in VSCode. Creating this doc for my reference and it might help you as well.

Have this in your tsconfig.json

 "sourceMap": true,  /* SUPER-DUPER Important Generates corresponding '.map' file. */
 "outFile": "./",    /* Concatenate and emit output to single file. */
@abhagsain
abhagsain / Remove Node Modules Modified > 60 days ago
Created April 11, 2020 06:16
This Linux command removes Node Modules Modified > 60 days ago
find . -maxdepth 2 -name node_modules -type d -mtime +60 -exec rm -rf {} \;
@abhagsain
abhagsain / index.js
Created March 12, 2020 09:06
Protected Route Using React Router Dom
const PrivateRoute = ({ component: Component, ...args }) => {
// user is the authenticated user pulled from the React Context
const { user } = useContext(AuthContext);
return (
<Route
{...args}
render={props => {
return user ? (
<Component {...props} />
@abhagsain
abhagsain / docker-commands.md
Last active September 8, 2019 15:48
I'll be putting docker commands that I'm learning from the course Docker Mastery

Basic docker commands that I'm learning

  • docker container
    • run --publish 80:80 --detch --name {custom_container_name} nginx
    • ls [list all the running containers]
    • ls -a [list all the containers installed]
    • stop {container_id} {give upto 3 characters of the container} [Stops the running container]
    • rm {container_id} [Remove the stoppped container]
    • rm -f [Remove any container; stopped or running] [Not recommended]
    • top (container_name) [displays the running process of the container]
  • inspect (conatiner_name) [details of the container config]
@abhagsain
abhagsain / bash.txt
Created September 1, 2019 08:38
Bash commands
BEGINNER'S GUIDE TO THE BASH TERMINAL
NAVIGATION
ls - list directory contents
pwd - print name of current/working directory
cd - change working directory
pushd/popd - put working directory on a stack
file - determine file type
locate - find files by name
@abhagsain
abhagsain / app.js
Created May 27, 2019 22:19 — forked from joshnuss/app.js
Express.js role-based permissions middleware
// the main app file
import express from "express";
import loadDb from "./loadDb"; // dummy middleware to load db (sets request.db)
import authenticate from "./authentication"; // middleware for doing authentication
import permit from "./permission"; // middleware for checking if user's role is permitted to make request
const app = express(),
api = express.Router();
// first middleware will setup db connection
@abhagsain
abhagsain / .cpp
Created April 30, 2019 02:58
BFS & DFS
/*
Write a BFS program using adjacency list and queue
*/
#include<iostream>
#include<list>
#include<queue>
#include<stack>
using namespace std;
class Graph{
private: