js 获取滚动元素

js 获取滚动父元素 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 const isScrollable = function (ele) { const hasScrollableContent = ele.scrollHeight > ele.clientHeight; const overflowYStyle = window.getComputedStyle(ele).overflowY; const isOverflowHidden = overflowYStyle.indexOf('hidden') !== -1; return hasScrollableContent && !isOverflowHidden; }; const getScrollableParent = function (ele) { return !ele || ele === document.body ? document.body : isScrollable(ele) ? ele

canvas requestAnimationFrame画一个clock

canvas requestAnimationFrame 画一个 clock 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 var requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame; var h1 = document.getElementsByTagName("h1")[0]; var canvas = document.getElementById("canvas"); var ctx

github coding同步action

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 name: Sync Repo to CODING on: push: schedule: # 每天北京时间0点同步 - cron: "0 16 * * *" jobs: build: runs-on: ubuntu-latest steps: - name: Sync Repo to CODING uses: serverlesslife-cn/sync-repo-to-coding@master env: SSH_PRIVATE_KEY: ${{ secrets.CODING_PRIVATE_KEY }} with: # 注意替换

Benchmark.js 使用

Benchmark.js 安装 npm install benchmark 使用 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 var Benchmark = require("benchmark"); var suite = Benchmark.Suite("string"); suite .add("String#regexp", function () { /o/.test("Hello World!"); }) .add("String#indexOf", function () { "Hello World!".indexOf("o") > -1; }) .add("String#lastIndexOf", function () { "Hello World!".lastIndexOf("o") > -1; }) .add("String#startsWith",

国内开源镜像网站

国内开源镜像网站 阿里云:http://mirrors.aliyun.com/ 网易开源:http://mirrors.163.com/ 搜狐开

Async.js

each 数组循环调用iterator方法进行处理 _each方法对数组进行遍历, 内部使用iterator进行调用 only_once方法保证函数只会

前端缓存笔记

缓存分类 HTTP缓存 Expires 缓存的绝对过期时间,此时间之后缓存都会失效 Expires过期时间会受到客户端时间影响变得不精准 Cache-Control 控

linux 问题整理

rpmdb open failed 1 2 3 4 5 6 7 8 [root@VM-0-6-centos ~]# yum -y remove git error: rpmdb: BDB0113 Thread/process 423/140056922314816 failed: BDB1507 Thread died in Berkeley DB library error: db5 error(-30973) from dbenv->failchk: BDB0087 DB_RUNRECOVERY: Fatal error, run database recovery error: cannot open Packages index using db5 - (-30973) error: cannot open Packages database in /var/lib/rpm CRITICAL:yum.main: Error: rpmdb open failed 方案 1 2 [root@VM-0-6-centos ~]#