Skip to content

Commit ecabb55

Browse files
committed
update
1 parent af52384 commit ecabb55

10 files changed

+410
-1884
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ pdf: markdown
4646
--normalize \
4747
--smart \
4848
--toc \
49-
--latex-engine=xelatex
49+
--latex-engine=`which xelatex`
5050

5151
mobi: epub
5252
# Symlink bin: ln -s /path/to/kindlegen /usr/local/bin

chapters/01-introduction.md

Lines changed: 66 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -65,23 +65,25 @@ jQuery[^jQuery]在发布版本``2.1.3``,一共有152个commit。我们可以
6565

6666
通常我们都会找Document,如果没有的话,你会找什么?看源代码,还是看测试?
6767

68-
it("specifying response when you need it", function (done) {
69-
var doneFn = jasmine.createSpy("success");
70-
71-
lettuce.get('/some/cool/url', function (result) {
72-
expect(result).toEqual("awesome response");
73-
done();
74-
});
75-
76-
expect(jasmine.Ajax.requests.mostRecent().url).toBe('/some/cool/url');
77-
expect(doneFn).not.toHaveBeenCalled();
78-
79-
jasmine.Ajax.requests.mostRecent().respondWith({
80-
"status": 200,
81-
"contentType": 'text/plain',
82-
"responseText": 'awesome response'
83-
});
84-
});
68+
```javascript
69+
it("specifying response when you need it", function (done) {
70+
var doneFn = jasmine.createSpy("success");
71+
72+
lettuce.get('/some/cool/url', function (result) {
73+
expect(result).toEqual("awesome response");
74+
done();
75+
});
76+
77+
expect(jasmine.Ajax.requests.mostRecent().url).toBe('/some/cool/url');
78+
expect(doneFn).not.toHaveBeenCalled();
79+
80+
jasmine.Ajax.requests.mostRecent().respondWith({
81+
"status": 200,
82+
"contentType": 'text/plain',
83+
"responseText": 'awesome response'
84+
});
85+
});
86+
```
8587

