terminal-plus 不工作解决办法

先卸载插件apm uninstall terminal-plus,然后重新从github上安装apm install jeremyramin/terminal-plus

fis3或者fis的缺陷

  1. 引入自定义语法,例如__inline无法做到
  2. 插件,parser等阶段,比如一个阶段使用两个插件或者阶段之间加一个处理就比较麻烦

brew

安装nvm

shadowsocks

vim编辑器

mac下配置zsh

  • 将bash切换为zsh: chsh -s /bin/zsh
  • which定位zsh: which zsh
  • 切回bash: chsh -s /bin/bash
  • 下载oh-my-zsh: git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh
  • 备份已有的zshrc(一般不需要) cp ~/.zshrc ~/.zhrc.orig
  • 替换zshrc: cp ~/.oh-my-zsh/templates/zshrc.zhs-template ~/.zshrc

word文件中表格太大,在mac的pages中显示不全

解决方法:
1.在window上用word将文件转为html或者pdf格式
2.在Pages中菜单“文件,页面设置”中修改页面的大小, 将页面改大一些

软件

  • 录屏软件monosnap 截屏

有用的npm包记录

webfont相关

  • css.js:它能将 CSS 解析成语法树,并且能够较好的容错适应各种 hack 语法
  • jsdom:它能够在 NodeJS 中实现 W3C DOM API,使得我可以使用 document.querySelectorAll() 方法输入 CSS 选择器来查找 HTML 节点上的文本
  • cheerio: 类似jquery,在node中解析dom结构
  • font-optimizer:这是一个使用 Perl 编写的字体优化工具,可以高效的删除字体中指定的字符
  • ttf2eot、ttf2woff、ttf2svg:是它们完成了跨浏览器字体格式转码的工作
  • gulp-util gulp常用工具库
  • gulp-uglify 压缩js文件
  • gulp-concat 连接文件
  • gulp-sourcemaps 处理js时,生成sourcemap
  • gulp-less
  • gulp-sass
  • gulp-autoprefixer 自动补全浏览器兼容的css
  • gulp-minify-css 压缩css
  • del 删除文件夹
  • gulp-nodemon 自动重启服务器
  • livereload 自动刷新页面
  • browser-sync 静态文件服务器,支持自动刷新
  • anywhere:小型静态服务器, 安装,然后使用命令行(anywhere -p 8000)在浏览器打开页面

批量加载

  • require-dir加载整个文件夹

    1
    2
    var require_dir = require('require-dir');
    require_dir('./gulp-tasks', {recurse: true});
  • gulp-load-plugins 根据package自动加载gulp插件

    1
    2
    3
    4
    var plugin = require('gulp-load-plugins')({
    pattern: ['gulp-*', 'gulp.*'],
    replaceString: /\bgulp[\-.]/
    });

使用浏览器打开页面

  • gulp-shell

npm模块window下安装问题

  • gulp-sass在window下安装时需要 Visual Studio 2013 WD版本,假如不确定版本号,可以使用 –msvs_version=2013指定编译版本
  • nodegyp

git源代码分支和编译后分支怎样处理才可以避免重复或者冲突?

模仿hexo-deploy, 新建一个文件夹,这个文件夹是编译后的分支,例如.deploy。在源代码分支编辑后,编译到.deploy文件夹下, 在这个文件夹下进行提交即可避免和源代码分支冲突

setTimeout和requestAnimationFrame时间对比

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
setTimeout(function() {
console.log('wait 4');
}, 4);
setTimeout(function() {
console.log('wait 3');
}, 3);
setTimeout(function() {
console.log('wait 2');
}, 2);
setTimeout(function() {
console.log('wait 1');
}, 1);
setTimeout(function() {
console.log('wait 0');
}, 0);
requestAnimationFrame(function(){
console.log('animation frame.')
});

以上代码会输出什么? setTimeout的延时为0和1、2、3、4以及requestAnimationFrame的执行时间分别是什么时候? requestAnimationFrame在前,还是setTimeout的0在前? setTimeout是按照大小顺序输出?
在mac chrome版本 55.0.2883.95 (64-bit)验证结果

setTimeout的输出结果顺序是固定的,顺序是 1,0,2,3,4 说明定时器设置为0和1没有区别.
而requestAnimationFrame的执行有时在setTimeout1前,有时在setTimeout1后,并没有固定的先后次序.