Update.
This commit is contained in:
parent
7603f5879b
commit
08c0092e7a
|
@ -0,0 +1,40 @@
|
||||||
|
---
|
||||||
|
title: Browserify
|
||||||
|
layout: default
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
browserify input.js
|
||||||
|
-o output.js
|
||||||
|
-t coffeeify
|
||||||
|
-t [ coffeeify --extension coffee ]
|
||||||
|
--debug
|
||||||
|
|
||||||
|
### Programmatic usage
|
||||||
|
|
||||||
|
browserify = require('browserify')
|
||||||
|
browserify()
|
||||||
|
.add('main.js')
|
||||||
|
.bundle()
|
||||||
|
.transform(coffeeify)
|
||||||
|
.transform({extensions: '.coffee'}, coffeeify)
|
||||||
|
.pipe(process.stdout)
|
||||||
|
|
||||||
|
browserify({})
|
||||||
|
|
||||||
|
### Tools
|
||||||
|
|
||||||
|
* watchify (recompiles on demand)
|
||||||
|
* beefy (http server)
|
||||||
|
* debowerify
|
||||||
|
* es6ify (es6 to es5)
|
||||||
|
|
||||||
|
Transforms
|
||||||
|
|
||||||
|
* coffeeify
|
||||||
|
* ractify
|
||||||
|
* reactify
|
||||||
|
* brfs
|
||||||
|
* cssify
|
||||||
|
* https://github.com/substack/node-browserify/wiki/list-of-transforms
|
||||||
|
|
42
jshint.md
42
jshint.md
|
@ -3,12 +3,6 @@ title: Jshint
|
||||||
layout: default
|
layout: default
|
||||||
---
|
---
|
||||||
|
|
||||||
### Inline
|
|
||||||
|
|
||||||
/* jshint undef: true */
|
|
||||||
/* global jQuery */
|
|
||||||
/* global -BAD_LIB */
|
|
||||||
|
|
||||||
### Relaxing
|
### Relaxing
|
||||||
|
|
||||||
/* jshint expr: true */
|
/* jshint expr: true */
|
||||||
|
@ -16,28 +10,54 @@ layout: default
|
||||||
|
|
||||||
/* jshint loopfunc: true */
|
/* jshint loopfunc: true */
|
||||||
for (i=0; i<10; x++) {
|
for (i=0; i<10; x++) {
|
||||||
(function(i) {
|
(function(i) { ... })(i);
|
||||||
})(i);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* jshint sub: true */
|
/* jshint sub: true */
|
||||||
process.env['name_here'];
|
process.env['name_here'];
|
||||||
|
|
||||||
|
/* jshint boss: true */
|
||||||
|
if (m = str.match(/.../))
|
||||||
|
|
||||||
|
/* jshint asi: true */
|
||||||
|
allow()
|
||||||
|
missing_semicolons()
|
||||||
|
|
||||||
|
/* jshint evil: true */
|
||||||
|
eval('...')
|
||||||
|
|
||||||
|
/* jshint laxcomma: true */
|
||||||
|
var one = 1
|
||||||
|
, two = 2;
|
||||||
|
|
||||||
|
/* jshint sub: true */
|
||||||
|
person['name']
|
||||||
|
|
||||||
|
|
||||||
### Enforcement
|
### Enforcement
|
||||||
|
|
||||||
/* jshint es3: true (legacy IE compatibility) */
|
/* jshint es3: true */
|
||||||
|
// legacy IE compatibility
|
||||||
a.default = function() { ... };
|
a.default = function() { ... };
|
||||||
array = [ 1, 2, 3, ];
|
array = [ 1, 2, 3, ];
|
||||||
|
|
||||||
/* jshint white: true, indent: 4 */
|
/* jshint white: true, indent: 4 */
|
||||||
// check whitespace and indentation rules
|
/* jshint maxdepth: 2 */
|
||||||
|
/* jshint maxparams: 3 */
|
||||||
|
/* jshint maxstatements: 4 */
|
||||||
|
/* jshint maxcomplexity: 5 */
|
||||||
|
/* jshint maxlen: 80 */
|
||||||
|
|
||||||
### Ignore
|
### Ignore
|
||||||
|
|
||||||
/* jshint ignore:start */
|
/* jshint ignore:start */
|
||||||
/* jshint ignore:end */
|
/* jshint ignore:end */
|
||||||
|
|
||||||
### Environments
|
### Globals
|
||||||
|
|
||||||
|
/* jshint undef: true */
|
||||||
|
/* global jQuery */
|
||||||
|
/* global -BAD_LIB */
|
||||||
|
|
||||||
/* jshint browser: true */ window, document, ...
|
/* jshint browser: true */ window, document, ...
|
||||||
/* jshint node: true */ module, exports, console, process, ...
|
/* jshint node: true */ module, exports, console, process, ...
|
||||||
|
|
|
@ -0,0 +1,70 @@
|
||||||
|
---
|
||||||
|
title: Layout thrashing
|
||||||
|
layout: default
|
||||||
|
---
|
||||||
|
|
||||||
|
### Things that cause invalidation
|
||||||
|
|
||||||
|
Element
|
||||||
|
|
||||||
|
clientHeight
|
||||||
|
clientLeft
|
||||||
|
clientTop
|
||||||
|
clientWidth
|
||||||
|
focus
|
||||||
|
getBoundingClientRect
|
||||||
|
getClientRects
|
||||||
|
innerText
|
||||||
|
offsetHeight
|
||||||
|
offsetLeft
|
||||||
|
offsetParent
|
||||||
|
offsetTop
|
||||||
|
offsetWidth
|
||||||
|
outerText
|
||||||
|
scrollByLines
|
||||||
|
scrollByPages
|
||||||
|
scrollHeight
|
||||||
|
scrollIntoView
|
||||||
|
scrollIntoViewIfNeeded
|
||||||
|
scrollLeft
|
||||||
|
scrollTop
|
||||||
|
scrollWidth
|
||||||
|
|
||||||
|
MouseEvent
|
||||||
|
|
||||||
|
layerX
|
||||||
|
layerY
|
||||||
|
offsetX
|
||||||
|
offsetY
|
||||||
|
|
||||||
|
Window
|
||||||
|
|
||||||
|
getComputedStyle
|
||||||
|
scrollBy
|
||||||
|
scrollTo
|
||||||
|
scrollX
|
||||||
|
scrollY
|
||||||
|
|
||||||
|
Frame, Document & Image
|
||||||
|
|
||||||
|
height
|
||||||
|
width
|
||||||
|
|
||||||
|
jQuery
|
||||||
|
|
||||||
|
$.fn.offset
|
||||||
|
$.fn.offsetParent
|
||||||
|
$.fn.position
|
||||||
|
$.fn.scrollLeft
|
||||||
|
$.fn.scrollTop
|
||||||
|
$.fn.css('...')
|
||||||
|
$.fn.text('...')
|
||||||
|
$(':hidden')
|
||||||
|
$(':contains')
|
||||||
|
|
||||||
|
### Reference
|
||||||
|
|
||||||
|
* http://www.kellegous.com/j/2013/01/26/layout-performance/
|
||||||
|
* https://gist.github.com/desandro/4657744
|
||||||
|
*
|
||||||
|
http://stackoverflow.com/questions/17199958/why-does-setting-textcontent-cause-layout-thrashing
|
|
@ -0,0 +1,47 @@
|
||||||
|
---
|
||||||
|
title: RESTful API
|
||||||
|
layout: default
|
||||||
|
---
|
||||||
|
|
||||||
|
### Status codes
|
||||||
|
|
||||||
|
* `200 OK` - successful get, patch (return a JSON object)
|
||||||
|
* `201 Created` - successful post (return a JSON object)
|
||||||
|
* `202 Accepted` - sucessful post, delete, path - async
|
||||||
|
* `204 No content` - successful delete
|
||||||
|
* `206 Partial content` - successful get - async
|
||||||
|
|
||||||
|
### Error status
|
||||||
|
|
||||||
|
* `401 Unauthorized` - not authenticated
|
||||||
|
* `406 Forbidden` - authenticated but no permissions
|
||||||
|
* `422 Unprocessable entity` - validation
|
||||||
|
|
||||||
|
### Errors
|
||||||
|
|
||||||
|
HTTP/1.1 401 Unauthorized
|
||||||
|
{
|
||||||
|
'id': 'auth_failed',
|
||||||
|
'message': "You're not logged in."
|
||||||
|
}
|
||||||
|
|
||||||
|
### Versioning ([info](https://github.com/interagent/http-api-design#version-with-accepts-header))
|
||||||
|
|
||||||
|
GET /api/foo
|
||||||
|
Accept: application/json; version=1
|
||||||
|
|
||||||
|
### Authentication
|
||||||
|
|
||||||
|
curl -is https://$TOKEN@api.service.com/
|
||||||
|
|
||||||
|
### Methods
|
||||||
|
|
||||||
|
* `GET /articles/1` - read, returns *200*
|
||||||
|
* `PUT /articles/1` - edit (or path), returns *200*
|
||||||
|
* `DELETE /articles/1` - delete, returns *200*
|
||||||
|
* `POST /articles` - create, returns *201*
|
||||||
|
* `GET /articles` - list, returns *200*
|
||||||
|
|
||||||
|
### References
|
||||||
|
|
||||||
|
* https://github.com/interagent/http-api-design
|
Loading…
Reference in New Issue