Skip to content

Instantly share code, notes, and snippets.

alhoseany alhoseany

Block or report user

Report or block alhoseany

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
alhoseany / gist:635ec60c5b36fcf3648a4d7497232957
Created Jul 25, 2019 — forked from ozh/gist:8169202
Human readable time difference between 2 dates in PHP
View gist:635ec60c5b36fcf3648a4d7497232957
* 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
View add-custom-menu-item-and-endpoint-to-woocommerce-my-account-page.php
/* 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 /
Created May 6, 2019 — forked from santerref/
Simple bash script to synchronize your WordPress dev (local) with your staging or production.
alhoseany / emails.php
Created May 6, 2019 — forked from tameemsafi/emails.php
Send an email programmatically in wordpress with wp_mail using the woocommerce transaction emails template.
View emails.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 / wp-config.php
Created Apr 5, 2019
check debug output in wordpress with a get variable
View wp-config.php
// brought to you by Liam Bailey
// That way if I want to see the output I just add ?dbg_smrand to the url and presto
define('wp_debug', true);
define('wp_debug_log', true);
define('wp_debug_display, isset($_GET['dbg_smrand']));
alhoseany /
Created Apr 4, 2019 — forked from shark0der/
Mailcatcher installation script for Ubuntu 16.04 (14.04 commands commented out)
# 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
View control.css
.removeInput {
position: absolute;
right: 15px;
z-index: 999;
background-color: white;
display: block;
border-radius: 10px;
font-size: 10px;
line-height: 20px;
width: 20px;
View gist:9f3a521f376a50120c2b754a74f5aaa3
Run this command to install MG-CLI:
sudo apt-get update && wget -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
alhoseany / functions.php
Created Apr 28, 2018
Example of Use cases for Filters
View functions.php
* code #1 - update the post excerpt character length
* @param integer
* @return integer
function my_excerpt_length($length)
return 65;
alhoseany / functions.php
Created Apr 28, 2018
Example of Use cases for Actions
View functions.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);
You can’t perform that action at this time.