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 | |
function maxArea($height) { | |
$result = 0; | |
// 第一個高度的位置 | |
for ($i = 0; $i < sizeof($height); $i++) { | |
// 第二個高度的位置 | |
for ($j = 1; $j < sizeof($height); $j++) { | |
// 相同高度不用和自己比較 | |
if ($i === $j) { | |
continue; |
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 | |
// Remove hook functions (include actions and filters) that were defined in instances of class. | |
function remove_hooked_functions_in_obj($hook_tag = false, $class_name = '', $function_name, $priority = 10) { | |
// Visit all hook tags if existed | |
if (!empty($GLOBALS['wp_filter']) && !empty($GLOBALS['wp_filter'][$hook_tag])) { | |
foreach($GLOBALS['wp_filter'][$hook_tag]->callbacks[$priority] as $callback) { | |
// You can use get_class($obj) to get the class name which object belong | |
if ( | |
$callback['function'] && | |
(is_a( $callback['function'][0], $class_name )) && |
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 | |
/* | |
Plugin Name: WC Data Getter | |
Plugin URI: | |
Description: For demonstration | |
Version: 1.0 | |
Author: audi | |
*/ | |
add_action( 'wp_head', 'my_ajax_form' ); |
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
SELECT DISTINCT ID, SUM(CONVERT(pm.meta_value, UNSIGNED INTEGER)) AS total, pm4.meta_value AS user_id, pm2.meta_value AS customer, pm3.meta_value AS email, pm5.meta_value AS mobile | |
FROM pm_posts AS pp | |
LEFT JOIN pm_postmeta AS pm ON pp.ID = pm.post_id | |
LEFT JOIN pm_postmeta AS pm2 ON pp.ID = pm2.post_id | |
LEFT JOIN pm_postmeta AS pm3 ON pp.ID = pm3.post_id | |
LEFT JOIN pm_postmeta AS pm4 ON pp.ID = pm4.post_id | |
LEFT JOIN pm_postmeta AS pm5 ON pp.ID = pm5.post_id | |
WHERE pp.post_status IN ('wc-processing', 'wc-completed') AND pm.meta_key = '_order_total' AND pm2.meta_key = '_billing_name' AND pm3.meta_key = '_billing_email' AND pm5.meta_key = '_billing_phone' AND pm4.meta_key = '_customer_user' AND pm4.meta_value != 0 | |
GROUP BY user_id | |
ORDER BY total DESC |
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 | |
/* | |
* arg: | |
* $msg: 要紀錄的內容,可用 string/array | |
* $source_name: 此 log 的別名,方便於後台辨識 | |
*/ | |
function my_wc_log($msg, $source_name) { | |
if (function_exists('wc_get_logger')) { | |
$log = wc_get_logger(); |
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
{ | |
"name": "coscup2017/iLoveWP", | |
"authors": [ | |
{ | |
"name": "AudiLu", | |
"email": "khl0327@gmail.com" | |
} | |
], | |
"autoload": { | |
"classmap": [ |
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
/* | |
This example demonstrate how to read pm2.5 value on PMS 3003 air condition sensor | |
PMS 3003 pin map is as follow: | |
PIN1 :VCC, connect to 5V | |
PIN2 :GND |
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
<form target="_blank" method=post action="http://payment-stage.allpay.com.tw/Cashier/AioCheckOut"><input type='text' name='AlipayItemCounts' value='1'><BR><input type='text' name='AlipayItemName' value='交易測試(測試)'><BR><input type='text' name='AlipayItemPrice' value='100'><BR><input type='text' name='ChoosePayment' value='ALL'><BR><input type='text' name='ClientBackURL' value='http://www.allpay.com.tw/receive.php'><BR><input type='text' name='Email' value='stage_test@allpay.com.tw'><BR><input type='text' name='ItemName' value='交易測試(測試)'><BR><input type='text' name='MerchantID' value='2000132'><BR><input type='text' name='MerchantTradeDate' value='2015/09/02 11:25:14'><BR><input type='text' name='MerchantTradeNo' value='StageTest1441185914'><BR><input type='text' name='NeedExtraPaidInfo' value='Y'><BR><input type='text' name='PaymentType' value='aio'><BR><input type='text' name='PhoneNo' value='0911222333'><BR><input type='text' name='ReturnURL' value='http://www.allpay.com.tw/receive.php'><BR><input type='text |