- authenticationMethod 在各处必须是相同.
- 覆盖client.handleAuth方法, 在cb函数中将原有的packet返回, 不这样做, 会报undefined错误. 不明白为什么是这样.
const mqtt = require('mqtt')
const opt = {
protocolVersion: 5, // MQTT5
https://github.com/protobufjs/protobuf.js
> const protobuf = require('protobufjs');
> const root = new protobuf.Root();
> root.loadSync('./test.proto', {keepCase: true});
## 生成bytes32 | |
ethers.utils.formatBytes32String("") | |
空字符串时生成 0x00...00 | |
## 私钥 -> 公钥 -> 地址 |
//https://github.com/joho/godotenv | |
import ( | |
"log" | |
"os" | |
"github.com/joho/godotenv" | |
) | |
func main() { | |
err := godotenv.Load() |
```js | |
'use strict'; | |
const Boom = require('boom') | |
module.exports = { | |
lifecycles: { | |
beforeCreate: async (data) => { |
# basic usgae. | |
const { describe, expect, test, it } = require('@jest/globals') | |
beforeAll( async () => { }); | |
afterAll( async () => { }); | |
beforeEach(() => { }); | |
afterEach(() => { }); |
# basic usage. | |
```js | |
const Joi = require('joi') | |
const Schema = Joi.object({ | |
username: Joi.string().required().description('user name) | |
}) | |
// 如果失败, 抛出异常. | |
const value = await Schema.validateAsync(config) | |
// 同步返回value, 如果出错, error不为null |
const fs = require('fs') | |
const path = require('path') | |
const withLess = require('@zeit/next-less') | |
const lessToJS = require('less-vars-to-js') | |
require('dotenv').config() | |
// Where your antd-custom.less file lives | |
const themeVariables = lessToJS( | |
fs.readFileSync(path.resolve(__dirname, './assets/custom-less/antd-custom.less'), 'utf8') |
# create nextjs project. | |
会新建目录. | |
``` | |
npx create-next-app | |
``` | |
# import antd modules | |
1) next.config.js 中增加less相关的配置.(另见) | |
新建 ./assets/custom-less/antd-custom.less, 可在其中定义antd的theme变量. | |
注意, 使用css的地方暂时需要移除, 因为不能同时支持css和less |
npm set registry https://registry.npm.taobao.org && \ | |
npm set disturl https://npm.taobao.org/dist && \ | |
npm set sass_binary_site https://npm.taobao.org/mirrors/node-sass && \ | |
npm set electron_mirror https://npm.taobao.org/mirrors/electron/ && \ | |
npm set puppeteer_download_host https://storage.googleapis.com.cnpmjs.org && \ | |
npm set chromedriver_cdnurl https://npm.taobao.org/mirrors/chromedriver && \ | |
npm set operadriver_cdnurl https://npm.taobao.org/mirrors/operadriver && \ | |
npm set phantomjs_cdnurl https://npm.taobao.org/mirrors/phantomjs && \ | |
npm set selenium_cdnurl https://npm.taobao.org/mirrors/selenium && \ | |
npm set node_inspector_cdnurl https://npm.taobao.org/mirrors/node-inspector && \ |