Vim is a life style
vim outstanding configuration file " From cowboy configuration " Use the Solarized Dark theme set background=dark colorscheme solarized "colorscheme desert " Make Vim more useful set nocompatible " Use the OS clipboard by default (on versions compiled with `+clipboard`) set clipboard=unnamed " Enhance command-line completion set wildmenu " Allow cursor keys in insert mode set esckeys " Allow backspace in insert mode set backspace=indent,eol,start " Optimize for fast terminal connections set ttyfast " Add the g flag to search/replace by default set gdefault " Use UTF-8 without BOM set encoding=utf-8 nobomb " Change mapleader let mapleader="," " Don’t add empty newlines at the end of files set binary set noeol " Centralize backups, swapfiles and undo history set backupdir=~/dotfiles/.
2013-05-13-rake-in-coffee1.md
layout: post title: “用coffee脚本自动生成MVC” description: "" category: “lesson” tags: [intro, beginner, jekyll, tutorial] 创建程序入口 mkdirp = require('./node_modules/express/node_modules/mkdirp') os = require('os') fs = require('fs') readline = require('readline') eol = 'win32' == os.platform() ? '\r\n' : '\n' views = ['list','create','get','update','layout'] emptyDirectory=(path, fn) -> fs.readdir path, (err, files)-> throw err if err && 'ENOENT' != err.code fn(!files || !files.length) read=(path,fn) -> fs.readFile path,'utf8',(err,data)-> fn && fn(data) write=(path, str) -> fs.writeFileSync(path, str,'utf8') console.log(' ' + path) mkdir=(path, fn) -> mkdirp path, 755, (err)-> throw err if err console.
2013-05-13-rake-in-coffee2.md
layout: post title: “用coffee脚本自动生成MVC” description: "" category: “lesson” tags: [intro, beginner, jekyll, tutorial] 创建程序入口 createApplication=(path)-> console.log 'creating files...' createMVC path 生成MVC的入口 createMVC=(path)-> console.log path console.log("请注意,我将为你自动生成相关文件。所有现有文件将被覆盖。"); console.log("1. 生成数据模块定义文件") moduleDir = './module/' + path mkdir moduleDir templateSchemaFile = './templates/schema.coffee' templateSchemaFileData = fs.readFileSync templateSchemaFile,'utf8' console.log templateSchemaFileData write moduleDir + '/schema.coffee',templateSchemaFileData console.log("2. 生成视图定义文件") viewDir= './views/' + path mkdir viewDir for view in views templateViewFile= './templates/' + view + '.jade' write viewDir + '/' + view + '.
2013-05-13-rake-in-coffee3.md
layout: post title: “用coffee脚本自动生成MVC” description: "" category: “lesson” tags: [intro, beginner, jekyll, tutorial] 主程序入口 main=()-> rl = readline.createInterface(process.stdin, process.stdout) console.log "Please define your Module's name and schema in following format" console.log "name=key1:value1,key2:value2,..." rl.setPrompt('OHAI> ') rl.prompt() rl.on 'line',(line)-> name = line.split('=') MODULE_NAME = name[0] MODULE_SCHEMA = name[1].split(',').join('\n') console.log MODULE_NAME console.log MODULE_SCHEMA console.log 'Generating new MVC files...' createApplication MODULE_NAME console.log 'Doing Customization Stuff...' moduleFile = './module/' + MODULE_NAME + '/schema.coffee' customize moduleFile,MODULE_NAME,MODULE_SCHEMA for view in views viewFile = '.