Skip to content

Instantly share code, notes, and snippets.

View fmtarif's full-sized avatar

Faisal Muhammad fmtarif

View GitHub Profile
@fmtarif
fmtarif / composer.json
Created June 4, 2022 08:25 — forked from secrethash/composer.json
Laravel Helper Function to create a Unique slug based on Provided Model Instance. Save 'slugify_model.php' in your 'app/Helpers/' directory and update your composer.json to reference and autoload the helper function.
{
...
"autoload": {
"psr-4": {
"App\\": "app/",
"Database\\Factories\\": "database/factories/",
"Database\\Seeders\\": "database/seeders/"
},
"files": [
...
@fmtarif
fmtarif / deploy_ee.sh
Last active April 12, 2022 18:42
#bash take a php project git repo and deploy it in containers using easyengine (ee)
#!/bin/bash
#take a php project git repo and deploy it in containers using easyengine (ee)
set -e
domain="test.host.com"
app_path="/opt/easyengine/sites/${domain}/app/htdocs"
gitrepo="https://repo_url"
doc_root_realive_to_app_path="repo/src/public"
@fmtarif
fmtarif / .htaccess
Created July 29, 2021 16:39
#htaccess basic htaccess content
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule . index.html [L]
@fmtarif
fmtarif / index.sh
Created July 25, 2021 08:37
#scripts #cli #devops a local script to keep within project dir in git and run ssh cmds remotely
#! /usr/bin/env bash
DIR="$( dirname "$_" )"
DIR=${DIR/\./} #if script invoked like ./index then remove the dot
commands=("sshprod", "sshproddeploy")
echo ${commands[@]}
@fmtarif
fmtarif / bkash_total_received.php
Last active July 15, 2021 17:13
#php Bkash - Parse number of bkash messages and get total received amount
<?php
//messages.txt sample content
/*
You have received Tk 800.00 from 0199999999.Ref XYZ. Fee Tk 0.00. Balance Tk 0.00. TrxID XYZABC at 15/07/2021 11:00
You have received deposit from iBanking of Tk 1,000.00 from Eastern Bank Limited Internet Banking. Fee Tk 0.00. Balance Tk 0.00. TrxID XYZABC at 14/07/2021 16:43
Cash In Tk 3,260.00 from 0199999999 successful. Fee Tk 0.00. Balance Tk 0.00. TrxID XYZABC at 14/07/2021 20:19. Download App: https://bKa.sh/8app
*/
@fmtarif
fmtarif / debug.css
Created July 2, 2021 20:36
Debug CSS layouts - Adds outline to elements
/* from https://www.freecodecamp.org/news/heres-my-favorite-weird-trick-to-debug-css-88529aa5a6a3/ */
*:not(path):not(g) { color: hsla(210, 100%, 100%, 0.9) !important; background: hsla(210, 100%, 50%, 0.5) !important; outline: solid 0.25rem hsla(210, 100%, 100%, 0.5) !important; box-shadow: none !important;}
@fmtarif
fmtarif / eedeploy.sh
Created June 24, 2021 19:14
#cli #bash #server take a php project git repo and deploy it in containers using easyengine (ee)
#!/bin/bash
#take a php project git repo and deploy it in containers using easyengine (ee)
set -e
domain="example.com"
app_path="/opt/easyengine/sites/${domain}/app/htdocs"
gitrepo="https://github.com/laravel/laravel.git"
doc_root_realive_to_app_path="public"
@fmtarif
fmtarif / unique-random.php
Created June 19, 2021 22:22
#php generate unique random numbers within a range
<?php
//https://stackoverflow.com/a/24493651
function unique_randoms($min, $max, $count) {
$arr = array();
while(count($arr) < $count){
$tmp =mt_rand($min,$max);
if(!in_array($tmp, $arr)){
$arr[] = $tmp;
}
@fmtarif
fmtarif / EloquentCheatSheet.md
Created April 25, 2020 21:45 — forked from avataru/EloquentCheatSheet.md
Eloquent relationships cheat sheet
@fmtarif
fmtarif / BackupDatabase.php
Last active April 12, 2020 08:13
#laravel Database dump laravel console command
<?php //from: https://pineco.de/scheduling-mysql-backups-with-laravel/ ?>
<?php
namespace App\Console\Commands;
use File;
use Illuminate\Console\Command;
use Symfony\Component\Process\Process;
use Symfony\Component\Process\Exception\ProcessFailedException;