0%

你可能有过下面的经历

自己在本地开发,由于 Github 配置了CI,所以需要将新的代码 push到 github 来测试

所以你的 commit 上会有大量无用的 commitcommit message

比如:
update, done, fix,update,update …

当你测试通过之后,你想把上面的 commit 合并成一个显示。

阅读全文 »

HTTP/1.1

可以将请求一股脑发送出去,然后 client 等待服务器回应,如图二,但第一个请求如果被阻塞,那么后面的请求都没办法处理
缺点:
1. 对服务器负担很大
2. http request 级别的 队首阻塞

HTTP/2

h2 通过对请求进行分帧,一个 HTTP 请求,回应对应着 Stream

阅读全文 »

这里记录一下Vue的 Virtual DOM 比较过程
来自于 cn.vuejs.org patchVnode 函数断点

当我们对于data进行修改之后会产生新的 VDOM 集合
这里是 vnode

oldVnode则代表修改之前的 VDOM

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
function patchVnode (
oldVnode,
vnode,
insertedVnodeQueue,
ownerArray,
index,
removeOnly
) {
if (oldVnode === vnode) {
return
}

if (isDef(vnode.elm) && isDef(ownerArray)) {
// clone reused vnode
vnode = ownerArray[index] = cloneVNode(vnode)
}

const elm = vnode.elm = oldVnode.elm

if (isTrue(oldVnode.isAsyncPlaceholder)) {
if (isDef(vnode.asyncFactory.resolved)) {
hydrate(oldVnode.elm, vnode, insertedVnodeQueue)
} else {
vnode.isAsyncPlaceholder = true
}
return
}

// reuse element for static trees.
// note we only do this if the vnode is cloned -
// if the new node is not cloned it means the render functions have been
// reset by the hot-reload-api and we need to do a proper re-render.
if (isTrue(vnode.isStatic) &&
isTrue(oldVnode.isStatic) &&
vnode.key === oldVnode.key &&
(isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
) {
vnode.componentInstance = oldVnode.componentInstance
return
}

let i
const data = vnode.data
if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
i(oldVnode, vnode)
}

const oldCh = oldVnode.children
const ch = vnode.children
if (isDef(data) && isPatchable(vnode)) {
for (i = 0; i < cbs.update.length; ++i) cbs.update[i](oldVnode, vnode)
if (isDef(i = data.hook) && isDef(i = i.update)) i(oldVnode, vnode)
}
if (isUndef(vnode.text)) {
if (isDef(oldCh) && isDef(ch)) {
if (oldCh !== ch) updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly)
} else if (isDef(ch)) {
if (process.env.NODE_ENV !== 'production') {
checkDuplicateKeys(ch)
}
if (isDef(oldVnode.text)) nodeOps.setTextContent(elm, '')
addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue)
} else if (isDef(oldCh)) {
removeVnodes(elm, oldCh, 0, oldCh.length - 1)
} else if (isDef(oldVnode.text)) {
nodeOps.setTextContent(elm, '')
}
} else if (oldVnode.text !== vnode.text) {
nodeOps.setTextContent(elm, vnode.text)
}
if (isDef(data)) {
if (isDef(i = data.hook) && isDef(i = i.postpatch)) i(oldVnode, vnode)
}
}

Vue 会在 updateChildren 中比较 VNode
每次调用sameVnode,当节点相同时调用 patchVNode
patchVNode中会再次调用 updateChildren 进行更新

阅读全文 »

两个例子都使用了Golang最新的module feature
第一个例子还是放到了$GOPATH

go.mod >> module chaochaogege.com/filecatcher

如果我的域名chaochaogege.com

路径 $GOPATH/src/chaochaogege.com/

chaochaogege.com里面有个projectfilecatcher

我现在有两个proto文件都处于 chaochaogege.com/filecatcher/common/

  • TaskInfo.proto
  • ChunkInfo.proto
阅读全文 »

现在是 2018-12-30 16:40 图书馆,等待Windows更新1809版本也没什么事,干脆就开始写了

之前没有写总结的习惯,打算从现在开始每年都写一篇,希望能守信

从大一到大三过了三年,所以趁这个机会把三年都写一遍,借这个机会审视一下过去的经历

阅读全文 »

这个是在Github 看到的评论,感觉写的不错,就直接搬过来了

比较

export defaultimport x = require('')区别

export default … (Default Export)

1
2
3
4
5
6
7
8
9
10
// calculator.ts                                // compiled.js
// ============= // ===========
export default class Calculator { // var Calculator = /** @class */ (function () {'
' public add(num1, num2) { // function Calculator() {}
return num1 + num2; // Calculator.prototype.add = function (num1, num2) {
} // return num1 + num2;
} // };
// return Calculator;
// }());
// exports["default"] = Calculator;
阅读全文 »