Skip to content

Instantly share code, notes, and snippets.


Denis Žoljom dingo-d

View GitHub Profile
MindyPostoff / disable-paypal-woocommerce
Last active Jan 16, 2017
Disable PayPal in WooCommerce Checkout for Certain Products
View disable-paypal-woocommerce
* Disable PayPal payment method in the checkout if certain
* products are present in the cart.
* Add this to your theme's functions.php file
add_filter( 'woocommerce_available_payment_gateways', 'filter_gateways', 1);
function filter_gateways( $gateways ){
global $woocommerce;
runcom / update-vagrant
Last active Jun 1, 2017
Shell script to upgrade your vagrant to the latest version
View update-vagrant
ONLINE_VERSION=$(curl -s | grep -i 'x86_64.deb' | sed 's/.*\/vagrant_\(.*\)_x86_64\.deb.*/\1/i'
SYSTEM_VERSION=$(vagrant --version) | sed 's/^vagrant \(.*\)$/\1/i'
VAGRANT_CHECK=$(command -v vagrant >/dev/null 2>&1)
#if [ "$VAGRANT_CHECK" = 1 ]; then
pippinsplugins / gist:9201867
Created Feb 25, 2014
Simple example of how to use SCRIPT_DEBUG to load non-minified assets
View gist:9201867
// Use minified libraries if SCRIPT_DEBUG is turned off
$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
wp_enqueue_script( 'my-script-handle', plugin_dir_url( __FILE__ ) . 'assets/my-file' . $suffix . '.js', array( 'jquery' ) );
brasofilo / comments-2-excel.php
Last active Apr 1, 2018
Export WordPress Comments as Excel file. Uses PHPExcel, Place this file in the root of the WordPress installation. TODO: convert to plugin.
View comments-2-excel.php
# Load slim WP
define( 'WP_USE_THEMES', false );
require( './wp-load.php' );
require_once dirname(__FILE__) . '/Classes/PHPExcel.php';
global $wpdb;
$query = "SELECT * FROM $wpdb->comments
View JSLint Options Descriptions
anon true, if the space may be omitted in anonymous function declarations
bitwise true, if bitwise operators should be allowed
browser true, if the standard browser globals should be predefined
cap true, if upper case HTML should be allowed
continue true, if the continuation statement should be tolerated
css true, if CSS workarounds should be tolerated
debug true, if debugger statements should be allowed
devel true, if logging should be allowed (console, alert, etc.)
eqeq true, if == should be allowed
es5 true, if ES5 syntax should be allowed
lysender / using-aws-kms.php
Created Nov 10, 2015
View using-aws-kms.php
use Aws\Kms\KmsClient;
// Somewhere in the controller or model
// Not needed for EC2 instance role based authorization - for my local instance only
$key = $this->config->item('aws_s3_access_key');
$secret = $this->config->item('aws_s3_secret_key');
DomenicF / get_current_post_type.php
Last active Mar 12, 2020 — forked from bradvin/get_current_post_type.php
Get the current post_type context in the WordPress admin.
View get_current_post_type.php
* gets the current post type in the WordPress Admin
function get_current_post_type() {
global $post, $typenow, $current_screen;
//we have a post so we can just get the post type from that
if ( $post && $post->post_type ) {
return $post->post_type;
adamsilverstein / expanded_alowed_tags
Last active Apr 16, 2020
WordPress expanded allowed tags for wp_kses with iframe, forms, etc.
View expanded_alowed_tags
function expanded_alowed_tags() {
$my_allowed = wp_kses_allowed_html( 'post' );
// iframe
$my_allowed['iframe'] = array(
'src' => array(),
'height' => array(),
'width' => array(),
'frameborder' => array(),
'allowfullscreen' => array(),
esausilva /
Last active Oct 7, 2020
Find non-ASCII characters

One-liner for finding non-ASCII characters

# Linux
$ grep --color='auto' -P -n "[\x80-\xFF]" file.js

# Mac OS X after 'brew install pcre'
$ pcregrep --color='auto' -n "[\x80-\xFF]" file.js
fsuste /
Last active Oct 23, 2020
List of problematic gems and fixes

Eventmachine 1.0.8.

You can also update eventmachine to 1.0.9. and that should fix the problem

gem install eventmachine -v '1.0.8' -- --with-cppflags=-I/usr/local/opt/openssl/include

Nokogiri 1.6.*