Skip to content

Instantly share code, notes, and snippets.

@t1ger-0527
t1ger-0527 / Church Encoding (Part 2).ipynb
Last active November 9, 2018 10:55
Church Encoding (Part 2)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@t1ger-0527
t1ger-0527 / Church Encoding.ipynb
Created October 26, 2018 06:46
Church Encoding (Part 1)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@t1ger-0527
t1ger-0527 / Y Combinator.ipynb
Created October 26, 2018 06:40
Y Combinator
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@t1ger-0527
t1ger-0527 / ls-script.sh
Created August 30, 2018 07:03
Look up all scripts in this node project.
cat package.json | jq .scripts
@t1ger-0527
t1ger-0527 / requestMultipleAnimationFrame.js
Last active July 26, 2018 08:44
Call something after multiple animation frame. So-called requestMultipleAnimationFrame
function requestMultipleAnimationFrame(cb, times) {
if (times === 1) {
return requestAnimationFrame(cb);
} else {
return requestAnimationFrame(() => {
requestMultipleAnimationFrame(cb, times - 1);
});
}
}
@t1ger-0527
t1ger-0527 / SomeComponent.jsx
Last active June 7, 2021 14:51
pass-dataset
import mapKeys from 'lodash/mapKeys'
const toKebabDataSet = (dataSet = {}) => {
return mapKeys(
dataSet,
(_, key) => 'data-' + key.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase()
)
}
export default (props) => {
@t1ger-0527
t1ger-0527 / wechatScene.d.ts
Last active April 18, 2018 02:50
Entrance scenes for wechat mini app as TS enum.
export enum WechatScene {
DISCOVER = 1001, // 发现栏小程序主入口
TOP_SEARCH_RESULT = 1005, // 顶部搜索框的搜索结果页
DISCOVER_SEARCH_RESULT = 1006, // 发现栏小程序主入口搜索框的搜索结果页
MESSAGE_CARD = 1007, // 单人聊天会话中的小程序消息卡片
GROUP_MESSAGE_CARD = 1008, // 群聊会话中的小程序消息卡片
SCAN_QRCODE = 1011, // 扫描二维码
PRESS_QRCODE = 1012, // 长按图片识别二维码
ALBUM_QRCODE = 1013, // 手机相册选取二维码
TEMPLATE_MESSAGE = 1014, // 小程序模版消息