Skip to content

Instantly share code, notes, and snippets.

View ZhenhangTung's full-sized avatar
🎯
Focusing

Zhenhang Tung ZhenhangTung

🎯
Focusing
  • Transsion
  • Shanghai
  • 07:33 (UTC +08:00)
View GitHub Profile
@ZhenhangTung
ZhenhangTung / jdpay.rb
Last active November 2, 2022 06:55
How to request JDPay's create order API using backend instead of official recommended method
# 用Ruby来写一下如何用后端请求京东支付的创建订单API,而不是用京东官方文档推荐的使用前端来组成一个Form表单,这样写的优势是能和支付宝形成统一的逻辑。
# 思路适用所有语言。
# 非官方SDK:https://github.com/jasl/wx_pay,目前我公司在使用,但有个TODO是我要修复新用户的redirect,用下面我使用的方案,之前的方案有疏漏。PR会稍后开启。
params = {
# 请按照官方文档组合
}
# url = https://h5pay.jd.com/jdpay/saveOrder or https://wepay.jd.com/jdpay/saveOrder
WEB_BASE_URL = 'https://wepay.jd.com'
@ZhenhangTung
ZhenhangTung / multiple_ssh_setting.md
Created May 15, 2018 07:03 — forked from jexchan/multiple_ssh_setting.md
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"
@ZhenhangTung
ZhenhangTung / asymmetric.go
Created April 17, 2018 06:38 — forked from cryptix/LICENSE
example of using JWT for http authentication in go
package main
// using asymmetric crypto/RSA keys
import (
"crypto/rsa"
"fmt"
"io/ioutil"
"log"
"net/http"
@ZhenhangTung
ZhenhangTung / rsa_encryption.go
Created August 8, 2017 08:36
The code is in this question(https://stackoverflow.com/q/20655702/3970355). It's about how to load rsa key and do the sign and unsign.
package main
import (
"crypto"
"crypto/rand"
"crypto/rsa"
"crypto/sha256"
"crypto/x509"
"encoding/base64"
"encoding/pem"
@ZhenhangTung
ZhenhangTung / php7dev.md
Last active November 23, 2015 02:04
php7dev

上期Code Review需要改进的点

  • 微信项目的不规范的大小写问题
  • 将一些不适合作为model的类放到新的命名空间
  • 改掉不合理的switch
  • 获取收藏列表的需要分页(涉及前端,统一改版)
  • 收藏功能加入事务(未完成)

微信项目的不规范的大小写问题

将驼峰命名发

@ZhenhangTung
ZhenhangTung / gist:6927c1fa60fbb51889bf
Last active August 29, 2015 14:24
资产收藏/微信公众号

1.资产收藏API功能:
1)获取收藏的资产
2)添加收藏
3)取消收藏
4)改变收藏的顺序


数据库UML