Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Abdulrahman elzahaby el3zahaby

🏠
Working from home
View GitHub Profile
@el3zahaby
el3zahaby / variousCountryListFormats.js
Created Jul 15, 2020 — forked from incredimike/variousCountryListFormats.js
Country list as javascript array (alphabetical)
View variousCountryListFormats.js
// Lists of countries with ISO 3166 codes, presented in various formats.
// Last Updated: Nov 15, 2019
// If you're using PHP, I suggest checking out:
// https://github.com/thephpleague/iso3166
//
// JS developers can check out:
// https://www.npmjs.com/package/iso3166-2-db
// List of all countries in a simple list / array.
View dynamic ajax submit.js
$('form').submit(function (event) {
event.preventDefault();
var _this = $(this);
$.ajax({
type: "POST",
url: _this.attr('action'),
data: new FormData(this),
processData: false,
contentType: false,
success: function (data) {
@el3zahaby
el3zahaby / auto replace SRC,HREF with Laravel functions.md
Last active Jun 9, 2020
[laravel asset function] how to auto replace SRC,HREF with Laravel function using regex
View auto replace SRC,HREF with Laravel functions.md

This is the best I have so far using regex:

Find:

<((?!\s*((a)\s+))\w+)(.*?)((?:src|href)\s*=\s*")((?!\{\{\s*)[^"]+)"

Replace with:

<$1$4$5{{ asset('$6') }}"
@el3zahaby
el3zahaby / remove duplicates item from object in array javascript.js
Last active Jun 1, 2020
remove duplicates item from object in array [v-for]
View remove duplicates item from object in array javascript.js
const arr = [
{ id: 1, name: "king" },
{ id: 2, name: "master" },
{ id: 3, name: "lisa" },
{ id: 4, name: "ion" },
{ id: 5, name: "jim" },
{ id: 6, name: "gowtham" },
{ id: 1, name: "jam" },
{ id: 1, name: "lol" },
{ id: 2, name: "kwick" },
@el3zahaby
el3zahaby / .htaccess
Last active Jun 5, 2020
Laravel 5-6 – Remove Public from URL
View .htaccess
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/public/
RewriteRule ^(.*)$ /public/$1 [L,QSA]
View country.php
DB::table('data_location_country')->delete();
$data = array(
['slug' => 'AF', 'title' => 'Afghanistan', 'native' => 'غانستان'],
['slug' => 'AX', 'title' => 'Åland Islands', 'native' => 'Åland'],
['slug' => 'AL', 'title' => 'Albania', 'native' => 'Shqipëri'],
['slug' => 'DZ', 'title' => 'Algeria', 'native' => 'الجزائر'],
['slug' => 'AS', 'title' => 'American Samoa', 'native' => ''],
['slug' => 'AD', 'title' => 'Andorra', 'native' => ''],
['slug' => 'AO', 'title' => 'Angola', 'native' => ''],
['slug' => 'AI', 'title' => 'Anguilla', 'native' => ''],
@el3zahaby
el3zahaby / ElzahabyDynamicLaravelString.php
Last active Nov 14, 2019
make 'string syntax' to dynamic Laravel php
View ElzahabyDynamicLaravelString.php
function ElzahabyDynamicLaravelString($model,$syntax,$sign=null){
if (isset($model) && $syntax == null){
$input = $model::getListFields()['syntax'];
}else {
$input = $syntax;
}
$output = $input;
$regex = '/'.(($sign != null)?$sign:':-:').'[a-z._]+/im';
if (preg_match_all($regex, $input, $matches, PREG_PATTERN_ORDER)) {
@el3zahaby
el3zahaby / #laravel-Setup.md
Last active Oct 5, 2019
"routes/console.php" laravelSetup is command line to start setup for Laravel 6
View #laravel-Setup.md

laravelSetup

laravelSetup is command line to start setup for Laravel 6

path of file: routes/console.php

after you just create a blank Laravel Project, you will need this artisan setup command line. with any blank Laravel just add this file to routes/console.php and call composer install && php artisan setup to make everything set up to, finally do your job

this setup command line made specific for Laravel version 6 with by A.El-zahaby egy.js

this includes :

View dns.txt
www
mail
ftp
localhost
webmail
smtp
pop
ns1
webdisk
ns2
@el3zahaby
el3zahaby / php-html-css-js-minifier.php
Created Jul 10, 2019 — forked from Rodrigo54/php-html-css-js-minifier.php
PHP Function to Minify HTML, CSS and JavaScript
View php-html-css-js-minifier.php
<?php
/**
* -----------------------------------------------------------------------------------------
* Based on `https://github.com/mecha-cms/mecha-cms/blob/master/system/kernel/converter.php`
* -----------------------------------------------------------------------------------------
*/
// HTML Minifier
function minify_html($input) {
You can’t perform that action at this time.