Setup a Blogging Website with Docusaurus 2

This is a guide for setting up a blogging website using Docusaurus 2.

Here is the final result:

Docusaurus 2 is an open-source tool that acts as static site generator to create websites (like Gatsby). The first version of Docusaurus was mostly limited to documentation websites.

However, with Docusaurus 2, the developers expanded the original tooling to create any kind of website.

For this guide, we will only be focusing on the BLOG feature of Docusaurus 2.

The final file structure will look something like this:

blog-website
└── blog
├── 2019-09-17-welcome.md
└── 2020-10-06-new-post.md
// ...

Posts are generated from simple markdown (.md) files. Simply adding a new markdown file will create additional posts.

Let's get to it.

Smallest Positive Integer Coding Problem (Javascript)

Write a function:

function solution(A);

that, given an array A of N integers, returns the smallest positive integer (greater than 0) that does not occur in A.

For example, given A = [1, 3, 6, 4, 1, 2], the function should return 5.

Given A = [1, 2, 3], the function should return 4.

Given A = [−1, −3], the function should return 1.

Write an efficient algorithm for the following assumptions:

  • N is an integer within the range [1..100,000];
  • Each element of array A is an integer within the range [−1,000,000..1,000,000].

React Native Cheatsheet

Some common commands for debugging.

Rebuild

rm -rf node_modules && npm install &&
cd ios &&
pod deintegrate &&
pod install &&
cd .. &&
yarn ios

Run after installing new npm packages.

  1. Stop Metro (terminal)
  2. Exit simulator
  3. Run script

React Starting Point

This is my personal stack when starting a new project.
I value having a flexible starting point and getting everything up and running as fast as possible.

There are two parts:

  • Section 1: Front-End (React + Tailwind)
  • Section 2: CI/CD - Google Cloud Build and Google Cloud Run

I hope you find this helpful.

Setup Google Cloud Run with Create-React-App and Continuous CI/CD at Virtually Zero Cost

The End Result

Project URL:
https://react-google-cloud-run-zxc6fpw5uq-uc.a.run.app/

Repository:
https://github.com/grobelDev/react-google-cloud-run

After completing the following steps, you should have a website with SSL certificates (that is, using https://) hosted on a public run.app URL for virtually free.

The website will also only use compute resources proportional to the number of users.

That is, if there is only one user, only one container should be temporarily spun up to send the requested HTML/CSS files. If there are many users, or even a sudden influx of users (as in, your website goes viral), then an appropriate amount of containers (up to 1,000 simultaneously) should be dynamically spun up to meet the demand without significant impact to user experience.

Also, if there are zero users, then no compute resources will be used at all, and costs will be zeroed.