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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<!--https://developers.google.com/maps/documentation/javascript/tutorial?hl=zh-tw#HelloWorld--> | |
<meta charset="UTF-8"> | |
<title>Google Map</title> | |
<style type="text/css"> | |
html { height: 100% } | |
body { height: 100%; margin: 0; padding: 0 } | |
#location-map { height: 300px; } |
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 | |
$response = wp_remote_post($url, $args = array()); | |
$header_content = (array) wp_remote_retrieve_headers( $response ); | |
$header = current($header_content); | |
$data = wp_remote_retrieve_body( $response ); | |
if ( array_key_exists('content-type', $header) ) { | |
if ( $header['content-type'] === 'application/pdf') { | |
header("Content-type: application/pdf"); | |
header('Content-Length: '.strlen( $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
// http://coveroverflow.com/a/11381730/989439 | |
function mobilecheck() { | |
var check = false; | |
(function(a) { | |
if (/(android|ipad|playbook|silk|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t) |
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
package com.stanley; | |
import java.io.IOException; | |
import com.fasterxml.jackson.core.JsonProcessingException; | |
import com.fasterxml.jackson.databind.JsonNode; | |
import com.fasterxml.jackson.databind.ObjectMapper; | |
import com.fasterxml.jackson.databind.ObjectReader; | |
public class ReadStringToJsonNodeAndUpdateIt { |
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 | |
// registers the gateway | |
function pw_edd_register_gateway($gateways) { | |
$gateways['ecpay_credit'] = array( 'admin_label' => '綠界-信用卡', 'checkout_label' => __('綠界-信用卡', 'your_textdomain')); | |
return $gateways; | |
} | |
add_filter('edd_payment_gateways', 'pw_edd_register_gateway'); | |
// process the payment |
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
/** | |
* Get customer ip | |
* | |
* @return string | |
*/ | |
private function get_the_user_ip() { | |
if ( ! empty( $_SERVER['HTTP_CLIENT_IP'] ) ) { | |
// check ip from share internet |
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 | |
add_action('show_user_profile', 'mys_additional_profile_fields', 9); | |
add_action('edit_user_profile', 'mys_additional_profile_fields', 9); | |
function mys_additional_profile_fields($user) | |
{ | |
echo '<h2>連結的推薦人</h2>'; | |
$customer = affwp_get_customer($user->user_email); |
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 | |
// $raw_address = Array ( | |
// [first_name] => YU CHENG | |
// [last_name] => WANG | |
// [company] => | |
// [address_1] => 新北路 | |
// [address_2] => | |
// [city] => 板橋區 | |
// [state] => NEW TAIPEI CITY | |
// [postcode] => 100 |
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
git init | |
git add . | |
git commit -m "initial commit" | |
git remote add origin https://github.com/ucheng/your-repos.git | |
git push -u origin master |
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 | |
add_filter( 'woocommerce_marketing_menu_items', '__return_empty_array' ); |
NewerOlder