Skip to content

Instantly share code, notes, and snippets.

View sanampatel's full-sized avatar
💡
Something quite cool is coming up!

Sanam Patel sanampatel

💡
Something quite cool is coming up!
View GitHub Profile
@sanampatel
sanampatel / laravel_forge_deployment.sh
Created July 11, 2022 01:11
Laravel forge directory wise deployment script for laravel application
cd /home/forge/<DIRECTORY_NAME>
# Deploy Start Message
echo "Deploying application to $FORGE_SITE_BRANCH branch at $FORGE_SITE_PATH..."
# Git
git pull origin $FORGE_SITE_BRANCH
# Production optimized composer install
$FORGE_COMPOSER install --no-interaction --prefer-dist --optimize-autoloader
@sanampatel
sanampatel / EncryptAble.php
Last active April 24, 2021 15:39
EncryptAble PHP Trait to encryptable values while storing to database and decrypt when retrieved.
<?php
namespace App\Traits;
use Illuminate\Support\Facades\Crypt;
trait EncryptAble
{
/**
* If the attribute is in the encryptable array
@sanampatel
sanampatel / QueryModel.php
Last active November 8, 2022 14:59
QueryModel is the PHP trait for Laravel-query-builder package by spatie
<?php
namespace App\Traits;
use Spatie\QueryBuilder\QueryBuilder;
use Spatie\QueryBuilder\AllowedFilter;
trait QueryModel
{
// Get Fillable Fields
@sanampatel
sanampatel / PHP Countries Code Array
Last active June 15, 2020 08:09
PHP Countries Code Array ISO Code and Country Name
<?php
$countries = array(
"AF" => "Afghanistan",
"AX" => "Aland Islands",
"AL" => "Albania",
"DZ" => "Algeria",
"AS" => "American Samoa",
"AD" => "Andorra",
"AO" => "Angola",
@sanampatel
sanampatel / Pre Fetch
Created June 2, 2020 06:30
DNS Prefetch for different provider
<!-- https://mycyberuniverse.com/speeding-website-using-dns-prefetching.html -->
<!-- Google CDN -->
<link rel="dns-prefetch" href="//ajax.googleapis.com">
<!-- Google API -->
<link rel="dns-prefetch" href="//apis.google.com">
<!-- Google Fonts -->
<link rel="dns-prefetch" href="//fonts.googleapis.com">
@sanampatel
sanampatel / s3_buckets.py
Created October 13, 2019 19:04
Print all S3 Buckets name from AWS Lambda Function
import json
import boto3
print('Loading function')
s3 = boto3.resource('s3')
def lambda_handler(event, context):
for bucket in s3.buckets.all():
@sanampatel
sanampatel / s3_buckets.py
Created October 13, 2019 19:04
Print all S3 Buckets name from AWS Lambda Function
import json
import boto3
print('Loading function')
s3 = boto3.resource('s3')
def lambda_handler(event, context):
for bucket in s3.buckets.all():
@sanampatel
sanampatel / laravel_migration.txt
Created July 29, 2019 19:45
Commands to run after Laravel git clone or after project migration
#Clone your project from git
composer install
npm install
copy .env.example .env
OR
cp .env.example .env
php artisan key:generate
@sanampatel
sanampatel / laravel_deploy.txt
Last active July 31, 2024 10:37
Laravel Deploy Script after git pull
# GIT MERGE OPTIONS DEPENDING HOSTING OR DEPLOYMENT PROVIDERS
# git checkout -- .
# git checkout .
# git merge
# php artisan down || true
# Put the application into maintenance / demo mode
php artisan down
# GIT Clear current generated files so can pull new ones
@sanampatel
sanampatel / netlify.toml
Last active July 26, 2019 16:31
netlify.toml file configuration for Jigsaw production publish on Netlify without npm
[build]
command = "./vendor/bin/jigsaw build production"
publish = "build_production"
[build.environment]
PHP_VERSION=7.2
# Just use major releases like 7.1, 7.2, 7.3