Skip to content

Instantly share code, notes, and snippets.

SELECT p.ID, DATE_FORMAT(p.post_date'%Y.%m.%d.'), pp.post_title AS 'coupon_title' 
FROM `wp_posts` AS `p` 
JOIN `wp_postmeta` AS `pm` ON pm.meta_value = p.ID 
JOIN `wp_posts` AS `pp` ON pm.post_id = pp.ID 
WHERE p.`post_type` LIKE 'shop_order' AND pm.meta_key LIKE '_used_by'  
.menu-item-496 a:after {
content: "\f07a";
font: normal normal normal 20px/1 FontAwesome;
position: absolute;
top: 34%;
visibility: visible;
}
.menu-item-496 a {
visibility: hidden;
<?php
public function couponDiscount($cart)
{
$discount = 100; //test value
if ($discount > 0) {
// TODO: fix tax exclusion
$cart->add_fee(__("Custom discount"), -$discount);
}
}
@dokker
dokker / startRP.php
Last active August 26, 2016 12:33 — forked from anonymous/startRP.php
/**
* Set recurring payment for PMGW request
* @param int $amount donation amount
* @return object PMGW request
*/
private function startRP($amount, $provider = 'PayPal')
{
try {
/**
* Initialize new PMGW request
@dokker
dokker / touchpad_toggle.sh
Created January 15, 2016 09:18
PS/2 Touchpad toggle
#!/bin/bash
# https://wiki.archlinux.org/index.php/Touchpad_Synaptics#Software_toggle
declare -i ID
ID=`xinput list | grep -Eio 'touchpad\s*id\=[0-9]{1,2}' | grep -Eo '[0-9]{1,2}'`
declare -i STATE
STATE=`xinput list-props $ID|grep 'Device Enabled'|awk '{print $4}'`
if [ $STATE -eq 1 ]
then
xinput disable $ID
@dokker
dokker / .Spotify-AdKiller.log
Created November 2, 2015 13:48
spotify adkiller log
## Music path: /mnt/STORAGE/_projects ##
## Using cvlc for local playback ##
## Ad block mode: automute_simple ##
XPROP_DEBUG: WM_ICON_NAME(STRING) = "Spotify"
DBUS_DEBUG: method return time=1446471054.350589 sender=:1.119 -> destination=:1.122 serial=9 reply_serial=2
array [
dict entry(
string "mpris:artUrl"
variant string "http://open.spotify.com/thumb/48283369db65730439a355e545e92611d0f3575c"
)
@dokker
dokker / str_to_float
Last active August 29, 2015 14:23
php string to float
$str_rate = $this->settings['zones_form_'.$i.'_fee'];
$final_rate = (float)$str_rate;
$debug_arr = array(
'$str_rate' => $str_rate,
'$str_rate type' => gettype($str_rate),
'$final_rate' => $final_rate,
'$final_rate type' => gettype($final_rate),
);
print_r($debug_arr);
@dokker
dokker / .vimrc.after
Created June 29, 2015 07:06
.vimrc.after for Janus vim dist
"""""""""""""""""""""""""""
" General
"""""""""""""""""""""""""""
" Set zsh to shell
set shell=/usr/bin/zsh
" Set case behaviour
set ignorecase
set smartcase
@dokker
dokker / slimlock-abandoned.patch
Created December 5, 2012 13:40
slimlock-abandoned
11,12c11,12
< source=(https://github.com/joelburget/slimlock/tarball/v0.11)
< md5sums=('00189f3343a99ebc578a489185e9ba1b')
---
> source=(https://github.com/joelburget/slimlock-ABANDONED/archive/master.tar.gz)
> md5sums=('319528bf2bb4b0d4c60c58e3b7d07ea7')
16c16
< cd "$srcdir/joelburget-slimlock-5d40c62"
---
> cd "$srcdir/slimlock-ABANDONED-master"
@dokker
dokker / config
Created March 21, 2012 14:10
ncmpcpp config by Zariel
####################################################
## this is example configuration file, copy it to ##
## ~/.ncmpcpp/config and set up your preferences ##
####################################################
#
##### connection settings #####
#
## set it in order to make tag editor and renaming files work properly
#
#mpd_host = "localhost"