XMit

Frontend Engineer

逻辑与(&&)操作符

高级程序设计对&&的解释是,如果第一个操作数能够决定结果,则不会再对第二个操作数求值。

1
2
3
4
5
6
7
8
9
10
11
12
true && true;     // => true
true && false; // => false
false && true; // => false
false && false; // => false

var a = 0;
var result = (a && 3);
console.log(result); // => 0

var a = 1;
var result = (a && 3);
console.log(result); // => 3

逻辑与(&&)操作符运算规则是:如果第一个操作数为’假‘,则返回这个操作数,反之则返回第二个操作数。

阅读全文 »

Aria2 安装

使用 ssh 的方式登入路由器

1
ssh root@192.168.1.1

在 Gargoyle 固件下安装 aria2 下载工具

1
2
opkg update
opkg install aria2

启动 aria2 并进行验证(两种启动方式)

1
2
3
4
5
# 用参数命令的方式启动
aria2c --enable-rpc --rpc-listen-all=true --rpc-allow-origin-all -c

# 用配置文件的方式去启动(前提是你得在路由器里面部署好了配置文件)
aria2c --conf-path=/etc/aria2/aria2.conf
阅读全文 »

brew 安装 aria2

1
brew install aria2

建立配置文件(非必要)

1
2
3
mkdir ~/.aria2
cd .aria2
touch aria2.conf

在 aria2.conf 写入配置

1
vim ~/.aria2/aria2.conf
阅读全文 »

起步

初次运行 git 前的配置

Git 提供了一个叫做 git config 的工具(译注:实际是 git-config 命令,只不过可以通过 git 加一个名字来呼叫此命令。),专门用来配置或读取相应的工作环境变量。而正是由这些环境变量,决定了 Git 在各个环节的具体工作方式和行为。这些变量可以存放在以下三个不同的地方:

/etc/gitconfig

系统中对所有用户都普遍适用的配置。若使用 git config 时用 –system 选项,读写的就是这个文件。

~/.gitconfig

用户目录下的配置文件只适用于该用户。若使用 git config 时用 –global 选项,读写的就是这个文件。

.git/config

当前项目的 Git 目录中的配置文件(也就是工作目录中的 .git/config 文件):这里的配置仅仅针对当前项目有效。每一个级别的配置都会覆盖上层的相同配置,所以 .git/config 里的配置会覆盖 /etc/gitconfig 中的同名变量。

阅读全文 »

在写代码时,会经常用到一些重覆的代码,这个时候就可以用 Sublime Text - Snippets 代码片段功能。

Snippets 代码片段功能使用方法

创建 Snippets

在工具栏选择 Tools > New Snippet

Snippets 参数设置

  • tabTrigger : 快捷键,利用Tab自动补全代码的功能。(可选)

  • scope: 使用范围,不填写代表对所有文件有效。附:source.css和test.html分别对应不同文件。(可选)

  • description : 在snippet菜单中的显示说明(支持中文)。如果不定义,菜单则显示当前文件的文件名。(可选)

  • ${1:name} : 表示代码插入后,光标所停留的位置,可同时插入多个。其中:name为自定义参数(可选)。

  • ${2} : 表示代码插入后,按Tab键,光标会根据顺序跳转到相应位置(以此类推)。

    阅读全文 »

Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.

Quick Start

Create a new post

1
$ hexo new "My New Post"

More info: Writing

Run server

1
$ hexo server

More info: Server

Generate static files

1
$ hexo generate

More info: Generating

Deploy to remote sites

1
$ hexo deploy

More info: Deployment

0%