Skip to content

Instantly share code, notes, and snippets.

@harithzainudin
harithzainudin / commit-msg-linter.js
Created August 5, 2023 12:15
Scripts for checking commit message that use with Husky. Read more here to implement this -->
/**
* This JavaScript function checks if a Git commit message follows a specific format and provides
* success or failure messages accordingly.
* @param buffer - The `buffer` parameter is a buffer object that contains the content of a file. In
* this code, it is used to read the content of the `.git/COMMIT_EDITMSG` file.
* @returns The code is returning the first line of the commit message from the `.git/COMMIT_EDITMSG`
* file.
*/
let supportsColor = { stdout: true };
const fs = require("fs");
@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

@bradtraversy
bradtraversy / mongodb_cheat_sheet.md
Last active April 22, 2025 11:58
MongoDB Cheat Sheet

MongoDB Cheat Sheet

Show All Databases

show dbs

Show Current Database

@bradtraversy
bradtraversy / mysql_cheat_sheet.md
Last active April 26, 2025 21:23
MySQL Cheat Sheet

MySQL Cheat Sheet

Help with SQL commands to interact with a MySQL database

MySQL Locations

  • Mac /usr/local/mysql/bin
  • Windows /Program Files/MySQL/MySQL version/bin
  • Xampp /xampp/mysql/bin

Add mysql to your PATH

@yajra
yajra / axios-401-response-interceptor.js
Last active October 8, 2024 21:22
Axios 401 response interceptor.
// Add a 401 response interceptor
window.axios.interceptors.response.use(function (response) {
return response;
}, function (error) {
if (401 === error.response.status) {
swal({
title: "Session Expired",
text: "Your session has expired. Would you like to be redirected to the login page?",
type: "warning",
showCancelButton: true,