0%

有一些网站提供了格式化json的功能,如果没有网络时,或者json字符串很长时,还是需要一个可以格式json的软件,这里我们使用Sublime Text3来格式化json。

下载Sublime Text3

http://www.sublimetext.com/3

我们选择OS X系统

安装Package Control

使用快捷键ctrl+View -> Show Console 打开输入框,复制以下内容到输入框。

SUBLIME TEXT 3

 

安装pretty json

快捷键ctrl+shift+p, 打开面板,选中Package Control: Install Package并回车,然后再输入pretty json,找到插件回车安装即可。

使用pretty json

使用ctrl+alt+j快捷键来格式化当前页面的内容。

今天在npm install前端代码时,下载速度非常慢,要下载的东西下载不下来。

1
Downloading binary from https://github.com/sass/node-sass/releases/download/v4.7.2/darwin-x64-64_bin

还遇到如下错误:

1
2
ERROR in ./~/css-loader?sourceMap!./~/resolve-url-loader?sourceMap!./~/sass-loader?sourceMap!./src/directives/plan-task/index.scss
Module build failed: Error: Cannot find module 'node-sass'

所以得考虑把npm的源换到国内,换成淘宝的镜像,命令如下:

1
npm config set registry https://registry.npm.taobao.org

设置成功后,可以查看目前系统使用的源

1
2
npm config get registry
https://registry.npm.taobao.org/

像之前遇到的问题Cannot find module ‘node-sass’,我们可以再次执行npm install node-sass安装。

如果不想使用淘宝源了,可以还原回去。

1
2
npm config delete registry
npm config delete disturl

或者

1
npm config edit

找到淘宝那两行,删除即可。

下载MongoDB

从官网下载MongoDB Mac版本,下载地址: https://www.mongodb.com/download-center/community?jmp=docs

1
2
cd /usr/local/mongodb
sudo curl -O https://fastdl.mongodb.org/osx/mongodb-osx-ssl-x86_64-4.0.3.tgz

解压到/usr/local

1
sudo tar -zxvf mongodb-osx-ssl-x86_64-4.0.3.tgz

创建数据库存储目录

默认目录是/data/db,并把权限授予给用户simon

如果数据库目录不是/data/db,可以通过 —dbpath 来指定。

1
2
sudo mkdir -p /data/db
sudo chown -R simon /data

启动mongodb

1
sudo bin/mongod

进入客户端

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
$ mongo
MongoDB shell version v4.0.2
connecting to: mongodb://127.0.0.1:27017
MongoDB server version: 4.0.2
Server has startup warnings:
2018-10-25T20:07:13.893+0800 I CONTROL [initandlisten]
2018-10-25T20:07:13.893+0800 I CONTROL [initandlisten] ** WARNING: Access control is not enabled for the database.
2018-10-25T20:07:13.893+0800 I CONTROL [initandlisten] ** Read and write access to data and configuration is unrestricted.
2018-10-25T20:07:13.893+0800 I CONTROL [initandlisten]
2018-10-25T20:07:13.893+0800 I CONTROL [initandlisten] ** WARNING: This server is bound to localhost.
2018-10-25T20:07:13.893+0800 I CONTROL [initandlisten] ** Remote systems will be unable to connect to this server.
2018-10-25T20:07:13.893+0800 I CONTROL [initandlisten] ** Start the server with --bind_ip <address> to specify which IP
2018-10-25T20:07:13.893+0800 I CONTROL [initandlisten] ** addresses it should serve responses from, or with --bind_ip_all to
2018-10-25T20:07:13.893+0800 I CONTROL [initandlisten] ** bind to all interfaces. If this behavior is desired, start the
2018-10-25T20:07:13.893+0800 I CONTROL [initandlisten] ** server with --bind_ip 127.0.0.1 to disable this warning.
2018-10-25T20:07:13.893+0800 I CONTROL [initandlisten]
---
Enable MongoDB's free cloud-based monitoring service, which will then receive and display
metrics about your deployment (disk utilization, CPU, operation statistics, etc).

The monitoring data will be available on a MongoDB website with a unique URL accessible to you
and anyone you share the URL with. MongoDB may use this information to make product
improvements and to suggest MongoDB products and deployment options to you.

To enable free monitoring, run the following command: db.enableFreeMonitoring()
To permanently disable this reminder, run the following command: db.disableFreeMonitoring()
---

> 1 + 1
2
>

可视化客户端

可以下载Robo 3T,www.robomongo.org