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 / injectResource.js
Created May 1, 2025 03:35
Injects an external resource (script or stylesheet) into the current HTML document
/**
* Injects an external resource (script or stylesheet) into the current HTML document
*
* @param {string} url - The URL of the resource to inject
* @param {string} type - The type of resource ('script' or 'style')
* @param {function} [callback] - Optional callback function (only for scripts) that executes after loading
*/
function injectResource(url, type, callback) {
// Variable to hold the DOM element we'll create
let element;
@saeedvir
saeedvir / Script_Loading_Example.html
Last active February 11, 2025 03:04
This JavaScript snippet dynamically loads external scripts with a delay after the page has fully loaded.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Script Loader Example</title>
</head>
<body>
<h1>Script Loading Example</h1>
@saeedvir
saeedvir / density_of_points.php
Created December 5, 2024 04:28
how with php Get the density of points in the coordinate plane?
<?php
$points = [
[3, 4], [7, 9], [12, 15], // Coordinates
[18, 5], [20, 25]
];
$grid_size = 10;
$grid_density = [];
@saeedvir
saeedvir / refreshAndCleanup.bat
Created December 2, 2024 05:10
refresh and cleanup windows and network
@echo off
:: ============================
:: Batch File for System Cleanup and Memory Release
:: ============================
:: Ensure the script is run as administrator
net session >nul 2>&1
if %errorLevel% neq 0 (
echo Please run this script as administrator.
pause
@saeedvir
saeedvir / web.php
Last active November 26, 2024 20:19
Laravel QR-Code Verification Code
<?php
// composer require sebastiandevs/simplethenticator
use Illuminate\Http\Request;
use src\SimpleAuthenticator;
use Illuminate\Support\Facades\Route;
Route::get('/', function () {
$auth = new SimpleAuthenticator(6, 'SHA1');
try
{
@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])