Skip to content

Instantly share code, notes, and snippets.

View moaalaa's full-sized avatar

Mohamed Alaa El-Din moaalaa

View GitHub Profile
@moaalaa
moaalaa / HomeController.php
Created May 4, 2024 18:39
Add Form Fields to googe sheet using google App Scrpts
<?php
namespace App\Http\Controllers;
use Http;
class HomeController extends Controller
{
use UsingSEO;
@moaalaa
moaalaa / my-theme.omp.json
Created March 11, 2024 15:58
My Oh My Posh Theme
{
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
"version": 2,
"final_space": true,
"blocks": [
{
"type": "prompt",
"alignment": "left",
"segments": [
{
@moaalaa
moaalaa / settings.json
Created March 7, 2024 12:06
Adding gitbash in windows terminal
{
"commandline": "C:\\Program Files\\Git\\bin\\bash.exe",
"guid": "{2cd05161-f869-4bbb-ad20-8ec1977fbdfe}",
"hidden": false,
"icon": "C:\\Program Files\\Git\\mingw64\\share\\git\\git-for-windows.ico",
"name": "Bash",
"startingDirectory": "E:\\work"
}
# To enable Install from "Anywhere" Source
sudo spctl --master-disable
/usr/local/bin/php /home/USERNAME/public_html/artisan schedule:run >> /dev/null 2>&1
@moaalaa
moaalaa / detect_visitor_patform.php
Created September 5, 2023 12:06
Detect Visitor Platform
<?php
function isAndroid()
{
if (isset($_SERVER['HTTP_USER_AGENT'])) {
return strpos($_SERVER['HTTP_USER_AGENT'], 'Android') ? true : false;
}
return false;
@moaalaa
moaalaa / carbon.php
Created August 15, 2023 15:58
Carbon translated locale
<?php
// Will format bu in en lang
$model->created_at->format('M, Y');
// Will translate the format to ar lang
$model->created_at->locale('ar')->translatedFormat('M, Y');
@moaalaa
moaalaa / prefix-columns.sql
Created August 14, 2023 14:49
prefix columns in mysql
# One Columns
UPDATE users SET email = CONCAT('lab_', email)
# Two Columns
UPDATE users SET email = CONCAT('lab_', email), phone = CONCAT('lab_', phone)
# Two Columns with condition
UPDATE users SET email = CONCAT('lab_', email), phone = CONCAT('lab_', phone) where type != 'admin'
@moaalaa
moaalaa / 01 - my.cnf
Created July 20, 2023 13:59
Enhance MySql Importing Config
# Path
# /etc/mysql/mycnf
# ...
[mysqld]
innodb_buffer_pool_size = 4G
innodb_log_buffer_size = 256M
innodb_log_file_size = 1G
innodb_write_io_threads = 16
@moaalaa
moaalaa / .htaccess
Created July 17, 2023 18:47
My lovely .htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
# Get Match After www. and access it by %1
# EX: (www.domain.com) will match (domain.com) without www.
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
# Redirect our match %1 (domain.com) with 301 and to HTTPS to not run next HTTPS rule
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]