This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Show locally installed Python versions. With pyenv virtualenv installed this | |
# also lists local virtualenvs | |
pyenv versions | |
# List Python versions which are available to install | |
pyenv install --list | |
# Install Python version 2.7.14. See `pyenv install --list` for available <versions> | |
pyenv install <version> | |
# E.g. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env bash | |
# Examples: | |
# ./image64.sh myImage.png | |
# outputs: data:image/png;base64,xxxxx | |
# ./image64.sh myImage.png -img | |
# outputs: <img src="data:image/png;base64,xxxxx"> | |
function usage { | |
echo "usage: $0 <image_filename> [--img]" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Change srcset URLs to https if the page is loaded via https | |
* Activate with: | |
* | |
* add_filter( 'wp_calculate_image_srcset', 'zbs_fix_srcset_for_https' ); | |
* | |
* @param array $sources array of sources used in srcset. | |
* @return array | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Quick hack to preview WooCommerce e-mails. | |
* Based on drrobotnik's answer from Stack Overflow: http://stackoverflow.com/a/27072101/186136 | |
* | |
* Add this to <yourtheme>/functions.php and then visit a url like: | |
* http://<site_url>/wp-admin/admin-ajax.php?action=previewemail | |
* | |
* @return null | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter('posts_orderby', 'zbyte_edit_posts_orderby'); | |
function zbyte_edit_posts_orderby($orderby_statement) { | |
global $wp_query; | |
$is_product_list = | |
is_shop() || | |
is_product_category() || | |
is_product_tag(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;(function ($) { | |
/** | |
* Return an object consisting of properties of 'data' | |
* that match the regex 'pattern'. If trim is not false, | |
* trim the matched 'pattern' from the property name, | |
* and make the first char of the remaining property | |
* name lowercase. | |
*/ | |
function filterData(data, pattern, trim) { | |
var data, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
0 2 * * * /usr/bin/find /FIXME/PATH/TO/DOMAIN.COM/var/session -mindepth 1 -maxdepth 1 -type f -cmin +$(/usr/lib/php5/maxlifetime) -print0 -exec rm {} \; >/dev/null 2>&1 |