Skip to content

Instantly share code, notes, and snippets.

View chengpeiquan's full-sized avatar
:octocat:
微信小程序搜 “底迪” 关注我的菜谱

chengpeiquan chengpeiquan

:octocat:
微信小程序搜 “底迪” 关注我的菜谱
View GitHub Profile
@rxaviers
rxaviers / gist:7360908
Last active July 23, 2024 12:26
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@pbojinov
pbojinov / README.md
Last active July 23, 2024 00:41
Two way iframe communication- Check out working example here: http://pbojinov.github.io/iframe-communication/

Two way iframe communication

The main difference between the two pages is the method of sending messages. Recieving messages is the same in both.

Parent

Send messages to iframe using iframeEl.contentWindow.postMessage Recieve messages using window.addEventListener('message')

iframe

@sindresorhus
sindresorhus / esm-package.md
Last active July 23, 2024 10:30
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
@chengpeiquan
chengpeiquan / 📊 Weekly development breakdown
Last active July 21, 2024 00:23
Weekly development breakdown
TypeScript 54 hrs 48 mins ██████████████████▌░ 92.5%
Bash 2 hrs 5 mins ▋░░░░░░░░░░░░░░░░░░░ 3.5%
JSON 53 mins ▎░░░░░░░░░░░░░░░░░░░ 1.5%
JavaScript 43 mins ▏░░░░░░░░░░░░░░░░░░░ 1.2%
CSS 34 mins ▏░░░░░░░░░░░░░░░░░░░ 1.0%

编辑 ~/.cargo/config ,修改第 3 - 5 行:

[source.crates-io]
registry = "https://github.com/rust-lang/crates.io-index"
replace-with = 'tuna'
[source.tuna]
registry = "https://mirrors.tuna.tsinghua.edu.cn/git/crates.io-index.git"

这里以使用 TypeScript 开发,以及使用 Axios 库发起请求的例子。

没接触过 TypeScript 的话可以看下我之前的文章,有一个开发入门介绍: 快速上手 TypeScript

管理 Avata 配置

因为需要切换测试环境和生产环境,所以这里把配置单独保存在 config 里了,类型是:

// src/config/avata.ts
import {
DetailedHTMLProps,
HTMLAttributes,
ReactNode,
useCallback,
useEffect,
useRef,
useState,
} from 'react';
@chengpeiquan
chengpeiquan / complete-list-of-github-markdown-emoji-markup.md
Last active April 29, 2023 17:30 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue: