Skip to content

Instantly share code, notes, and snippets.

View mcattx's full-sized avatar
🎯
learning

mcattx mcattx

🎯
learning
View GitHub Profile
@mcattx
mcattx / unescape.js
Created November 2, 2017 12:43
HTML 反转义
// 反转义
function toRegex(chars) {
var keys = Object.keys(chars).join('|');
var regex = new RegExp('(?=(' + keys + '))\\1', 'g');
return regex;
}
function unescape(str) {
var chars = {
'"': '"',
@mcattx
mcattx / .gitignore
Created October 16, 2017 08:04
gitignore file
# Mac OS X
*.DS_Store
# sass cache
*.sass-cache*
# node modules
node_modules/
# logs
# migrating from https://github.com/robbyrussell/oh-my-zsh/blob/master/plugins/git/git.plugin.zsh
# Aliases
alias g='git'
#compdef g=git
alias gst='git status'
#compdef _git gst=git-status
alias gd='git diff'
#compdef _git gd=git-diff
alias gdc='git diff --cached'
@mcattx
mcattx / useFnInSetTimeout.js
Created March 28, 2017 16:45
如何使用定时器settimeout、setInterval执行传递参数的函数
function fn(isPause) {
// isPause: Boolean;
if(isPause) {
// your codes here
} else {
}
}
// normally, fn will be called immediately.
setTimeout(fn(isPause), 2000);
@mcattx
mcattx / git 101.md
Created February 8, 2017 07:53
An internal speech for spreading git

#Git 101

为什么我们要换到 Git

  • Git 和 SVN 的区别
    1. git 合并操作保留原有的提交过程, svn 合并操作把来源多个提交合并成一个(这样对比起来很麻烦,像 git 有好用的 diff 工具,可以比对某行代码的提交时间和作者,svn 追踪起来很麻烦)
    2. git 是分布式的版本控制系统,svn 是集中式版本的控制系统。(git 的服务器只是方便大家交换彼此的修改,没有git 服务器也是可以干活的)
  • Git 比 SVN 好在哪里
    1. diff
    2. 冲突解决(令人蛋碎的树冲突!)
    3. 非常容易进行 code review
    4. 快!快如闪电!再也不会发生 copy 个文件夹可以泡个咖啡上个厕所
@mcattx
mcattx / ES 2015 101.md
Created February 8, 2017 07:44
a simple introduction for es2015

#ES2015 101

##Why we need ES2015?

JavaScript - Dom - Bom = ECMAScript

我们熟知的 ECMAScript 5 已经在全部的现代浏览器实现了,当然 IE10+才算是现代浏览器。

ECMAScript 2015 —— 很多人称为 ES6 ,因为它是 ECMAScript 标准的第六版修订。负责指定 ECMAScript 标准的委员会 TC39 决定把新标准的制度改为一年一次,所以现在有了 ES2016 (ES7) 。

@mcattx
mcattx / gulpfile.js
Created November 8, 2016 08:59
Using postcss and autoprefixer in Gulp
var gulp = require('gulp'),
// html
// css
postcss = require('gulp-postcss'),
sourcemaps = require('gulp-sourcemaps'),
precss = require('precss'),
autoprefixer = require('autoprefixer'),
cssnext = require('postcss-cssnext'),
// js
// debug
@mcattx
mcattx / .editorconfig
Last active September 19, 2017 09:47
common editor config file
# EditorConfig is awesome: http://EditorConfig.org
# top-most EditorConfig file
root = true
# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
@mcattx
mcattx / 前端入门指北.md
Last active December 30, 2016 08:52
前端入门指北手册
@mcattx
mcattx / .babelrc
Created October 26, 2016 06:47
simple gulp config for es2015 developing
{
"presets": ["es2015"]
}