Skip to content

Instantly share code, notes, and snippets.

View zengkan0703's full-sized avatar
🤡

zengkan0703 zengkan0703

🤡
View GitHub Profile
@zengkan0703
zengkan0703 / index.js
Last active March 6, 2020 08:41
判断元素是否能滚动
function eleCanScroll(ele) {
if (!ele instanceof HTMLElement) {
console.log("fuck off");
return;
}
if (ele.scrollTop > 0) {
return true;
} else {
ele.scrollTop++;
// 元素不能滚动的话,scrollTop 设置不会生效,还会置为 0
@zengkan0703
zengkan0703 / bisect
Created March 3, 2020 03:00
git 二分查找问题
git bisect start // 开始二分法查找
git bisect reset // 退出二分查找
git bisect good [good_commit] // 已知的最后一次正常状态
git bisect bad // 表示当前是有问题的
之后 git 就会自动切换到 [good_commit] 和 HEAD 中间的那次 commit,
我们再根据代码当前的状态标记 git bisect bad|good,往复几次之后,就能找到引起问题的提交