Skip to content

Instantly share code, notes, and snippets.

<?php
$countries = array("Afghanistan", "Albania", "Algeria", "American Samoa", "Andorra", "Angola", "Anguilla", "Antarctica", "Antigua and Barbuda", "Argentina", "Armenia", "Aruba", "Australia", "Austria", "Azerbaijan", "Bahamas", "Bahrain", "Bangladesh", "Barbados", "Belarus", "Belgium", "Belize", "Benin", "Bermuda", "Bhutan", "Bolivia", "Bosnia and Herzegowina", "Botswana", "Bouvet Island", "Brazil", "British Indian Ocean Territory", "Brunei Darussalam", "Bulgaria", "Burkina Faso", "Burundi", "Cambodia", "Cameroon", "Canada", "Cape Verde", "Cayman Islands", "Central African Republic", "Chad", "Chile", "China", "Christmas Island", "Cocos (Keeling) Islands", "Colombia", "Comoros", "Congo", "Congo, the Democratic Republic of the", "Cook Islands", "Costa Rica", "Cote d'Ivoire", "Croatia (Hrvatska)", "Cuba", "Cyprus", "Czech Republic", "Denmark", "Djibouti", "Dominica", "Dominican Republic", "East Timor", "Ecuador", "Egypt", "El Salvador", "Equatorial Guinea", "Eritrea", "Estonia", "Ethiopia", "Falkland Island
@alhoseany
alhoseany / gist:d11b9bab4642a5db022b
Last active August 29, 2015 14:07
get time difference in milliseconds
function find_time_diff($t1, $t2, $ms=false) {
$time1_pcs = explode(":", $t1);
$time1_pcs2 = explode(".", $time1_pcs[2]);
$time2_pcs = explode(":", $t2);
$time2_pcs2 = explode(".", $time2_pcs[2]);
$time1_all_ms = ($time1_pcs[0] * 60 * 60 * 1000) + ($time1_pcs[1] * 60 * 1000) + ($time1_pcs2[0] * 1000) + $time1_pcs2[1];
$time2_all_ms = ($time2_pcs[0] * 60 * 60 * 1000) + ($time2_pcs[1] * 60 * 1000) + ($time2_pcs2[0] * 1000) + $time2_pcs2[1];
$time1_all_ms_dif = $time2_all_ms - $time1_all_ms;
@alhoseany
alhoseany / index.html
Last active September 5, 2016 21:48 — forked from pitch-gist/gist:2999707
HTML: Simple Maintenance Page
<!doctype html>
<title>Site Maintenance</title>
<style>
body { text-align: center; padding: 150px; }
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 650px; margin: 0 auto; }
a { color: #dc8100; text-decoration: none; }
a:hover { color: #333; text-decoration: none; }
</style>
@alhoseany
alhoseany / functions.php
Last active April 13, 2016 20:46
Redirect Buddypress profile edit screen to custom wordpress page
add_action('xprofile_screen_edit_profile', 'redirect_to_account_setup');
function redirect_to_account_setup(){
wp_redirect( get_permalink( get_page_by_path( 'account-setup' ) ) );
}
@alhoseany
alhoseany / arabic-country-dropdown-list.html
Last active June 3, 2016 22:29 — forked from AmrMekkawy/arabic-country-dropdown-list.html
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>
<?php
// CUSTOM ADMIN LOGIN HEADER LOGO
function my_custom_login_logo() {
echo '<style type="text/css"> h1 a { background-image:url('.get_bloginfo('template_directory').'/images/democratic-post-logo-google.jpg) !important; } </style>';
}
add_action('login_head', 'my_custom_login_logo');
// Die URL des Logos auf die eigene Website zeigen lassen
function gp_change_login_page_url($login_header_url) {
@alhoseany
alhoseany / functions.php
Created April 28, 2018 12:21
Example of Use cases for Actions
<?php
/**
* code #1 - removes excess Wordpress header tags from default themes.
*/
function clean_wp_header() {
remove_action('wp_head', 'wp_generator');
remove_action('wp_head', 'rel_canonical');
remove_action('wp_head', 'rsd_link');
remove_action('wp_head', 'feed_links',2);
@alhoseany
alhoseany / functions.php
Created April 28, 2018 12:28
Example of Use cases for Filters
<?php
/**
* code #1 - update the post excerpt character length
* @param integer
* @return integer
*/
function my_excerpt_length($length)
{
return 65;
Run this command to install MG-CLI:
sudo apt-get update && wget https://minergate.com/download/deb-cli -O minergate-cli.deb && sudo dpkg -i minergate-cli.deb
to start miner (4 cores for BCN) use this command:
minergate-cli -user <[email protected]> -bcn 4
Feel free to send some of your earnings to me:
BTC (Don't attempt to send other coins to this address!): 17f77AYHsQbdsB1Q6BbqPahJ8ZrjFLYH2j
.removeInput {
position: absolute;
right: 15px;
z-index: 999;
background-color: white;
display: block;
border-radius: 10px;
font-size: 10px;
line-height: 20px;
width: 20px;