Skip to content

Instantly share code, notes, and snippets.

View JakeLin's full-sized avatar

Jake Lin JakeLin

View GitHub Profile
@JakeLin
JakeLin / 10118-create-app-clips-for-other-businesses-article-zh.md
Last active November 15, 2021 19:44
Create app clips for other businesses 中文

这是一个 Draft,更新会在 https://github.com/JakeLin/wwdc2020/blob/master/10118-create-app-clips-for-other-businesses/10118-create-app-clips-for-other-businesses-article-zh.md

为其他商户构建 App Clips

WWDC20 10118 - Create app clips for other businesses 视频

概述

这个主题讲述如何为其他商户构建 App Clips 体验,例如某外卖 App 如何帮各个不同餐饮商户构建基于他们自己品牌的 App Clips 来支持预定餐桌,点餐等服务。只需在一个主 App 中创建唯一的 App Clips 库就可以为不同商户提供各自独特的 App Clip 体验。同时讲述了 App Clips 的最佳实践,包括如何上传独特的商户信息,处理入口链接,路由推送消息,处理存储和恢复会话状态等等。也讲述了各种 App Clips 体验图标类型的差异性,如何呈现和定制这些图标。

const EC = require('elliptic').ec
const BN = require('bn.js')
const ec = new EC('secp256k1')
const G = ec.g; // Generator point
const keccak256 = require('js-sha3').keccak256
// Refer to https://etherworld.co/2017/11/17/understanding-the-concept-of-private-key-public-key-and-address-in-ethereum-blockchain
/// Get public key from private key. `privateKey` is private key in buffer
const getPublickKeyFromPrivateKey = (privateKey) => {
if (!(privateKey instanceof Buffer)) {
const findPrivateKeyForAddress = (privateKeyStr, addressStr) => {
if (typeof privateKeyStr !== 'string') {
throw new TypeError('param privateKeyStr must be of String');
} else if (typeof addressStr !== 'string') {
throw new TypeError('param addressStr must be of String');
}
const hexStr = '0123456789abcdef'
const targetAddress = Buffer.from(addressStr, 'hex')
{"sig":"908651afdbca939d462c6aa14593fbc0be88c9f93e32bc3efa53d15902b72d10ce9a1d416ec65c9f54f9979981cfe76e27b08e71b92818647c79bfbb44fec0731","msghash":"aa8d8317afa83028d875a62bab5ca3f1d3319fb985cb6891a8d2b23fd357719a"}
@JakeLin
JakeLin / github-wiki-toc.js
Last active August 29, 2015 14:27
Generate Table of Contents for GitHub Wiki using Markdown
// Generate Table of Contents for GitHub Wiki using Markdown
// How to Use
// 1. Open the Wiki page in a modern browser, for example, Chrome
// 2. Open the Console of the developer tools using F12 or ⌥ + Cmd + I
// 3. Copy the code below
// 4. Run it in the Console, it will generate Markdown for "Table of Contents"
// 5. Copy and Paste in your Wiki page.
(function () {
var toc = '**Table of Contents**\n';