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 / .htaccess
Created March 12, 2024 05:21 — forked from gaelbillon/.htaccess
custom htaccess for speed, cache, gzip, ETags, etc
### ENVIRONMENT VARIABLES ###
#SetEnv PHP_VER 5
#SetEnv REGISTER_GLOBALS 0
### MAIN DEFAULTS ###
Options All -Indexes
DirectoryIndex index.html index.htm index.php
AddDefaultCharset UTF-8
### MIME TYPES ###
@saeedvir
saeedvir / phpdangerousfuncs.md
Created February 24, 2024 07:28 — forked from mccabe615/phpdangerousfuncs.md
Dangerous PHP Functions

Command Execution

exec           - Returns last line of commands output
passthru       - Passes commands output directly to the browser
system         - Passes commands output directly to the browser and returns last line
shell_exec     - Returns commands output
\`\` (backticks) - Same as shell_exec()
popen          - Opens read or write pipe to process of a command
proc_open      - Similar to popen() but greater degree of control
pcntl_exec - Executes a program
@saeedvir
saeedvir / php_get_server_info.php
Last active February 15, 2024 08:14
php get server info (+shared-host) without use COM
<?php
/*
Saeed Abdollahian
Telegram:
https://t.me/PhpWebDeveloper
*/
function getServerLoad()
{
$load = 0;
@saeedvir
saeedvir / pint.json
Created February 10, 2024 07:29
laravel pint.json file example (install pint and create pint.json in your roject)
{
"preset": "laravel",
"exclude": [
"storage",
"bootstrap/cache"
],
"rules": {
"concat_space": {
"spacing": "one"
},
@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"]);