Skip to content

Commit f5cd660

Browse files
committed
.
1 parent 70ea6d8 commit f5cd660

12 files changed

+452
-70
lines changed

css.md

+3
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@ Webkit extensions
8282
* {
8383
text-rendering: optimizeLegibility !important;
8484
-webkit-font-smoothing: antialiased !important;
85+
text-rendering: optimizeLegibility !important;
86+
-webkit-font-smoothing: antialiased !important;
87+
-moz-osx-font-smoothing: grayscale;
8588
}
8689

8790
### Heading kerning pairs and ligature

curl.md

+4
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ Options:
1111
-v # --verbose
1212
-vv # Even more verbose
1313

14+
Request:
15+
16+
--request POST
17+
1418
Data options:
1519

1620
-d <data> # --data: HTTP post data, URL encoded (eg, status="Hello")

gremlins.md

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
title: Gremlins.js
3+
layout: default
4+
---
5+
6+
### Example
7+
8+
gremlins.createHorde()
9+
.before(function(done) {
10+
var horde = this;
11+
setTimeout(function(){
12+
horde.log('async');
13+
done();
14+
}, 500);
15+
})
16+
.before(function() {
17+
this.log('sync');
18+
})
19+
.gremlin(gremlins.species.formFiller())
20+
.gremlin(gremlins.species.clicker().clickTypes(['click']))
21+
.gremlin(gremlins.species.scroller())
22+
.gremlin(function() {
23+
alert('here');
24+
})
25+
.after(function() {
26+
this.log('finished!');
27+
})
28+
.mogwai(gremlins.mogwais.alert())
29+
.mogwai(gremlins.mogwais.fps())
30+
.mogwai(gremlins.mogwais.gizmo().maxErrors(2))
31+
.unleash();
32+
33+
https://github.com/marmelab/gremlins.js

gulp.md

+22-1
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@ title: Gulp
2121
* gulp-nodemon
2222
* gulp-size (displays size)
2323

24-
Example
24+
### Example
2525

2626

27+
// gulpfile.js
2728
// Load plugins
2829
var gulp = require('gulp'),
2930
sass = require('gulp-ruby-sass'),
@@ -113,3 +114,23 @@ title: Gulp
113114
### References
114115

115116
https://github.com/gulpjs/gulp/blob/master/docs/getting-started.md#getting-started
117+
118+
### Livereload
119+
120+
var lr = require('tiny-lr')();
121+
122+
function notify (lr, root) {
123+
return function (event) {
124+
var fname = require('path').relative(root, event.path);
125+
lr.changed({ body: { files: [ fname ] }});
126+
};
127+
}
128+
129+
gulp.task('livereload', function () {
130+
lr.listen(35729)
131+
gulp.watch('public/**/*', notify(lr, __dirname+'/public'));
132+
});
133+
134+
// Express
135+
app.use(require('connect-livereload')())
136+
<!-- livereload --><script>document.write('<script src="'+(location.protocol||'http:')+'//'+(location.hostname||'localhost')+':35729/livereload.js?snipver=1"><\/scr'+'ipt>')</script>

heroku.md

-2
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,6 @@ layout: default
7272

7373
## `domains` - Custom domains
7474

75-
heroku addon:add custom_domains
76-
7775
# Add both!
7876
heroku domains:add example.com
7977
heroku domains:add www.example.com

jshint.md

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
title: Jshint
3+
layout: default
4+
---
5+
6+
### Relaxing
7+
8+
// expr: true
9+
production && a = b;
10+
11+
12+

ractive.md

+140-64
Original file line numberDiff line numberDiff line change
@@ -6,63 +6,93 @@ vim: ft=javascript
66

77
### Initialization
88

9-
new Ractive({
10-
el: $('..'),
11-
el: '#box',
12-
template: '...', // required
13-
14-
// callbacks
15-
init: function() // on instanciate
16-
complete: function() // on finish animations
17-
18-
// objs
19-
data: { ... }
20-
partials: { ... } // global: Ractive.partials
21-
transitions: { ... } // global: Ractive.transitions
22-
components: { ... }
23-
adaptors: [ ... ]
24-
25-
// options
26-
magic: false
27-
modifyArrays: true
28-
twoway: true
29-
noIntro: true // true = disable transition on initial render
30-
lazy: false // false = use keyevents, true = use change/blur
31-
append: false // false = overwrite element, true = append
32-
debug: false
33-
sanitize: false
34-
})
9+
new Ractive({
10+
el: $('..'),
11+
el: '#box',
12+
template: '...', // required
13+
14+
// callbacks
15+
init: function() // on instanciate
16+
complete: function() // on finish animations
17+
18+
// objs
19+
data: { ... }
20+
partials: { ... } // global: Ractive.partials
21+
transitions: { ... } // global: Ractive.transitions
22+
components: { ... }
23+
adaptors: [ ... ]
24+
25+
// options
26+
magic: false
27+
modifyArrays: true
28+
twoway: true
29+
noIntro: true // true = disable transition on initial render
30+
lazy: false // false = use keyevents, true = use change/blur
31+
append: false // false = overwrite element, true = append
32+
debug: false
33+
sanitize: false
34+
})
3535

