Skip to content

Instantly share code, notes, and snippets.

View mahdyar's full-sized avatar
🌱

Mahdyar Hasanpour mahdyar

🌱
View GitHub Profile
@mahdyar
mahdyar / cPanel.yml
Created September 8, 2021 20:56
Deploy to cPanel with GitHub Actions (FTP)
name: Deploy to cPanel
on:
push:
branches:
- master
jobs:
FTP-Deploy-Action:
name: FTP-Deploy-Action
runs-on: ubuntu-latest
steps:
@mahdyar
mahdyar / verify-github-webhook.php
Created August 13, 2021 10:09
Verify GitHub webhook request sha256 in PHP
<?php
// It's better to be exported as an environment variable or in a .env file.
define("SECRET", "<SECRET>");
$body = file_get_contents("php://input");
// $decodedBody = json_decode(urldecode($body));
if (verifySignature($body) !== false) {
// verified
@mahdyar
mahdyar / bustan.js
Last active January 19, 2024 12:14
پرکردن نظرسنجی‌های بوستان به صورت خودکار | Select Bustan survey checkboxes
var allInputs = document.getElementsByTagName("input");
for (var i = 0, max = allInputs.length; i < max; i++){
if (allInputs[i].type === 'checkbox' && allInputs[i].id.endsWith('_8'))
allInputs[i].checked = true;
}
@mahdyar
mahdyar / persian-first-names.txt
Last active April 9, 2024 11:25
A list of common Persian/ Iranian first names in English
aaxar
abadaleh
abazar
abbas
abbasali
abbasi
abdolali
abdolamir
abdolghani
abdolhamid
@mahdyar
mahdyar / AllowedUsername.php
Last active May 5, 2024 19:18
Prevent your users to register with your route paths like login, or reserved usernames as their usernames in Laravel. More: https://blog.mahdyar.me/2021/04/18/route-paths-and-reserved-usernames-in-laravel/
<?php
namespace App\Rules;
use Illuminate\Contracts\Validation\Rule;
use Illuminate\Support\Facades\Route;
class AllowedUsername implements Rule
{
/**