Skip to content

Instantly share code, notes, and snippets.

View bradtraversy's full-sized avatar
💭
Always Coding :)

Brad Traversy bradtraversy

💭
Always Coding :)
View GitHub Profile
@bradtraversy
bradtraversy / prostore-vercel-hobby-tier-fix.md
Last active January 24, 2025 13:55
Prostore Vercel Hobby Tier Fix

Vercel Hobby Tier Fix

If you are using the free "hobby" tier for Vercel, you may at some point get the following error:

Error: The Edge Function "middleware" size is 1.01 MB and your plan size limit is 1 MB. Learn More: https://vercel.link/edge-function-size

I had made a post to try and fix this by swapping out bcrypt for a custom password encrypt script, but it turns out that wasn't the best fix and didn't work in some cases. If you already did that, that's absolutely fine, but it's not needed.

@bradtraversy
bradtraversy / git-cheat-sheet.md
Created January 6, 2025 17:16
Cheat Sheet for Git Crash Course

Git & GitHub Crash Course 2025 Cheat Sheet

What is Git?

Git is a distributed version control system that allows developers to:

  • Track changes in code.
  • Collaborate on projects.
  • Manage multiple versions of a project.
  • Work offline with a full local repository.

Deploying To Vercel Hobby Tier

I did not realize this at the time of recording, but the full project is too large for Vercel's hobby plan. That is one of the drawbacks of having such a large course project, is there can be limitations for free hosting. If you deploy to the hobby plan, you may see the following message:

Error: The Edge Function "middleware" size is 1.01 MB and your plan size limit is 1 MB. Learn More: https://vercel.link/edge-function-size

One solution that we found is to remove the bcrypt-ts-edge package and use the built-in web crypto API to hash passwords. There are quite a few changes that we need to make, so you can follow along if you want to be able to deploy to the free teir of Vercel.

@bradtraversy
bradtraversy / workopia_db_seeder.php
Created November 13, 2024 12:48
Laravel seeder for MySQL/MariaDB
<?php
// TRY THIS FIRST. DISABLE AND RE_ENABLE THE CHECK
namespace Database\Seeders;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
class DatabaseSeeder extends Seeder
{
/**
@bradtraversy
bradtraversy / terminal-commands.md
Last active January 23, 2025 03:50
Common Terminal Commands

Common Terminal Commands

Key Commands & Navigation

Before we look at some common commands, I just want to note a few keyboard commands that are very helpful:

  • Up Arrow: Will show your last command
  • Down Arrow: Will show your next command
  • Tab: Will auto-complete your command
  • Ctrl + L: Will clear the screen
@bradtraversy
bradtraversy / carbon-lang-snippets.md
Last active March 21, 2024 11:31
Google Carbon Snippets

Google Carbon Snippets

This file contains some of the basic syntax for Google Carbon as well as some info and how to get set up.

The official repo and docs can be found at: https://github.com/carbon-language/carbon-lang

Carbon is an experimental successor to C++. It is NOT ready for production and will not be for a while. This crash course and document were made to explore some of the basic syntax.

How to get started

@bradtraversy
bradtraversy / mern-server-setup.md
Last active December 5, 2024 08:23
Setup Ubuntu & Deploy MERN app

Linux Server Setup & MERN App Deployment

These are the steps to setup an Ubuntu server from scratch and deploy a MERN app with the PM2 process manager and Nginx. We are using Linode, but you could just as well use a different cloud provider or your own machine or VM.

Create an account at Linode

Click on Create Linode

Choose your server options (OS, region, etc)

SSH Keys

@bradtraversy
bradtraversy / graphql-queries-mutations.md
Created June 2, 2022 17:37
GraphQL Queries & Mutations

GraphQL Queries & Mutations

These are the GraphQL queries and mutations for the YouTube course.

Get names of all clients

{
  clients {
    name
 }
@bradtraversy
bradtraversy / tailwind-webpack-setup.md
Last active December 18, 2024 18:36
Setup Webpack with Tailwind CSS

Webpack & Tailwind CSS Setup

Create your package.json

npm init -y

Create your src folder

Create a folder called src and add an empty index.js file. The code that webpack compiles goes in here including any Javascript modules and the main Tailwind file.

@bradtraversy
bradtraversy / laravel_xampp_setup.md
Created April 22, 2022 01:16
Laravel Xampp setup on Mac and Windows

Laravel Xampp Setup (Windows & Mac)

Install Xampp

Install Xampp from https://www.apachefriends.org/index.html

  • Run the Xampp installer and open the Xampp control panel
  • Make sure that you enable the Apache and MySQL services
  • On mac you need to click "Start" on the Home tab, "Enable" on the Network tab and "Mount" on the Location Tab. Click "Explore" on the location tab to open your Xampp/Lampp folder

Install Composer