Skip to content

Instantly share code, notes, and snippets.

View saeedvir's full-sized avatar
🎯
Focusing

saeed abdollahian saeedvir

🎯
Focusing
View GitHub Profile
@saeedvir
saeedvir / clean_code.md
Created February 9, 2024 03:45 — forked from alisalehi1380/clean_code.md
نکات_کلیدی_کتاب_کلین_کد
کدی تمیز است که به راحتی توسط همه ی اعضای تیم قابل درک باشد. کد تمیز میتواند توسط توسعه دهنده ای به غیر از نویسنده ی آن، خوانده و توسعه داده شود. خوانایی، قابلیت نگهداری، تغییر و توسعه پذیری کد، تنها زمانی امکان پذیر است که شما درک درستی از نحوه ی کار کد پیدا کنید.

قوانین عمومی

  1. از قوانین استاندارد (مثل: نام گذاری کلاس ها و توابع، میزان فرورفتگی یا ایندنتیشن و ...) پیروی کنید. ([Standard Conventions][Standard Conventions])
  2. تا حد امکان پیچیدگی را در کد کاهش دهید. همیشه سادگی بهتر است. (قانون [KISS][KISS])
  3. سورس کد را تمیز تر از زمانی که تحویل می گیرید، تحویل دهید. (قانون [Boy Scout][Boy Scout])
@saeedvir
saeedvir / after_install_kali.sh
Created February 3, 2024 16:26
after_install_kali.sh
DNS:
178.22.122.100
185.51.200.2
-----------------------
sudo apt install software-properties-common
sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup
sudo echo "deb http://http.kali.org/kali kali-rolling main non-free contrib" | sudo tee /etc/apt/sources.list
sudo apt update
@saeedvir
saeedvir / spatie laravel-medialibrary__save_media_without_a_model_relationship
Last active January 17, 2024 03:07
spatie/laravel-medialibrary , save media without a model relationship
#1- Create `Media` Model In App\Models
<?php
namespace App\Models;
use Spatie\MediaLibrary\HasMedia;
use Illuminate\Database\Eloquent\Model;
use Spatie\MediaLibrary\InteractsWithMedia;
@echo off
color 0A
title laravel task cronjob for windows © Er.DhruvMishra
Echo.
echo Drag n Drop the artisan file of your project here
echo (it is located in your project folder)
set /p ap=
cls
:starx
SCHTASKS /Create /SC MINUTE /TN laravel /TR "php %ap% schedule:run"
@saeedvir
saeedvir / Laravel_UpdateOrCreateOrIncrement
Last active January 5, 2024 03:52
Laravel UpdateOrCreateOrIncrement
<?php
YourModel::updateOrCreate(
[
'user_id' => '1',
'user_type' => 'admin'
],
[
'user_id' => '1',
'user_type' => 'admin',
'value' => DB::raw('value + 1'),
@saeedvir
saeedvir / TinyMCE Upload image and laravel
Last active December 1, 2023 02:30
TinyMCE Upload image + laravel
/*
* Laravel Route Or Controller
*/
Route::post('tinymce-upload', function (Request $request) {
#Check For Upload (add your security !!!)
$fileName = request()->file('file')->getClientOriginalName();
$path = request()->file('file')->storeAs('uploads', $fileName, 'public');
return response()->json(['location' => "/storage/$path"]);
@saeedvir
saeedvir / Debug.php
Created November 21, 2022 05:03 — forked from sunel/Debug.php
PHP Pretty var_dump
<?php
class Debug {
/**
* A collapse icon, using in the dump_var function to allow collapsing
* an array or object
*
* @var string
*/
@saeedvir
saeedvir / Laravel Data Masking (Encode & Decode Model fields ) Trait
Last active October 19, 2022 07:35
Laravel Data Masking (Encode & Decode Model fields ) Trait
/*
** saeed abdollahian
** Freelance PHP developer & consultant. Laravel specialist.
** Freelance (available)
** https://t.me/PhpWebDeveloper
*/
<?php
namespace App;
/*
@saeedvir
saeedvir / cloudSettings
Last active August 4, 2020 03:53
my Vscode Settings
{"lastUpload":"2020-08-04T03:52:57.654Z","extensionVersion":"v3.4.3"}
@saeedvir
saeedvir / create png from text in php
Created February 19, 2020 14:46
create png from text in php
<?php
$to_store ='test-file.png';
$img_data=null;
$fontSize = 20;
$imgWidth = 400;
$imgHeight = 80;
$angle = 0;
$font = 'font_name.ttf';