8688
代码来源: [https://github.com/phodal/lettuce](https://github.com/phodal/lettuce)
8789

@@ -97,17 +99,19 @@ jQuery[^jQuery]在发布版本``2.1.3``,一共有152个commit。我们可以
9799

98100
也许你已经知道了``Selenium````Jasmine````Cucumber``等等的框架,看到过类似于下面的测试
99101

100-
Ajax
101-
✓ specifying response when you need it
102-
✓ specifying html when you need it
103-
✓ should be post to some where
104-
Class
105-
✓ respects instanceof
106-
✓ inherits methods (also super)
107-
✓ extend methods
108-
Effect
109-
✓ should be able fadein elements
110-
✓ should be able fadeout elements
102+
```
103+
Ajax
104+
✓ specifying response when you need it
105+
✓ specifying html when you need it
106+
✓ should be post to some where
107+
Class
108+
✓ respects instanceof
109+
✓ inherits methods (also super)
110+
✓ extend methods
111+
Effect
112+
✓ should be able fadein elements
113+
✓ should be able fadeout elements
114+
```
111115

112116
代码来源: [https://github.com/phodal/lettuce](https://github.com/phodal/lettuce)
113117

@@ -123,17 +127,18 @@ lettuce.js | 98.58% (209 / 212)| 82.98%(78 / 94) | 100.00% (54 / 54) | 98.58% (2
123127

124128
虽然node.js不算是一门语言,但是因为我们用的node,下面的是一个简单的``.travis.yml``示例:
125129

126-
language: node_js
127-
node_js:
128-
- "0.10"
129-
130-
notifications:
131-
email: false
130+
```yml
131+
language: node_js
132+
node_js:
133+
- "0.10"
132134

133-
before_install: npm install -g grunt-cli
134-
install: npm install
135-
after_success: CODECLIMATE_REPO_TOKEN=321480822fc37deb0de70a11931b4cb6a2a3cc411680e8f4569936ac8ffbb0ab codeclimate < coverage/lcov.info
135+
notifications:
136+
email: false
136137

138+
before_install: npm install -g grunt-cli
139+
install: npm install
140+
after_success: CODECLIMATE_REPO_TOKEN=321480822fc37deb0de70a11931b4cb6a2a3cc411680e8f4569936ac8ffbb0ab codeclimate < coverage/lcov.info
141+
```
137142
138143
代码来源: [https://github.com/phodal/lettuce](https://github.com/phodal/lettuce)
139144
@@ -153,28 +158,30 @@ CI对于一个开发者在不同城市开发同一项目上来说是很重要的
153158
154159
先看看上面的ajax类:
155160
156-
Lettuce.get = function (url, callback) {
157-
Lettuce.send(url, 'GET', callback);
158-
};
159-
160-
Lettuce.send = function (url, method, callback, data) {
161-
data = data || null;
162-
var request = new XMLHttpRequest();
163-
if (callback instanceof Function) {
164-
request.onreadystatechange = function () {
165-
if (request.readyState === 4 && (request.status === 200 || request.status === 0)) {
166-
callback(request.responseText);
167-
}
168-
};
169-
}
170-
request.open(method, url, true);
171-
if (data instanceof Object) {
172-
data = JSON.stringify(data);
173-
request.setRequestHeader('Content-Type', 'application/json');
174-
}
175-
request.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
176-
request.send(data);
177-
};
161+
```javascript
162+
Lettuce.get = function (url, callback) {
163+
Lettuce.send(url, 'GET', callback);
164+
};
165+
166+
Lettuce.send = function (url, method, callback, data) {
167+
data = data || null;
168+
var request = new XMLHttpRequest();
169+
if (callback instanceof Function) {
170+
request.onreadystatechange = function () {
171+
if (request.readyState === 4 && (request.status === 200 || request.status === 0)) {
172+
callback(request.responseText);
173+
}
174+
};
175+
}
176+
request.open(method, url, true);
177+
if (data instanceof Object) {
178+
data = JSON.stringify(data);
179+
request.setRequestHeader('Content-Type', 'application/json');
180+
}
181+
request.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
182+
request.send(data);
183+
};
184+
```
178185

179186
代码来源: [https://github.com/phodal/lettuce](https://github.com/phodal/lettuce)
180187

chapters/02-github-fundamentals.md

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,24 @@
2424

2525
如果是第一次使用Git,你需要设置署名和邮箱:
2626

27-
$ git config --global user.name "用户名"
28-
$ git config --global user.email "电子邮箱"
27+
```
28+
$ git config --global user.name "用户名"
29+
$ git config --global user.email "电子邮箱"
30+
```
2931

3032
将代码仓库clone到本地,其实就是将代码复制到你的机器里,并交由Git来管理:
3133

32-
$ git clone git@github.com:someone/symfony-docs-chs.git
34+
```
35+
$ git clone git@github.com:someone/symfony-docs-chs.git
36+
```
3337

3438
你可以修改复制到本地的代码了(symfony-docs-chs项目里都是rst格式的文档)。当你觉得完成了一定的工作量,想做个阶段性的提交:
3539

3640
向这个本地的代码仓库添加当前目录的所有改动:
3741

38-
$ git add .
42+
```
43+
$ git add .
44+
```
3945

4046
或者只是添加某个文件:
4147

@@ -49,16 +55,19 @@
4955

5056
> …or create a new repository on the command line
5157
52-
echo "# github-roam" >> README.md
53-
git init
54-
git add README.md
55-
git commit -m "first commit"
56-
git remote add origin git@github.com:phodal/github-roam.git
57-
git push -u origin master
58+
```
59+
echo "# github-roam" >> README.md
60+
git init
61+
git add README.md
62+
git commit -m "first commit"
63+
git remote add origin git@github.com:phodal/github-roam.git
64+
git push -u origin master
65+
```
5866

5967
> …or push an existing repository from the command line
6068
61-
git remote add origin git@github.com:phodal/github-roam.git
62-
git push -u origin master
63-
69+
```
70+
git remote add origin git@github.com:phodal/github-roam.git
71+
git push -u origin master
72+
```
6473

chapters/04-analytics-02.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ $time python handle.py
1919
sys 0m0.618s
2020
```
2121

22-
##line_profiler python
22+
###line_profiler python
2323

2424
```bash
2525
sudo ARCHFLAGS="-Wno-error=unused-command-line-argument-hard-error-in-future" easy_install line_profiler
@@ -82,7 +82,7 @@ Line # Hits Time Per Hit % Time Line Contents
8282

8383
于是我们就发现我们的瓶颈就是从读取``created_at``,即创建时间。。。以及解析json,反而不是我们关心的IO,果然``readline``很强大。
8484

85-
##memory_profiler
85+
###memory_profiler
8686

8787
首先我们需要install memory_profiler:
8888

@@ -121,7 +121,7 @@ Line # Mem usage Increment Line Contents
121121
27 return datacount, dataarray
122122
```
123123

124-
##objgraph python
124+
###objgraph python
125125

126126
安装objgraph
127127

github-roam.epub

1.75 KB
Binary file not shown.

0 commit comments

Comments
 (0)