- (Optional) Follow the link to learn How to create AWS EC2 Instance
- 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
- If prompted password, write your computer user's password and press enter
- You have successfully logged in as ubuntu user in your EC2 instance.
- Switch to superuser
sudo su
- Update the package index files on the system
- Update the package index files on the system
- Go to https://console.aws.amazon.com/
- Signup/Signin using your credentials
- Go to EC2 service
- Click on Launch Instance
- Name and tags
- Fill in the name, e.g.
fungyaan
- Fill in the name, e.g.
- Application and OS Images
- Choose OS, e.g.
Ubuntu
- Choose OS, e.g.
- Key pair
- Click on Create new key pair
-
Go to terminal, open the project directory.
cd project
-
Run the following commands:
- Delete node_modules directory
rm -rf node_modules
- Delete node_modules directory
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const isPointInsideCircle = (centre, radius, point) => { | |
return (Math.pow(point.x - centre.x, 2) + Math.pow(point.y - centre.y, 2)) <= (Math.pow(radius, 2)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
- 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 nullnull == 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" && (typeof maybeUndeclared !== "object" || !maybeUndeclared)