Skip to content

Instantly share code, notes, and snippets.

View gre-dev's full-sized avatar
🏠
Working from home

GRE Development Ltd. gre-dev

🏠
Working from home
View GitHub Profile
@davmixcool
davmixcool / countries.php
Created January 19, 2020 22:32
Country Name, Codes, Currency and Symbols
<?php
$countries = array(
array('name' => 'Afghanistan','iso_alpha2' => 'AF','iso_alpha3' => 'AFG','iso_numeric' => '4','calling_code' => '93','currency_code' => 'AFN','currency_name' => 'Afghani','currency_symbol' => '؋'),
array('name' => 'Albania','iso_alpha2' => 'AL','iso_alpha3' => 'ALB','iso_numeric' => '8','calling_code' => '355','currency_code' => 'ALL','currency_name' => 'Lek','currency_symbol' => 'Lek'),
array('name' => 'Algeria','iso_alpha2' => 'DZ','iso_alpha3' => 'DZA','iso_numeric' => '12','calling_code' => '213','currency_code' => 'DZD','currency_name' => 'Dinar','currency_symbol' => ''),
array('name' => 'American Samoa','iso_alpha2' => 'AS','iso_alpha3' => 'ASM','iso_numeric' => '16','calling_code' => '1684','currency_code' => 'USD','currency_name' => 'Dollar','currency_symbol' => '$'),
array('name' => 'Andorra','iso_alpha2' => 'AD','iso_alpha3' => 'AND','iso_numeric' => '20','calling_code' => '376','currency_code' => 'EUR','currency_name' => 'Euro','currency_symbol' => '€'),
array
@expressiveco
expressiveco / MyWeb.js
Last active June 27, 2023 15:36
Refreshing React Native WebView to initial url
export default class MyWeb extends Component {
mainUrl = "https://facebook.github.io/";
state = {
url: this.mainUrl,
};
render() {
return [
<WebView
key="comp1"
@ianklatzco
ianklatzco / discord-bot-post-message.py
Created December 29, 2016 02:29
sends messages to a discord channel using a bot via http POST
# post a message to discord api via a bot
# bot must be added to the server and have write access to the channel
# you may need to connect with a websocket the first time you run the bot
# use a library like discord.py to do so
import requests
import json
channelID = "your_id_goes_here" # enable dev mode on discord, right-click on the channel, copy ID
botToken = "your_token_here" # get from the bot page. must be a bot, not a discord app
@iamravenous
iamravenous / jquery.smooth-scroll-pageload.js
Last active April 23, 2024 09:05
Smooth scrolling on page load if URL have a hash
/*
* Smooth Scroll on Pageload
* Smooth scrolling on page load if URL have a hash
* Author: Franco Moya - @iamravenous
*/
if (window.location.hash) {
var hash = window.location.hash;
if ($(hash).length) {
@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>
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
@homaily
homaily / gist:8672499
Last active May 2, 2024 07:30
Regex to validate saudi mobile numbers

السلام عليكم ، هذا كود ريجيكس بسيط للتحقق من صحة أرقام الجوالات السعودية ، يقوم الريجيكس بالتحقق من مفتاح الدولة ، مفتاح شركة الإتصالات لضمان صحة النص المدخل .

Hello, this is a simple regex to validate saudi mobile numbers, the code will validate country code, telecome company code and make sure the tested sting is correct .

/^(009665|9665|\+9665|05|5)(5|0|3|6|4|9|1|8|7)([0-9]{7})$/

Regex Breakdown - شرح الكود

@josephilipraja
josephilipraja / countries.php
Last active April 17, 2024 05:42
List of Countries with Country code & Telephone (Dial) Code as a PHP Array. Bonus: PHP function to list all Countries as HTML Select Tag Options with their 2 character Country code as values
<?php
$countryArray = array(
'AD'=>array('name'=>'ANDORRA','code'=>'376'),
'AE'=>array('name'=>'UNITED ARAB EMIRATES','code'=>'971'),
'AF'=>array('name'=>'AFGHANISTAN','code'=>'93'),
'AG'=>array('name'=>'ANTIGUA AND BARBUDA','code'=>'1268'),
'AI'=>array('name'=>'ANGUILLA','code'=>'1264'),
'AL'=>array('name'=>'ALBANIA','code'=>'355'),
'AM'=>array('name'=>'ARMENIA','code'=>'374'),
'AN'=>array('name'=>'NETHERLANDS ANTILLES','code'=>'599'),
@cferdinandi
cferdinandi / has-characters.php
Last active January 7, 2024 11:58
Test strings for letters, numbers, and special characters. Returns true if they exist, false if they don't. Forked from http://stackoverflow.com/a/9588010/1293256
<?php
// Does string contain letters?
function _s_has_letters( $string ) {
return preg_match( '/[a-zA-Z]/', $string );
}
// Does string contain numbers?
function _s_has_numbers( $string ) {
return preg_match( '/\d/', $string );