Skip to content

Instantly share code, notes, and snippets.

@AmrMekkawy
AmrMekkawy / timezones-per-country.json
Created May 1, 2024 14:20 — forked from riamaria/timezones-per-country.json
JSON of Timezone Names per Alpha 2 Country Code + ALL
{"ALL":["Africa/Abidjan","Africa/Accra","Africa/Addis_Ababa","Africa/Algiers","Africa/Asmara","Africa/Asmera","Africa/Bamako","Africa/Bangui","Africa/Banjul","Africa/Bissau","Africa/Blantyre","Africa/Brazzaville","Africa/Bujumbura","Africa/Cairo","Africa/Casablanca","Africa/Ceuta","Africa/Conakry","Africa/Dakar","Africa/Dar_es_Salaam","Africa/Djibouti","Africa/Douala","Africa/El_Aaiun","Africa/Freetown","Africa/Gaborone","Africa/Harare","Africa/Johannesburg","Africa/Juba","Africa/Kampala","Africa/Khartoum","Africa/Kigali","Africa/Kinshasa","Africa/Lagos","Africa/Libreville","Africa/Lome","Africa/Luanda","Africa/Lubumbashi","Africa/Lusaka","Africa/Malabo","Africa/Maputo","Africa/Maseru","Africa/Mbabane","Africa/Mogadishu","Africa/Monrovia","Africa/Nairobi","Africa/Ndjamena","Africa/Niamey","Africa/Nouakchott","Africa/Ouagadougou","Africa/Porto-Novo","Africa/Sao_Tome","Africa/Timbuktu","Africa/Tripoli","Africa/Tunis","Africa/Windhoek","America/Adak","America/Anchorage","America/Anguilla","America/Antigua","Amer
/**
* Remove diacritics (tashkeel) from Arabic text
*
* @author @AmrMekkawy
* @param string $text arabic text with diacritics (tashkeel)
* @return string arabic text without the diacritics (tashkeel)
*/
function remove_tashkeel($text = '')
{
$text_without_tashkeel = str_replace(['َ', 'ً', 'ُ', 'ٌ', 'ِ', 'ٍ', 'ْ', 'ّ'], '', $text);
@AmrMekkawy
AmrMekkawy / arabic-country-dropdown-list.html
Created May 17, 2015 10:24
Arabic countries HTML "select" element (dropdown list)
<!-- Country List in Arabic | source: https://github.com/umpirsky/country-list -- >
<select name="country">
<option value="AW">آروبا</option>
<option value="AZ">أذربيجان</option>
<option value="AM">أرمينيا</option>
<option value="ES">أسبانيا</option>
<option value="AU">أستراليا</option>
<option value="AF">أفغانستان</option>
<option value="AL">ألبانيا</option>
<option value="DE">ألمانيا</option>
@AmrMekkawy
AmrMekkawy / currency-dropdown-list.html
Last active April 8, 2023 15:03
Currency HTML "select" element (dropdown list)
<select name="">
<option value="USD" selected="selected">United States Dollars</option>
<option value="EUR">Euro</option>
<option value="GBP">United Kingdom Pounds</option>
<option value="DZD">Algeria Dinars</option>
<option value="ARP">Argentina Pesos</option>
<option value="AUD">Australia Dollars</option>
<option value="ATS">Austria Schillings</option>
<option value="BSD">Bahamas Dollars</option>
<option value="BBD">Barbados Dollars</option>
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs/Observable';
import 'rxjs/add/observable/fromPromise';
import 'rxjs/add/observable/throw';
import 'rxjs/add/operator/map';
declare var qz: any;
@AmrMekkawy
AmrMekkawy / index.php
Last active December 29, 2021 16:38
Factory Method Design Pattern - Conceptual Example in PHP
<?php
# Source: https://refactoring.guru/design-patterns/factory-method/php/example#example-0
namespace RefactoringGuru\FactoryMethod\Conceptual;
/**
* The Creator class declares the factory method that is supposed to return an
* object of a Product class. The Creator's subclasses usually provide the
* implementation of this method.
@AmrMekkawy
AmrMekkawy / DTFromID.java
Created November 15, 2021 13:27 — forked from Zelakolase/DTFromID.java
National ID to get data from
import java.util.HashMap;
public class DTFromID {
static HashMap<String, String> GovIDMap = new HashMap<String, String>(){
{
put("01","Cairo"); put("02","Alexandria"); put("03","Portsaid"); put("04","Suez"); put("11","Damietta"); put("12","Daqahlia"); put("13","Sharkia"); put("14","Qalyobia"); put("15","Kafr El-sheikh");
put("16","Gharbia"); put("17","Monufia"); put("18","Beheira"); put("19","Ismailia"); put("21","Giza"); put("22","Bani Suef"); put("23","Fayum"); put("24","Menya"); put("25","Asuit");
put("27","Qena"); put("28","Aswan"); put("29","Luxor"); put("31","Red Sea"); put("32","Alwady Algaded"); put("33","Matrouh"); put("34","North Sinai"); put("35","South Sinai"); put("88","N/A");
}
};
@AmrMekkawy
AmrMekkawy / pivot-tables.md
Created October 29, 2020 10:18 — forked from Braunson/pivot-tables.md
Laravel 8.x - Diving into Pivot Tables

Laravel 6 - Diving Into Pivot Tables

Pivot tables can be confusing and a little hard to wrap your head around at first. In this quick article we are going to dive into what a pivot table is, how to create one and finally how to use the pivot table. Let's dive in!

What is a pivot table?

A pivot table is used to connect relationships between two tables. Laravel provides a Many To Many relationship where you can use a pivot table.

@AmrMekkawy
AmrMekkawy / deployment_guide.md
Created April 24, 2020 14:34 — forked from vicgonvt/deployment_guide.md
Deployment Guide for Ubuntu Server from Scratch with Laravel
@AmrMekkawy
AmrMekkawy / functions.php
Created August 27, 2018 15:30
Force download a file with PHP
<?php
/**
* Force Download
*
* Generates headers that force a download to happen
* Example usage:
* force_download( 'screenshot.png', './images/screenshot.png' );
*
* Source: https://goo.gl/fhTaW4