This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const crypto = require('crypto') | |
const axios = require('axios') | |
const url = 'https://mp.weixin.qq.com/wxagame/wxagame_settlement' | |
const sessionId = 'your session id' | |
function getActionData(key, content, iv) { | |
const clearEncoding = 'utf8' | |
const cipherEncoding = 'base64' | |
let cipherChunks = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 加密解密 | |
*/ | |
var crypto = require('crypto'); | |
var _p = {}; | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<!-- xlsx.js (C) 2013-present SheetJS http://sheetjs.com --> | |
<!-- vim: set ts=2: --> | |
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | |
<title>JS-XLSX Demo</title> | |
</head> | |
<body> | |
<pre> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const app = { | |
callback (ctx) { | |
console.log(ctx) | |
}, | |
use (fn) { | |
app.middleware = app.middleware || [] | |
app.middleware.push(fn) | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function _LazyMan(name) { | |
this.tasks = []; | |
var self = this; | |
var fn =(function(n){ | |
var name = n; | |
return function(){ | |
console.log("Hi! This is " + name + "!"); | |
self.next(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// promise 和 reduce | |
(function() { | |
function sequenceTasks(tasks) { | |
function recordValue(results, value) { | |
results.push(value); | |
return results; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// http://stackoverflow.com/questions/30362733/handling-errors-in-promise-all | |
// https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Promise/all | |
(function() { | |
function randomNum(min, max) { | |
return Math.floor(Math.random() * (max - min) + min); | |
} | |
function upload(file) { | |
return new Promise(function(resolve, reject) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* nodejs下载文件 | |
*/ | |
var fs = require('fs'); | |
var url = require('url'); | |
var http; | |
/** |