Skip to content

Instantly share code, notes, and snippets.

View Jeff2Ma's full-sized avatar

Jeff Ma Jeff2Ma

View GitHub Profile
<?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 / Dorm-network.scpt
Last active August 19, 2019 05:17
Automatic proxy configuration set pac file with applescript & shell script http://devework.com/automatic-proxy-configuration-pac-applescript.html
tell application "System Events"
tell network preferences
do shell script "scselect 'Dorm'"
do shell script "sudo networksetup -setairportpower AirPort on" user name "用户名" password "密码" with administrator privileges
do shell script "open /Applications/Shad**socksX.app" user name “用户名" password "密码" with administrator privileges
end tell
end tell
@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/
@Jeff2Ma
Jeff2Ma / handlebar.md
Created May 18, 2016 13:00 — forked from aliencode/handlebar.md
handlebar 方法参考文档

handlebar 方法参考文档

介绍

Handlebars是JavaScript一个语义模板库,通过对view和data的分离来快速构建Web模板。它采用"Logic-less template"(无逻辑模版)的思路,在加载时被预编译,而不是到了客户端执行到代码时再去编译, 这样可以保证模板加载和运行的速度。Handlebars兼容Mustache,你可以在Handlebars中导入Mustache模板。

使用与安装

Handlebars的安装非常简单,你只需要从Github下载最新版本,你也可访问下面网址获取最新信息:http://handlebarsjs.com。 目前handlebars.js已经被许多项目广泛使用了,handlebars是一个纯JS库,因此你可以像使用其他JS脚本一样用script标签来包含handlebars.js

@Jeff2Ma
Jeff2Ma / alfred-json-format.sh
Created August 11, 2016 12:01
Alfred Script Filter JSON format
#
# Alfred Script Filter JSON format
#
# This example demonstrates all fields available for populating results.
#
# For an in-depth explanation, use the (?) help button to the bottom left.
#
cat << EOB
{"items": [
@Jeff2Ma
Jeff2Ma / gulpfile.js
Created December 29, 2016 11:16
Gulp reload on gulpfile.js change
// Gulp restart when gulpfile is changed
var spawn = require('child_process').spawn;
gulp.task('gulp-autoreload', function() {
// Store current process if any
var p;
gulp.watch('gulpfile.js', spawnChildren);
// Comment the line below if you start your server by yourslef anywhere else
spawnChildren();
04f368761186cf61ac7bf2d48a6bf8d3892a6a928fb8593c449faf29135dbd871dd8dc4bfd4e6c02fd4303d7c53559da2a05a85a69c018ded4f1944cd1137a8a6b