Skip to content

Instantly share code, notes, and snippets.

View markshust's full-sized avatar
🤓
Working on educational & training material for Magento 2

Mark Shust markshust

🤓
Working on educational & training material for Magento 2
View GitHub Profile
@markshust
markshust / README.md
Last active July 21, 2025 12:46
Zero-downtime Laravel deployment with GitHub Actions

GitHub Actions Deploy Script - Environment Variables Setup Guide

This guide explains how to set up the required environment variables (GitHub Secrets) for the Laravel deployment GitHub Actions workflow.

Overview

The deployment script uses GitHub Secrets to securely store sensitive information like SSH keys and server details. These secrets are referenced in the workflow using the ${{ secrets.SECRET_NAME }} syntax.

Required Secrets

Development Guidelines for Claude

Core Philosophy

TEST-DRIVEN DEVELOPMENT IS NON-NEGOTIABLE. Every single line of production code must be written in response to a failing test. No exceptions. This is not a suggestion or a preference - it is the fundamental practice that enables all other principles in this document.

I follow Test-Driven Development (TDD) with a strong emphasis on behavior-driven testing and functional programming principles. All work should be done in small, incremental changes that maintain a working state throughout development.

Quick Reference

@markshust
markshust / dbbackuprestore
Last active April 9, 2025 23:18
Backup prod MySQL database, sync it down locally, then restore it in local dev
#!/bin/bash
# bin/dbbackuprestore
# Configuration variables for remote server
REMOTE_SERVER=""
REMOTE_SERVER_USER="" # Leave empty if using SSH config or key-based auth
REMOTE_SERVER_PORT="" # Default SSH port
REMOTE_SSH_KEY="" # Path to SSH key file (leave empty if using default)
@markshust
markshust / CLAUDE.md
Created March 15, 2025 11:05
Claude Code configuration for Magento

Magento 2 Dev Commands & Guidelines

Build & Installation

  • composer install - Install dependencies
  • bin/magento setup:install - Install Magento
  • bin/magento setup:upgrade - Update database schema
  • bin/magento setup:di:compile - Compile dependency injection
  • bin/magento setup:static-content:deploy - Deploy static assets

Testing

@markshust
markshust / .zshrc
Created January 31, 2025 21:29
bash function to build & push multi-architecture docker images upstream
dbx() {
echo "Enter the tag (e.g., markoshust/magento-php:8.4-fpm-0):"
read -r tag
if [ -z "$tag" ]; then
echo "Error: Tag cannot be empty"
return 1
fi
echo "You entered: $tag"
@markshust
markshust / Collection.php
Created November 27, 2024 00:38
Fetch data from multiple tables in a Magento admin grid
<?php
namespace Macademy\Minerva\Model\ResourceModel\Faq\Grid;
class Collection extends \Magento\Framework\View\Element\UiComponent\DataProvider\SearchResult
{
protected function _initSelect()
{
parent::_initSelect();
// Add your join statements here
@markshust
markshust / README.md
Last active June 18, 2025 07:21
GitHub Action to deploy Laravel app

Set up GitHub Actions to handle deployments for your Laravel application. This has similar functionality to Laravel Forge without the recurring cost. GitHub Actions can be used to automate your deployment process on every push to your repository.

Prerequisites

  1. Server Access: Ensure you have SSH access to your server where the Laravel app will be deployed.
  2. Secrets: Store sensitive information such as your server's IP address, SSH username, and private SSH key in GitHub Secrets. Go to your GitHub repository, navigate to "Settings" > "Secrets and variables" > "Actions", and add the following secrets:
    • DEPLOY_SERVER_IP: Your server's IP address.
    • DEPLOY_SERVER_USER: Your SSH username.
    • DEPLOY_SERVER_KEY: Your private SSH key. Make sure this key is authorized to access your server (~/.ssh/authorized_keys).
  • DEPLOY_SERVER_DIR: The directory where you'd like to deploy your app, relative to /var/www/. Ex: example.com
@markshust
markshust / start
Created November 8, 2024 15:48
Helper script to start Laravel with Sail, npm and ngrok.
#!/bin/bash
# Function to cleanup processes on script exit
cleanup() {
echo "Cleaning up..."
./vendor/bin/sail down
kill "$(jobs -p)" 2>/dev/null
exit
}
@markshust
markshust / Collection.php
Created February 24, 2024 18:43
Create a custom admin grid collection class to add a custom field to the grid
<?php
// 3. Create a custom collection class that extends SearchResult.
declare(strict_types=1);
namespace Macademy\Minerva\Model\ResourceModel\Faq\Grid;
use Magento\Framework\View\Element\UiComponent\DataProvider\SearchResult;
@markshust
markshust / personal-business-coach.txt
Created January 2, 2024 20:24
ChatGPT Prompt: Personal & business coach
Please act as both a personal and business coach.
## Who am I?
My name is... (continue with extreme detail)
## Given my personal mission statement
As a _your job goes here_, ...