Skip to content

Instantly share code, notes, and snippets.

@zzuhan
zzuhan / 回退操作
Created June 12, 2020 04:55
[git操作] #git #util
基础的概念,索引,工作树,
* git revert (直接丢掉修改)
* 直接回退到某个commit版本
* git reset (修改退回到工作区)
* 回退到某个版本,但是前面的修改会退回到工作区
* 还有很多的选项,soft,mixed,hard,merge,keep
* soft,回退为已经added状态,绿色
* mixed,回退为未added状态,红色,
@zzuhan
zzuhan / faq
Last active June 11, 2020 09:59
[docker常见问题] #docker
apt-get 安装vim失败 https://unix.stackexchange.com/questions/336392/e-unable-to-locate-package-vim-on-debian-jessie-simplified-docker-container
@zzuhan
zzuhan / bash查询端口或pid
Last active October 23, 2020 11:39
[bash常用] #bash
ps aux | grep node // 查询node类应用,以及看到pid
lsof -aPi -p $pid // 通过pid查询占用的端口
lsof -i:$port // 通过端口查询pid
@zzuhan
zzuhan / upperFirst.js
Created November 20, 2019 07:05
util #javascript
function capitalizeFirstLetter(string) {
return string.charAt(0).toUpperCase() + string.slice(1);
}
@zzuhan
zzuhan / url.js
Created November 7, 2019 09:00
各种正则匹配 #regexp
// 匹配正则中的params
let reg = /(appId=).*?(&|#|$)/
window.location.href.replace(reg, '$1lls$2')
@zzuhan
zzuhan / binary-tree.js
Last active May 20, 2019 12:58
[algorithm] 常见的算法 #algorithm
// https://zhuanlan.zhihu.com/p/27307626
// 二叉树遍历,有深度优先和广度优先。有递归算法和非递归算法
var nodes = {
node: 6,
left: {
node: 5,
left: {
node: 4
},
right: {
@zzuhan
zzuhan / array.js
Last active May 20, 2019 09:33
[interview] #js
Array.prototype._map = function(fn, bindThis) {
bindThis = bindThis || null;
return this.reduce(function(total, curr, currIndex, arr){
// console.log(total)
total.push(fn.call(bindThis, curr, currIndex, arr));
return total;
}, [])
};
Array.prototype._filter = function(fn, bindThis) {
@zzuhan
zzuhan / normal
Last active April 4, 2019 08:42
[vue] vue常用的template #vue
<template v-if="type === 'A'">
</template>
<template v-else>
</template>
@zzuhan
zzuhan / getClosestInstanceFromNode
Last active April 3, 2019 02:46
[js react] react中常见的代码 #js #todo
function getClosestInstanceFromNode(node){
}
@zzuhan
zzuhan / check.js
Created March 26, 2019 09:16
[js check] js的基本检测 #js
Array.isArray()
// 类检测
mySprite instanceof Sprite;
// 基础类型检测?