└── README.md /README.md: -------------------------------------------------------------------------------- 1 | # Nodejs Newbie 2 | 3 | 4 | ## 前端入门的4本书 5 | 6 | - 精通CSS+DIV 网页样式与布局 http://product.china-pub.com/35553 7 | - 精通CSS:高级Web标准解决方案(第2版)http://product.china-pub.com/196593 8 | - 锋利的jQuery(第2版) http://product.china-pub.com/3661548 9 | - GitHub入门与实践 http://product.china-pub.com/4727673 10 | 11 | 第一本书是傻瓜式的入门的书,老点,但简单,符合国人思维,入门html和css比较合适 12 | 13 | 第二本书是css领域不错的书,加深理解css,努力成为一个合格的前端 14 | 15 | 第三本书是jquery的书,也是很简单,为啥没有直接javascript的原因是,jq足够简单,先实习效果,以后再慢慢补js基础即可,如果上来就js,很多人是搞不定的 16 | 17 | 第四本书是git和github的用法,是版本控制里比较简单的,比较适合入门 18 | 19 | ## 要求 20 | 21 | - ubuntu 22 | - sublime text3(或者vsc https://github.com/i5ting/vsc) 23 | - 编码风格 https://github.com/dead-horse/node-style-guide 24 | 25 | ## 安装nodejs 26 | 27 | - 使用nvm安装多个版本(LTS版本的必须装,其他自便) 28 | - 使用nrm切换源 29 | 30 | ## 推荐node学习书籍 31 | 32 | ![](http://img11.360buyimg.com/n1/jfs/t2500/164/112369100/69685/87527525/55ef92ecN98d5fa4f.jpg) 33 | 34 | - Node.js实战(入门必看) 35 | - 深入浅出Node.js (对原理理解更好) 36 | - 其他例子书 37 | 38 | ## Tips 39 | 40 | ### 编辑器 41 | 42 | 只允许文本编辑器,不准使用任何IDE 43 | 44 | 使用sublime的快速打开文件 45 | 46 | ctrl + p(mac是command + T) 47 | 48 | 在终端里使用subl命令打开文件,(如果是mac,需要安装https://github.com/i5ting/subl) 49 | 50 | subl app.js 51 | 52 | 快速定位到某一行 53 | 54 | ctrl + g (mac是command + L) 55 | 56 | - [网上找的](http://my.oschina.net/nodeonly/blog/489463) 57 | 58 | 关于tab配置 59 | 60 | ``` 61 | { 62 | "default_encoding": "UTF-8", 63 | "default_line_ending": "unix", 64 | "font_size": 10, 65 | "rulers": 66 | [ 67 | 80 68 | ], 69 | "tab_size": 2, 70 | "translate_tabs_to_spaces": true, 71 | "word_wrap": "false" 72 | } 73 | ``` 74 | ### 使用oh-my-zsh 75 | 76 | - 官网 http://ohmyz.sh/ 77 | - 代码 https://github.com/robbyrussell/oh-my-zsh 78 | 79 | 安装步骤 80 | 81 | - 先安装zsh 82 | - 安装oh-my-zsh 83 | 84 | 以后环境变量在~/.zshrc里 85 | 86 | 我常用命令 87 | 88 | ``` 89 | $ zsh_stats 90 | 1 1616 16.1616% git 91 | 2 1369 13.6914% npm 92 | 3 867 8.67087% cd 93 | 4 382 3.82038% node 94 | 5 374 3.74037% j 95 | 6 341 3.41034% ack 96 | 7 272 2.72027% touch 97 | 8 251 2.51025% mate 98 | 9 225 2.25023% mkdir 99 | 10 211 2.11021% rm 100 | 11 204 2.0402% open 101 | 12 194 1.94019% cat 102 | 13 160 1.60016% clone 103 | 14 153 1.53015% ls 104 | 15 143 1.43014% ava 105 | 16 139 1.39014% curl 106 | 17 100 1.0001% yarn 107 | 18 99 0.990099% wget 108 | 19 79 0.790079% g++ 109 | 20 66 0.660066% ps 110 | ``` 111 | 112 | ### 安装ack,命令行查找代码 113 | 114 | http://beyondgrep.com/install/ 115 | 116 | 117 | Ubuntu 118 | 119 | - Package "ack-grep" 120 | 121 | Mac 122 | 123 | - brew install ack 124 | 125 | ### 使用autojump跳转目录 126 | 127 | https://github.com/wting/autojump 128 | 129 | Linux 130 | 131 | sudo apt-get install autojump 132 | 133 | Mac os 134 | 135 | brew install autojump 136 | 137 | 需要修改~/.zshrc里的plugin,修改为 138 | 139 | plugins=(git autojump) 140 | 141 | 然后 142 | 143 | source ~/.zshrc 144 | 145 | 至此,已经完成了安装。 146 | 147 | 此后cd到任意目录,以后就可以使用j这个直达到某个目录了,下面是示例: 148 | 149 | ➜ nodejs-newbie git:(master) ✗ cd ~/workspace/github/nodejs-newbie 150 | ➜ nodejs-newbie git:(master) ✗ cd ~ 151 | ➜ ~ j nodejs-n 152 | /Users/sang/workspace/github/nodejs-newbie 153 | ➜ nodejs-newbie git:(master) ✗ 154 | 155 | 如果想玩的更high,可以参见https://github.com/clvv/fasd 156 | 157 | ### 使用mongo-express操作mongodb 158 | 159 | 160 | 161 | 162 | 163 | 推荐 www.robomongo.org 164 | 165 | - 支持win 166 | - 支持linux 167 | - 支持mac(mac10.10下中文乱码,需要robomongo v0.8.5+) 168 | 169 | 170 | ### 使用node-inspector调试代码 171 | 172 | https://cnodejs.org/topic/5463f6e872f405c829029f7e 173 | 174 | ### 使用mongoose-cli数据库建模 175 | 176 | https://cnodejs.org/topic/55c44f0db98f51142b367b54 177 | 178 | ### 学习git用法 179 | 180 | 常用 181 | 182 | alias gs='git status' 183 | alias gp='git push' 184 | 185 | 使用alias来简化命令输入 186 | 187 | 188 | - 重磅推荐peter wang写的 [搬进 Github](http://gitbeijing.com/) 189 | 190 | 下面给出一些git学习资料 191 | 192 | - [git-guide](http://www.bootcss.com/p/git-guide/) 193 | - [git入门gif演示](https://git.oschina.net/wzw/git-quick-start) 194 | - [写出好的 commit message](http://ruby-china.org/topics/15737) 195 | - [github-cheat-sheet](https://github.com/tiimgreen/github-cheat-sheet/blob/master/README.zh-cn.md) 196 | - [分支管理](http://www.juvenxu.com/2010/11/28/a-successful-git-branching-model/) 197 | - [Git-it Challenges is a terminal based app for learning Git and GitHub](http://jlord.github.io/git-it/) 198 | - [高富帅们的Git技巧(译)](http://blog.csdn.net/zmlcool/article/details/8682382) 199 | - [Git 怎样保证fork出来的project和原project(上游项目)同步更新](http://www.tuicool.com/articles/Mnmmqyi) 200 | - [10.Git之本地忽略](http://blog.csdn.net/kangear/article/details/13169395) 201 | - [git-flow 备忘清单](http://danielkummer.github.io/git-flow-cheatsheet/index.zh_CN.html) 202 | - [Git flow 開發流程 ihower](http://ihower.tw/blog/archives/5140) 203 | - [git bisect](http://www.oschina.net/translate/letting-git-bisect-help-you) 204 | 205 | $ git update-index --assume-unchanged /path/to/file #忽略跟踪 206 | $ git update-index --no-assume-unchanged /path/to/file #恢复跟踪 207 | 208 | ### 查询文档 209 | 210 | - http://zealdocs.org/ (推荐,离线下载) 211 | 212 | 有很多doc在dash(mac)里默认是没有的; 213 | 214 | see here : http://kapeli.com/docset_links 215 | 216 | 如果是下载到本地的docset,放到zealdocs目录下面,需要重启zeal 217 | 218 | ### mongo here 219 | 220 | 当前目录启动mongodb 221 | 222 | 在新建目录执行 223 | 224 | mh 225 | 226 | 它会创建tmp目录 227 | 228 | 全局启动mongodb 229 | 230 | mhg 231 | 232 | 它会创建~/mongo/目录,当前用户下起mongo服务,即用户下全局共享 233 | 234 | https://github.com/i5ting/mongo-here 235 | 236 | ### json editor 237 | 238 | [sudo] npm install -g je 239 | je 240 | 241 | 详见https://github.com/i5ting/je 242 | 243 | ### jade 244 | 245 | jade学习 246 | 247 | - http://jade-lang.com/reference/ 248 | - https://github.com/i5ting/study-jade 249 | 250 | html转jade是比较省力的一种方法 251 | 252 | 使用场景:尤其是写bootstrap的时候,当然静态页面转jade也一样 253 | 254 | hade是一个html2jade.org的copy,平常打开这个网站比较慢,索性还是在本地弄一个,用的时候一条命令打开 255 | 256 | [sudo] npm install -g hade 257 | hade 258 | 259 | 好处 260 | 261 | - html和jade互转 262 | - 对于学习jade是比较好的练习 263 | 264 | 详见https://github.com/i5ting/hade 265 | 266 | ### json to csv converter 267 | 268 | [sudo] npm install -g j2csv 269 | json2csv 270 | 271 | 详见https://github.com/i5ting/json2csv 272 | 273 | 上面给出的方案适合3000条以内的数据,受限于浏览器 274 | 275 | 更大量的数据,需要 276 | 277 | [sudo] npm install -g ej 278 | ej input.json output.csv 279 | 280 | https://github.com/i5ting/ej 281 | 282 | ### kp is a tool for kill process by server port 283 | 284 | [sudo]npm install -g kp 285 | kp 3002 286 | 287 | https://github.com/i5ting/kp 288 | 289 | ### upload-cli 290 | 291 | a node cli tools for uploads ui 292 | 293 | https://github.com/i5ting/upload-cli 294 | 295 | - 目前已经支持通过命令行`uci`上传,可指定host 296 | 297 | ## Contributing 298 | 299 | 1. Fork it 300 | 2. Create your feature branch (`git checkout -b my-new-feature`) 301 | 3. Commit your changes (`git commit -am 'Add some feature'`) 302 | 4. Push to the branch (`git push origin my-new-feature`) 303 | 5. Create new Pull Request 304 | 305 | 306 | ## 版本历史 307 | 308 | - v1.0.0 初始化版本 309 | 310 | ## 欢迎fork和反馈 311 | 312 | - write by `i5ting` shiren1118@126.com 313 | 314 | 如有建议或意见,请在issue提问或邮件 315 | 316 | ## License 317 | 318 | this repo is released under the [MIT 319 | License](http://www.opensource.org/licenses/MIT). 320 | --------------------------------------------------------------------------------