Skip to content

Instantly share code, notes, and snippets.

View xhat's full-sized avatar
🤒
Out sick

xhat xhat

🤒
Out sick
View GitHub Profile
@xhat
xhat / index.html
Last active August 16, 2018 15:36
payjs前端发起jsapi支付的demo
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="format-detection" content="telephone=no">
<meta name="format-detection" content="email=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<link href="https://cdn.bootcss.com/weui/1.1.2/style/weui.min.css" rel="stylesheet">
<script src="https://cdn.bootcss.com/zepto/1.2.0/zepto.min.js"></script>
<?php
class Payjs
{
private $url = 'https://payjs.cn/api/native';
private $key = ''; // 填写通信密钥
private $mchid = ''; // 特写商户号
public function __construct($data=null) {
$this->data = $data;
}
<div class="mainbody">
<div class="demo_title">演示代码</div>
<div class="blank"></div>
<p id="m-radio">
<input type="radio" name="money" value="10" checked > 0.1元
<input type="radio" name="money" value="500" > 5元
<input type="radio" name="money" value="1000" > 10元
<input type="radio" name="money" value="5000" > 50元
</p>
<div class="main">
<div class="hr">演示代码</div>
<p><input id="money" name=money placeholder="输入金额,单位:分"></p>
<p>
<input type="radio" name="pay" value="wxpay" checked > 微信支付
<input type="radio" name="pay" value="alipay" > 支付宝
<input type="radio" name="pay" value="jdpay" > 京东钱包
<input type="radio" name="pay" value="qpay" > QQ钱包
@xhat
xhat / sign.php
Last active June 7, 2017 23:04
payjs.cn签名方法
<?php
/**
* 签名方法:
* 1.把所有参数根据参数名首字母asc码排序
* 2.以键值 http querystring 方式连接
* 3.取md5值转化为大写
*/
function sign(array $data)
#!/usr/bin/env python
#-*- coding: utf-8 -*-
import sys
import logging
import datetime
import requests
import BeautifulSoup
from requests.adapters import HTTPAdapter
#/bin/bash
URL="http://192.168.5.100/xxx.php"
check() {
RESULT=$(curl -s $URL)
echo $RESULT
if [ "$RESULT" -eq "1111" ] ; then
echo "again"
import urllib2
def xiami_decode(s):
s = s.strip()
if not s:
return False
result = []
line = int(s[0])
rows = len(s[1:]) / line
extra = len(s[1:]) % line
@xhat
xhat / gist:4544210
Last active December 11, 2015 04:18
<!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>
<title>Test Page</title>
<style>
#main{width:500px;}
li{list-style:none;font-size:14px;line-height:26px;}
a{color:#000; text-decoration:none;}
a:hover{color:red; text-decoration:none;}
.right{float:right;}
alias cd=x1
function x1() {
builtin cd "$@"
ls | head -20
}
--------------------------------
贴gist到v2ex的方法是直接粘贴链接如:
http://gist.github.com/3952722
--------------------------------