Skip to content

Instantly share code, notes, and snippets.

View teabyii's full-sized avatar
💭
I may be slow to respond.

Kent Li teabyii

💭
I may be slow to respond.
View GitHub Profile
import "dart:async";
void main() {
run();
}
Future<void> run() async {
int count = 0;
final timer = Timer.periodic(Duration(seconds:1), (timer) {
print(count++);
#!/bin/sh
git filter-branch --env-filter '
an="$GIT_AUTHOR_NAME"
am="$GIT_AUTHOR_EMAIL"
cn="$GIT_COMMITTER_NAME"
cm="$GIT_COMMITTER_EMAIL"
if [ "$GIT_COMMITTER_EMAIL" = "[Your Old Email]" ]
@teabyii
teabyii / Riot-compiler.md
Last active November 15, 2018 09:11
Riot-compiler 代码的简单解读

Riot 源码阅读笔记 -- compiler

关于 Riot 的 compiler,具体请见:[Riot compiler]

之前在 [Riot 源码阅读笔记] 中提到另挖坑来聊聊 Riot 提供的 template + logic compiler 是怎么干活的,于是有了这一篇文章... (其实大部分都是正则,正则)

Riot 提供了两种方式,分别是 pre-compile 和直接在页面使用 script[type="riot/tag"],都是用的同一个 compiler 来处理代码的解析,在真实环境时推荐使用 pre-compile 的方式。

在页面使用 script[type="riot/tag", src="path"] 和 React 在页面使用 script[type="text/jsx", src="path"] 一样,都是用了 ajax 来请求文件内容,跨域就拜拜了,请知悉。

{"sig":"0ce736f15f981be6f8bd16081ebd4adbd5d3d90ad61ec5af3865079f0722abacdd996399c0940ba711d8bb234e5702a5b5332d1ac474f2ae14795c3a164383271","msghash":"32213167cc4689a6350d08da5a5809d73a9cb655bfb7846aed4222d63960aa3f"}
@teabyii
teabyii / riotjs.md
Last active August 23, 2017 13:40
riotjs 源码阅读记录

Riot 源码阅读笔记

官网:https://muut.com/riotjs/

第一次看到 Riot,感觉就是惊艳。我对 React 不大了解,只是简单知道一些,所以在我看来,React 实现的一些东西,Riot 也可以实现,而且代码精简,麻雀虽小,五脏俱全,可以用很简单的语法创建类似 web component 的自定义标签,渲染的性能好像还不赖。

注:不支持自定义标签的浏览器需要手动创建标签,如 [demo/index.html]

整体实现思路

#!/bin/bash
# 只检查提交的 src 下的 js 文件
eslint=./node_modules/.bin/eslint
result=0
for file in `git diff --cached --name-only`
do
if [[ $(echo $file | grep -E "^src\/.*\.js$" | wc -l) -gt 0 ]];
then
@teabyii
teabyii / swift-basic.md
Last active January 20, 2016 04:18
Swift 入门笔记

swift 入门笔记

变量

let 声明常量,var 声明变量

var myVariable = 2
myVariable = 3
let myConstant = 4
@teabyii
teabyii / scroll.html
Created January 19, 2016 12:38
chrome scroll issue
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Scroll test</title>
</head>
<body>
<div style="height:1800px">
hello world
</div>
@teabyii
teabyii / about-susy.md
Last active October 30, 2015 09:49
About Susy

关于 Susy

Susy 官方网站

开始使用

Susy 是一个用于创建自定义布局结构的 css 工具集合,它并不提供现成的 className 来给你使用,而是提供 sass 的 function/mixins 来帮助你创建页面的布局结构。

Susy 作为一个 sass 工具库,使用的时候 @import 进来便是,可以使用 npm/bower 来下载。

@teabyii
teabyii / react-src-module-map.json
Last active October 14, 2015 09:43
react source code module-path mapping
{
"React": "src/React.js",
"ReactVersion": "src/ReactVersion.js",
"ReactComponentWithPureRenderMixin": "src/addons/ReactComponentWithPureRenderMixin.js",
"ReactFragment": "src/addons/ReactFragment.js",
"ReactWithAddons": "src/addons/ReactWithAddons.js",
"LinkedStateMixin": "src/addons/link/LinkedStateMixin.js",
"ReactLink": "src/addons/link/ReactLink.js",
"renderSubtreeIntoContainer": "src/addons/renderSubtreeIntoContainer.js",
"shallowCompare": "src/addons/shallowCompare.js",