whoru

学习、分享、交流、沉淀

本文适用于 JetBrains 系软件,包含通用及单个软件的设置、使用技巧等,主要是在工作使用过程中遇到的问题及解决方式笔记。

1. 设置

1.1. 通用设置

关闭自动保存

菜单:Appearance & Behavior > System Settings > Synchronization

取消勾选:

  • Synchronize files on frame or editor tab activation
  • Save files on frame deactiation
  • Use "safe write"(save changes to a temporary file first)
打开修改文件未保存标识

菜单:Editor > General > Editor Tabs > Appearance

勾选:

  • Mark modified (*)
阅读全文 »

本文主要介绍如何使用 nvm 对 Node 的版本进行管理,当然你也可以选择另一个工具 n

安装或升级(参见这里

1
2
3
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
# 或
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash

脚本的作用是将 nvm 仓库源码克隆到 ~/.nvm 下面,之后将环境变量添加到配置文件中,如:~/.bash_profile~/.zshrc~/.profile,或 ~/.bashrc

所以会用到 git 命令,如果没有 Git,请先安装。

阅读全文 »

环境:NodeJS v8+

安装依赖

1
2
3
4
# jspdf 是主依赖,其它两个可根据情况选择;
# jspdf-autotable 用于绘制表格;
# jspdf-autotext 用于添加文本,实现自动换行等;
npm i --save jspdf jspdf-autotable jspdf-autotext

引入依赖和初始化

1
2
3
4
5
6
7
8
9
10
11
12
13
// 推荐这种引入方式
import jsPDF from 'jspdf';
// 虽然官方仓库写的是这种,但实际使用过程中却遇到了一些问题,自己可以测试一下
// 比如提示某些方法不存在等
// import { jsPDF } from "jspdf";

// 初始化示例,这里用的是横向A4纸,并且开启压缩
// 构造参数说明如下
// orientation?: "p" | "portrait" | "l" | "landscape",
// unit?: "pt" | "px" | "in" | "mm" | "cm" | "ex" | "em" | "pc",
// format?: string | number[],
// compressPdf?: boolean
const pdfDoc = new jsPDF('l', 'mm', [ 210, 297 ], true);
阅读全文 »

安装

1
➜  ~ npm i nrm -g

使用

1
2
3
4
5
6
7
8
9
10
11
12
# 查看 nrm 内置的几个 npm 源
➜ ~ nrm ls
npm ---------- https://registry.npmjs.org/
yarn --------- https://registry.yarnpkg.com/
tencent ------ https://mirrors.cloud.tencent.com/npm/
cnpm --------- https://r.cnpmjs.org/
* taobao ------- https://registry.npmmirror.com/
npmMirror ---- https://skimdb.npmjs.com/registry/

# 切换源
➜ ~ nrm use cnpm
Registry has been set to: http://r.cnpmjs.org/