36+
http://docs.ractivejs.org/latest/initialisation-options
37+
38+
### Instance methods
39+
40+
view.set('a', true)
41+
view.set({ a: true })
42+
view.merge(...)
43+
view.get('a')
44+
45+
view.on('event', function() { ... });
46+
view.fire('event');
47+
48+
view.update()
49+
view.updateModel()
50+
51+
view.find('.klass')
52+
view.findAll('.klass')
53+
view.nodes
54+
view.nodes['hello'] // .find('#hello')
3655

3756
http://docs.ractivejs.org/latest/initialisation-options
3857

58+
### Extend
59+
60+
View = Ractive.extend({
61+
...
62+
})
63+
new View()
64+
3965
### Components
4066

41-
Widget = Ractive.extend({ ... })
67+
Widget = Ractive.extend({ ... })
4268

43-
ractive = new Ractive({
44-
el: 'main',
45-
template: '<widget foo="bar"/>',
46-
components: {
47-
widget: Widget
48-
}
49-
});
69+
ractive = new Ractive({
70+
el: 'main',
71+
template: '<widget foo="bar"/>',
72+
components: {
73+
widget: Widget
74+
}
75+
});
5076

5177
https://github.com/RactiveJS/Ractive/issues/74
5278
https://github.com/RactiveJS/Ractive/wiki/Components
5379

5480
### Partials
5581

56-
// Global partials
57-
Ractive.partials.x = "<..>"
82+
// Global partials
83+
Ractive.partials.x = "<..>"
5884

5985
### Events
6086

61-
<button on-click='activate'>Activate!</button>
87+
view.on('teardown')
6288

63-
view.on({
64-
activate: function () { ... }
65-
});
89+
### DOM Events
90+
91+
<button on-click='activate'>Activate!</button>
92+
93+
view.on({
94+
activate: function () { ... }
95+
});
6696

6797
<button on-click='sort:name'>Sort by name</button>
6898
view.on('sort', function (e, column) {
@@ -77,23 +107,23 @@ https://github.com/RactiveJS/Ractive/wiki/Components
77107

78108
### Markup
79109

80-
Hello, {{name}}
110+
Hello, {{name}}
81111
Body: {{{unescaped}}}
82112

83113
<!-- each -->
84-
{{#list:i}}
85-
<li>{{this.name}}</li>
86-
<li>{{name}}</li>
87-
<li>{{.}}</li> <!-- same as 'this' -->
88-
{{/#list}}
114+
{{#mylist:i}}
115+
<li>{{this.name}}</li>
116+
<li>{{name}}</li>
117+
<li>{{.}}</li> <!-- same as 'this' -->
118+
{{/mylist}}
89119

90120
{{^user}}Not logged in{{/user}} <!-- if false -->
91121
{{#user}}Welcome, sire{{/user}} <!-- if true -->
92122

93-
{{>partialName}}
94-
<component>
123+
{{>partialName}}
124+
<component>
95125

96-
{{#statusDogs[selected]}}
126+
{{#statusDogs[selected]}}
97127

98128
### Transformed attributes
99129

@@ -109,21 +139,67 @@ This transforms the `list` attribute via a helper function called `sort()`.
109139

110140
### Transitions
111141

112-
<div intro="fade">
113-
<div intro="bump">
114-
<div intro="bump:{duration:400}">
142+
<div intro="fade">
143+
<div intro="bump">
144+
<div intro="bump:{duration:400}">
145+
146+
Ractive.transitions.bump = function(t, params) {
147+
params = t.processParams( params, {
148+
duration: 400,
149+
color: t.isIntro ? 'rgb(0,255,0)' : 'rgb(255,0,0)'
150+
});
151+
152+
if (t.isIntro) {
153+
/* enter */
154+
} else {
155+
/* exit */
156+
}
157+
158+
t.complete();
159+
};
160+
161+
### Decorators
162+
163+
<span decorator="tooltip:hello there">Hover me</span>
164+
165+
decorators: {
166+
tooltip: function (node, content) {
167+
// setup code here
168+
return {
169+
teardown: function () {
170+
// cleanup code here
171+
}
172+
}
173+
}
174+
}
175+
176+
<span decorator="tooltip:'a','b',2,'c'">Hover me</span>
177+
178+
tooltip: function (node, a, b, two, c) { ... }
179+
180+
http://docs.ractivejs.org/latest/decorators
181+
182+
### Adaptors
115183

116-
Ractive.transitions.bump = function(t, params) {
117-
params = t.processParams( params, {
118-
duration: 400,
119-
color: t.isIntro ? 'rgb(0,255,0)' : 'rgb(255,0,0)'
120-
});
184+
myAdaptor = {
185+
filter: function (object, keypath, ractive) {
186+
// return `true` if a particular object is of the type we want to adapt
187+
},
188+
wrap: function (ractive, object, keypath, prefixer) {
189+
// set up event bindings here
190+
object.on('change', function () { ractive.set(prefixer({...})); });
191+
// then return a wrapper:
192+
return {
193+
teardown: function () { .. },
194+
// json representation
195+
get: function () { return { a:2, b:3, c:4, ... }; },
196+
// called on ractive.set
197+
set: function (key, val) { },
198+
// called on ractive.set on root (return false = die)
199+
reset: function (data) { return false; }
200+
};
201+
}
202+
};
121203

122-
if (t.isIntro) {
123-
/* enter */
124-
} else {
125-
/* exit */
126-
}
127204

128-
t.complete();
129-
};
205+
http://docs.ractivejs.org/latest/adaptors

0 commit comments

Comments
 (0)