Skip to content

Instantly share code, notes, and snippets.

View Jeff2Ma's full-sized avatar

Jeff Ma Jeff2Ma

View GitHub Profile
<!--
iOS Web App Basic Html Code.
Url:http://devework.com/ios-7-web-app.html
Thanks: https://gist.github.com/tfausak/2222823
-->
<!--meta tag-->
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, minimal-ui" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
@Jeff2Ma
Jeff2Ma / Javascript-chinese-unicode.html
Created August 12, 2014 15:30
Javascript 汉字编码转换
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
<!--
.btn{
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
<?php
/**
* Plugin Name: WooCommerce Subscriptions Product Removed Message
* Description: Display a notice on checkout when a product was removed from the cart after a subscription was added.
* Author: Gerhard Potgieter & Brent Shepherd
* Author URI:
* Version: 1.1
* License: GPL v2
*/
@Jeff2Ma
Jeff2Ma / test1.php
Created September 9, 2014 13:10
测试是否为5.3,5.4、支持zend 组件否、支持一些php 函数否 的代码
<?php
//测试是否为5.3,5.4、支持zend 组件否、支持一些php 函数否
//原始来源 http://www.smyx.net/
$funs_list = array('close_curl', 'close_fopen', 'close_http', 'file_get_contents', 'zend_loader_enabled');
if (!function_exists('close_curl')) {
function close_curl() {
if (!extension_loaded('curl')) {
return " <span style=\"color:blue\">请在php.ini中打开扩展extension=php_curl.dll</span>";
@Jeff2Ma
Jeff2Ma / test2.php
Created September 9, 2014 13:11
测试是否为5.2-5.4、支持zend 组件否、支持一些php 函数否 的代码
<?php
//验证是否为5.2、5.3、5.4 、支持zend 组件否、支持一些php 函数否
//原始来源 http://www.smyx.net/
$funs_list = array('close_curl', 'close_fopen', 'close_http', 'file_get_contents', 'zend_loader_enabled');
if (!function_exists('close_curl')) {
function close_curl() {
if (!extension_loaded('curl')) {
return " <span style=\"color:blue\">请在php.ini中打开扩展extension=php_curl.dll</span>";
@Jeff2Ma
Jeff2Ma / functions.php
Last active August 29, 2015 14:06 — forked from kloon/functions.php
<?php
// Add the code below to your theme's functions.php file to add a confirm password field on the register form under My Accounts.
add_filter('woocommerce_registration_errors', 'registration_errors_validation', 10,3);
function registration_errors_validation($reg_errors, $sanitized_user_login, $user_email) {
global $woocommerce;
extract( $_POST );
if ( strcmp( $password, $password2 ) !== 0 ) {
return new WP_Error( 'registration-error', __( 'Passwords do not match.', 'woocommerce' ) );
}
<?php
/**
* Plugin Name: WooCommerce - Show order IDs
* Plugin URI: http://www.remicorson.com/easily-find-woocommerce-order-id/
* Description: Adds a new columns to order list page to display order IDs
* Version: 1.0
* Author: Remi Corson
* Author URI: http://remicorson.com
* Requires at least: 3.5
* Tested up to: 3.5
add_action( 'woocommerce_before_cart', 'apply_matched_coupons' );
function apply_matched_coupons() {
global $woocommerce;
$get1 = 'getonech'; // your coupon code here
$get2 = 'gettwoch'; // your coupon code here
$get3 = 'getthreech'; // your coupon code here
$get4 = 'getfourch'; // your coupon code here
$get5 = 'getfivech'; // your coupon code here
@Jeff2Ma
Jeff2Ma / dangdang.py
Last active August 29, 2015 14:16
DangDang book contents txt catched by Python
# -*- coding: utf-8 -*-
#当当网图书目录抓取
#已经实现抓取目录
#实现写入到txt文件中
#新增匹配字符串
#新增书名抓取(略有bug)
#作者:Jeffma @ https://gist.github.com/Jeff2Ma/24f6c49877ebbfec9900
#参考 http://blog.csdn.net/nwpulei/article/details/7272832
import urllib2
@Jeff2Ma
Jeff2Ma / surge.conf
Created December 5, 2015 09:57
自用的surge config 文件,代码已经删除账号信息
#surge.conf
[General]
skip-proxy = 192.168.0.0/16, 10.0.0.0/8, 172.0.0.0/8, localhost, *.local, e.crashlytics.com, *.jd.com
bypass-tun = 0.0.0.0/8, 1.0.0.0/9, 1.160.0.0/11, 1.192.0.0/11, 10.0.0.0/8, 14.0.0.0/11, 14.96.0.0/11, 14.128.0.0/11, 14.192.0.0/11, 27.0.0.0/10, 27.96.0.0/11, 27.128.0.0/9, 36.0.0.0/10, 36.96.0.0/11, 36.128.0.0/9, 39.0.0.0/11, 39.64.0.0/10, 39.128.0.0/10, 42.0.0.0/8, 43.224.0.0/11, 45.64.0.0/10, 47.64.0.0/10, 49.0.0.0/9, 49.128.0.0/11, 49.192.0.0/10, 54.192.0.0/11, 58.0.0.0/9, 58.128.0.0/11, 58.192.0.0/10, 59.32.0.0/11, 59.64.0.0/10, 59.128.0.0/9, 60.0.0.0/10, 60.160.0.0/11, 60.192.0.0/10, 61.0.0.0/10, 61.64.0.0/11, 61.128.0.0/10, 61.224.0.0/11, 100.64.0.0/10, 101.0.0.0/9, 101.128.0.0/11, 101.192.0.0/10, 103.0.0.0/10, 103.192.0.0/10, 106.0.0.0/9, 106.224.0.0/11, 110.0.0.0/7, 112.0.0.0/9, 112.128.0.0/11, 112.192.0.0/10, 113.0.0.0/9, 113.128.0.0/11, 113.192.0.0/10, 114.0.0.0/9, 114.128.0.0/11, 114.192.0.0/10, 115.0.0.0/8, 116.0.0.0/8, 117.0.0.0/9, 117.128.0.0/10, 118.0.0.0/11, 118.64.0.0/