Skip to content

Instantly share code, notes, and snippets.

View ArcRanges's full-sized avatar
🎯
Focusing

Mark Ranges ArcRanges

🎯
Focusing
View GitHub Profile
@ArcRanges
ArcRanges / gist:a58386858e9ee9b5393f058b6d6d2177
Created June 4, 2022 05:31
Validate env files so that it fails when a key is missing
// taken from https://dev.to/austinshelby/you-are-reading-environment-variables-the-wrong-way-in-nextjs-45da
// helper function
const getEnvironmentVariable = (environmentVariable: string): string => {
const unvalidatedEnvironmentVariable = process.env[environmentVariable];
if (!unvalidatedEnvironmentVariable) {
throw new Error(
`Couldn't find environment variable: ${environmentVariable}`
);
} else {
@ArcRanges
ArcRanges / git-commands.md
Last active April 25, 2022 16:22
Here's a list of git commands that might be useful in your programming journey

My compilation of helpful git commands

Problem: tracked files not being ignored by an updated .gitignore
Solution: untrack the files first then .gitignore will ignore them after

git rm -r --cached .        # untrack files, replace "." for any other directory
git add .                   # re-adding the files
git commit -m "issue fixed" # commiting changes
git push # pushing changes
@ArcRanges
ArcRanges / gist.md
Last active April 28, 2024 14:30
aws-ec2-nextjs

Instructions to properly set up a production-ready NextJS App with AWS

This is a summary of how to start your own NextJS app, create the repo on Github, upload later in an AWS EC2 Instance and automate the process with AWS Codebuild, CodeDeploy, & CodePipeline.

After following these instructions you should be able to:

  • Create a NextJS App
  • Create an AWS EC2 instance
  • Be able to SSH to an EC2 instance
  • Prepare the instance as a Node environment
  • Configure Nginx service for proper routing
  • Configure domain and add SSL
@ArcRanges
ArcRanges / AWS-SSL-Lightsail.md
Last active December 18, 2020 00:04
Add SSL to WordPress site in AWS Lightsail
I will be using MacOS

Requirements:

- AWS Lightsail Instance

Initialization

sudo apt install snapd
@ArcRanges
ArcRanges / instructions.md
Last active January 18, 2024 09:36
Up and Running on AWS EC2 using Django with files from Git in less than 5 minutes

How to Setup Django in AWS EC2 Instance in less than 5 minutes

I will be using Windows 10, Git Bash, Windows Powershell

Requirements:

- Django Project uploaded on Git
- AWS EC2 Account

Initialization: EC2 Setup: