Skip to content

Instantly share code, notes, and snippets.

View 1oo1's full-sized avatar

Henry Zhang 1oo1

  • ChongQing
View GitHub Profile
@1oo1
1oo1 / stringify.ts
Last active September 27, 2022 03:07
js/ts 简易定制 stringify
function myJsonify(json: any, level = 0): string {
let result = '';
if (Array.isArray(json)) {
result += "[\n";
for (const item of json) {
for (let i = 0; i < level * 2 + 2; i++) {
result += ' ';
}
result += `${myJsonify(item, level + 1)},\n`;
@1oo1
1oo1 / main.py
Last active January 12, 2022 11:57
小程序参数二维码生成
import requests as rq
import json
# 获取 access_token
url = 'https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=YOUR_APP_ID&secret=YOUR_SECRET'
res = rq.get(url)
json = res.json()
access_token = json['access_token']
# print(access_token)