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 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
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: # 注意替换
docker-overlay2-size-too-big df -ah发现占用空间较大 1 2 3 4 5 6 7 8 9 10 11 /dev/vda1 50G 46G 701M 99% / systemd-1 - - - - /proc/sys/fs/binfmt_misc debugfs 0 0 0 - /sys/kernel/debug mqueue 0 0 0 - /dev/mqueue hugetlbfs 0 0 0 - /dev/hugepages tmpfs 184M 0 184M 0% /run/user/0 overlay 50G 46G 701M 99% /var/lib/docker/overlay2/34c5b96ac2c65999eacb82297930a4db5421b56e4399baab59c3eccf6169a6cc/merged overlay 50G
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",
Jest 配置vscode debugger调试 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 { // Use IntelliSense to learn about possible attributes. // Hover to view descriptions of existing attributes. // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ { "type": "node", "request": "launch", "name": "Jest",
国内开源镜像网站 阿里云:http://mirrors.aliyun.com/ 网易开源:http://mirrors.163.com/ 搜狐开
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 class Scheduler { constructor() { this.middlewares = []; } use(fn) { if (typeof fn !== 'function') throw new TypeError('middleware must be a function!'); this.middlewares.push(fn); return this; } compose() { return (context, next) => { let index = -1; const dispatch = (i) => { if (i <= index) return Promise.