This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Tiny VIM tutor . | |
| ## 移动光标 | |
| * `hjkl` -> 左下上右 | |
| ## 重复 | |
| * `number command object` -> 重复 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var Promise = function (fun) { | |
| var me = this, | |
| resolve = function (val) { | |
| me.resolve(val); | |
| }, | |
| reject = function (val) { | |
| me.reject(val); | |
| } | |
| me._st = 'pending'; | |
| me._rsq = null; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| //简单累加全局变量 | |
| var fishWeight = 0; | |
| var addWeight = function(weight) { | |
| fishWeight += weight; | |
| }; | |
| addWeight(2.3); | |
| addWeight(6.5); | |
| addWeight(1.2); | |
| addWeight(2.5); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function co(generator) { | |
| return function(fn) { | |
| var gen = generator(); | |
| function next(err, result) { | |
| if(err){ | |
| return fn(err); | |
| } | |
| var step = gen.next(result); | |
| if (!step.done) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var circle = paper.circle(size/4, size/4, 40); | |
| var uuid = Raphael.createUUID(); | |
| var pattern = document.createElementNS("http://www.w3.org/2000/svg", "pattern"); | |
| var backgroundImage = paper.image("../css/tx.png", 0, 0, 1, 1); | |
| pattern.setAttribute("id", uuid); | |
| pattern.setAttribute("x", 0); | |
| pattern.setAttribute("y", 0); | |
| pattern.setAttribute("height", 1); | |
| pattern.setAttribute("width", 1); | |
| pattern.setAttribute("patternContentUnits", "objectBoundingBox"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| body { | |
| font-family: Helvetica, arial, sans-serif; | |
| font-size: 14px; | |
| line-height: 1.6; | |
| padding-top: 10px; | |
| padding-bottom: 10px; | |
| background-color: white; | |
| padding: 30px; | |
| color: #333; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function Socket(options) { | |
| // ... | |
| stream.Stream.call(this); | |
| // ... | |
| } | |
| util.inherits(Socket, stream.Stream); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var gulp = require('gulp'); | |
| var gulpif = require('gulp-if'); | |
| var sprite = require('css-sprite').stream; | |
| var base = require('gulp-base64'); | |
| // generate sprite.png and _sprite.scss | |
| gulp.task('sprites', function () { | |
| return gulp.src('img/*.png') | |
| .pipe(sprite({ | |
| name: 'tx.png', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var gulp = require('gulp'), | |
| stylus = require('gulp-stylus'), | |
| jade = require('gulp-jade'); | |
| jademod = require('jade2mod'); | |
| var paths = { | |
| stylus: ['stylus/*.styl'], | |
| html: ['html/*.html'], | |
| jade: ['jade/*.jade'], | |
| engine: ['jade/engine/*.jade'] |