Skip to content

Instantly share code, notes, and snippets.

/* Add custom menu item and endpoint to WooCommerce My-Account page */
function my_custom_endpoints() {
add_rewrite_endpoint( 'refunds-returns', EP_ROOT | EP_PAGES );
}
add_action( 'init', 'my_custom_endpoints' );
// so you can use is_wc_endpoint_url( 'refunds-returns' )
add_filter( 'woocommerce_get_query_vars', 'my_custom_woocommerce_query_vars', 0 );
@alhoseany
alhoseany / gist:635ec60c5b36fcf3648a4d7497232957
Created July 25, 2019 02:33 — forked from ozh/gist:8169202
Human readable time difference between 2 dates in PHP
<?php
/**
* Get human readable time difference between 2 dates
*
* Return difference between 2 dates in year, month, hour, minute or second
* The $precision caps the number of time units used: for instance if
* $time1 - $time2 = 3 days, 4 hours, 12 minutes, 5 seconds
* - with precision = 1 : 3 days
* - with precision = 2 : 3 days, 4 hours
@alhoseany
alhoseany / sync.sh
Created May 6, 2019 21:54 — forked from santerref/sync.sh
Simple bash script to synchronize your WordPress dev (local) with your staging or production.
#/bin/bash
REMOTE_URL="https://staging.example.com"
LOCAL_URL="http://example.dev"
REMOTE_PATH="/home/staging_example/public_html"
LOCAL_PATH="/var/www/example.dev"
SSH_HOST="user@staging.example.com"
@alhoseany
alhoseany / emails.php
Created May 6, 2019 19:59 — forked from tameemsafi/emails.php
Send an email programmatically in wordpress with wp_mail using the woocommerce transaction emails template.
<?php
// Define a constant to use with html emails
define("HTML_EMAIL_HEADERS", array('Content-Type: text/html; charset=UTF-8'));
// @email - Email address of the reciever
// @subject - Subject of the email
// @heading - Heading to place inside of the woocommerce template
// @message - Body content (can be HTML)
function send_email_woocommerce_style($email, $subject, $heading, $message) {
@alhoseany
alhoseany / setup_mailcatcher.sh
Created April 4, 2019 18:33 — forked from shark0der/setup_mailcatcher.sh
Mailcatcher installation script for Ubuntu 16.04 (14.04 commands commented out)
#!/bin/bash
# Install dependencies
# older ubuntus
#apt-get install build-essential libsqlite3-dev ruby1.9.1-dev
# xenial
apt install build-essential libsqlite3-dev ruby-dev
# Install the gem
gem install mailcatcher --no-ri --no-rdoc
.removeInput {
position: absolute;
right: 15px;
z-index: 999;
background-color: white;
display: block;
border-radius: 10px;
font-size: 10px;
line-height: 20px;
width: 20px;
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 <YOUR@EMAIL.KAPPA> -bcn 4
Feel free to send some of your earnings to me:
BTC (Don't attempt to send other coins to this address!): 17f77AYHsQbdsB1Q6BbqPahJ8ZrjFLYH2j
<?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 / 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 / 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>