Skip to content

Instantly share code, notes, and snippets.

View Shaz3e's full-sized avatar

Shahrukh Akhtar Shaz3e

View GitHub Profile
@Shaz3e
Shaz3e / Readme.md
Created January 22, 2025 20:10
Rebase Development Branch from Main/Master Branch

Ensure you're on the development branch:

git checkout development

Fetch the latest changes from the remote (including the main branch):

git fetch origin
@Shaz3e
Shaz3e / README.md
Created December 29, 2024 12:28
Create Shortcut Command in Mac

Open terminal Type: echo $SHELL If the output is /bin/zsh, you're using Zsh (default on macOS Catalina and later). Otherwise, you might be using Bash.

For Zsh:

nano ~/.zshrc

For Bash:

@Shaz3e
Shaz3e / READMME.MD
Last active November 27, 2024 22:47
Connect Private Repo

Pull github respository into cpanel and auto deploy recent chagnes

First check at cPanel SSH Access there should not be any key if there is any delete this than generate new key from terminal ssh-keygen -t rsa -b 2048 -f ~/.ssh/id_rsa

After generating key Go to .ssh directory and open .pub file and copy SSH Key Add this SSH Key into GITHUB REPO - Setting - Deploy Keys

Backup all files from public_html to _backup directory e.g. /home/_backup

@Shaz3e
Shaz3e / ServerMonitor.php
Last active November 24, 2024 23:53
Get Server Usage in Laravel - Unix-based systems (Linux, macOS)
<?php
// Create file inside Services folder
// php artisan make:class Services/ServerMonitor
namespace App\Services;
use Symfony\Component\Process\Exception\ProcessFailedException;
use Symfony\Component\Process\Process;
class ServerMonitor
{
@Shaz3e
Shaz3e / .env
Created September 10, 2024 19:32
Send Slack Notification in Laravel 11
SLACK_BOT_USER_OAUTH_TOKEN=
SLACK_BOT_USER_DEFAULT_CHANNEL=
@Shaz3e
Shaz3e / extensions.json
Last active September 23, 2024 20:42
My VS Code Extension List to code faster and easier
// .vscode/extensions.json
{
"recommendations": [
"rangav.vscode-thunder-client",
"bmewburn.vscode-intelephense-client",
"donjayamanne.githistory",
"DavidAnson.vscode-markdownlint",
"eamodio.gitlens",
"GitHub.vscode-pull-request-github",
"PKief.material-icon-theme",
@Shaz3e
Shaz3e / api.php
Last active July 25, 2024 22:19
Laravel API Versioning
<?php
// routes/api.php
use Illuminate\Support\Facades\Route;
Route::prefix('v1')->group(base_path('routes/api/v1.php'));
Route::prefix('v2')->group(base_path('routes/api/v2.php'));
@Shaz3e
Shaz3e / UserList.php
Created July 21, 2024 15:29
Pagination with Livewire without loosing serial number
// In your livewire blade
@php
// Get the current page number, default to 1 if not set
$currentPage = $dataSet->currentPage();
// Get the number of items per page
$perPage = $dataSet->perPage();
// Calculate the starting index
$i = ($currentPage - 1) * $perPage + 1;
@endphp
@Shaz3e
Shaz3e / AppServiceProvider.php
Last active July 14, 2024 21:06
Rate Limit in Laravel
<?php
namespace App\Providers;
use Illuminate\Cache\RateLimiting\Limit;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\RateLimiter;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
@Shaz3e
Shaz3e / readme.md
Last active November 2, 2023 13:19
How to Remove Foreign Key and Index from Database

instructions

  • Go to PHPMyAdmin
  • Select Database
  • Click Query Tab

Insert the following commands one by one make sure to change table_name with actual table name and column name with actual column name

First you need to remove foreign key from table.column