Skip to content

Instantly share code, notes, and snippets.

View the-vishal-kumar's full-sized avatar
😎
Code is like humor. When you have to explain it, it’s bad.

Vishal Kumar the-vishal-kumar

😎
Code is like humor. When you have to explain it, it’s bad.
View GitHub Profile
@the-vishal-kumar
the-vishal-kumar / aws-tutorial-configure-nginx-reverse-proxy-and-deploy-nodejs-application-on-ec2-instance.md
Created June 11, 2023 03:24
Tutorial: AWS - Setup Nginx reverse proxy on EC2 Instance and deploy NodeJs Application
  1. (Optional) Follow the link to learn How to create AWS EC2 Instance
  2. Open terminal, connect to your ec2 instance using ssh command, e.g. sudo ssh -i fungyaan-frankfurt.pem ubuntu@ec2-18-195-20-82.eu-central-1.compute.amazonaws.com
    1. If prompted password, write your computer user's password and press enter
    2. You have successfully logged in as ubuntu user in your EC2 instance.
  3. Switch to superuser
    sudo su
    
    1. Update the package index files on the system
@the-vishal-kumar
the-vishal-kumar / tutorial-aws-create-ec2-and-connect-via-ssh.md
Last active June 11, 2023 02:14
Tutorial: AWS - Create EC2 Instance and Connect via SSH
@the-vishal-kumar
the-vishal-kumar / eslint-prettier-husky-commitlint-for-typescript.md
Last active June 17, 2023 21:47
Setup ESLint, Prettier and Husky for TypeScript
  1. Go to terminal, open the project directory.

    cd project
  2. Run the following commands:

    1. Delete node_modules directory
      rm -rf node_modules
@the-vishal-kumar
the-vishal-kumar / is-point-inside-circle.js
Created October 3, 2021 15:22
Program to determine whether a point is inside or outside a circle
const isPointInsideCircle = (centre, radius, point) => {
return (Math.pow(point.x - centre.x, 2) + Math.pow(point.y - centre.y, 2)) <= (Math.pow(radius, 2));
}
@the-vishal-kumar
the-vishal-kumar / find-circle-center-and-radius.js
Created October 3, 2021 15:16
Program to determine the center and radius of the circle made by three given points
const findCircle = (point1, point2, point3) => {
const x1 = point1.x
const x2 = point2.x
const x3 = point3.x
const y1 = point1.y
const y2 = point2.y
const y3 = point3.y
const x12 = (x1 - x2);
const x13 = (x1 - x3);
@the-vishal-kumar
the-vishal-kumar / check-null.md
Last active September 1, 2021 04:21
How to check for null in JavaScript
  • Checking for null is a common task that every JavaScript developer has to perform at some point or another
  • The typeof keyword returns "object" for null, so that means a little bit more effort is required
  • Comparisons can be made:
    • null === null to check strictly for null
    • null == undefined to check loosely for either null or undefined
  • The value null is falsy, but empty objects are truthy, so typeof maybeNull === "object" && !maybeNull is an easy way to check that a value is not null
  • Finally, to check if a value has been declared and assigned a value that is neither null nor undefined, use typeof
  • typeof maybeUndeclared !== "undefined" &amp;&amp; (typeof maybeUndeclared !== "object" || !maybeUndeclared)