AI助力的问题解答、代码补全。 Github CopilotAI 编程搭档。 真正的智能补全代码。效率倍增。 官网: https://github.com/features/copilot 付费,但值得。 还提供了命令行(CLI)版的 copilot devv.ai
有时候,某个父级元素没有特征,需要依靠子元素来定位父级元素。 css select parent element/node/tag by child elements 可使用 CSS 函数式伪类 :has() 来实现。 示例1: <div> <li> <span class="active"></span> </li> </div> li:has(> span.active) { /* 会选择 li tag
安装 RIME (输入法框架/引擎) macOS 上的发行版是鼠须管(Squirrel),下载、并安装。 系统配置中添加『鼠须管』 系统设置 -> 键盘 -> 文字输入 -> 编辑, 点
使用 onkeydown (or onkeyup) 事件,而不是 onkeypress function handleKeyEvent(e) { // ctrl/meta + enter if (e.keyCode == 13) { // if (e.key == "Enter") { if (e.ctrlKey || e.metaKey) { alert("ctrl/meta + enter") } } } document.onkeydown = KeyPress; Alt key, e.altKey Ctrl + Z, keyCode==90 and e.ctrlKey
使用 color-scheme 让网页随浏览器自动切换亮暗主题色(dark/light themes) HTML: <meta name="color-scheme" content="light dark"> CSS: :root { color-scheme: light dark; /* both supported */ /* defaults to light theme */ --text-color: black; --bkg-color: white; } @media (prefers-color-scheme: dark) { :root{ /* for
使用 journalctl 命令清理 systemd 等产品的日志。 根据时间清理旧的日志文件: sudo journalctl --vacuum-time=1years --vacuum-time 选项用于指定保留日志文件的时间跨度。 单位也可以是:1months、3days
辅助编写 cron 表达式,测试和解析 cron 表达式,查看匹配的后续时间。 https://crontab.guru/ 编辑和测试 cron 表达式。网页应用,免费。 https://cron.help/ 同上。Crontab syntax for us humans
可使用 --cron 参数指定执行周期,但是如果仅使用该参数,例如 pm2 start task.js --cron "*/15 * * * *" PM2 将启动您的 cron 作业,但它也会在作业程序完成后不断重新启动 cron 作业,无限循
清理日志: pm2 flush 清空所有日志 pm2 flush 1 清空任务1的日志 守护进程工具 pm2 基础用法
Daemons and Services in macOS 基础知识 守护程序: launchd。类似 Linux 中的 systemd,负责初始化、加载、启/停和管理系统服务。 管理命令: launchctl。