rtorrent: update
This commit is contained in:
parent
da34aa0572
commit
d1a7f94e64
143
modella.md
143
modella.md
|
@ -1,82 +1,127 @@
|
||||||
---
|
---
|
||||||
title: Modella
|
title: Modella
|
||||||
category: JavaScript libraries
|
category: JavaScript libraries
|
||||||
|
layout: 2017/sheet
|
||||||
|
prism_languages: [coffeescript]
|
||||||
|
intro: |
|
||||||
|
[Modella](https://www.npmjs.com/package/modella) allows you to create simple models in JavaScript. This is a guide on basic usage of Modella in CoffeeScript.
|
||||||
---
|
---
|
||||||
|
|
||||||
### Basic
|
### Defining models
|
||||||
|
|
||||||
|
```coffeescript
|
||||||
|
User = Modella('User')
|
||||||
|
```
|
||||||
|
|
||||||
User = Modella('User')
|
```coffeescript
|
||||||
|
.attr('name')
|
||||||
|
.attr('email', { required: true })
|
||||||
|
.use(require('modella-validators'))
|
||||||
|
```
|
||||||
|
|
||||||
.attr('name')
|
```coffeescript
|
||||||
.attr('email', { required: true })
|
.validator (u) ->
|
||||||
.use(require('modella-validators')
|
u.error('username', 'is required') unless u.has('username')
|
||||||
|
```
|
||||||
|
|
||||||
.validator (u) ->
|
### Instances
|
||||||
u.error('username', 'is required') unless u.has('username')
|
|
||||||
|
|
||||||
|
```coffeescript
|
||||||
|
user
|
||||||
|
.name()
|
||||||
|
.name('John')
|
||||||
|
.set(name: 'John')
|
||||||
|
```
|
||||||
|
|
||||||
user
|
```coffeescript
|
||||||
.name()
|
.has('name') # → true
|
||||||
.name('John')
|
.isNew()
|
||||||
.set(name: 'John')
|
.isValid()
|
||||||
|
```
|
||||||
|
|
||||||
.has('name') //=> true
|
```coffeescript
|
||||||
.isNew()
|
.save (err) ->
|
||||||
.isValid()
|
.remove (err) ->
|
||||||
|
.removed
|
||||||
|
.model # === User
|
||||||
|
```
|
||||||
|
|
||||||
.save (err) ->
|
## Events
|
||||||
.remove (err) ->
|
|
||||||
.removed
|
|
||||||
.model // === User
|
|
||||||
|
|
||||||
### Events
|
### Emitting
|
||||||
|
|
||||||
Model.emit('event', [data...])
|
```coffeescript
|
||||||
record.emit('event', [data...])
|
Model.emit('event', [data...])
|
||||||
|
record.emit('event', [data...])
|
||||||
|
```
|
||||||
|
|
||||||
### List of events
|
### List of events
|
||||||
|
|
||||||
user
|
```coffeescript
|
||||||
.on 'save', ->
|
user
|
||||||
.on 'create', ->
|
.on 'save', ->
|
||||||
.on 'saving', (data, done) -> done()
|
.on 'create', ->
|
||||||
|
.on 'saving', (data, done) -> done()
|
||||||
|
```
|
||||||
|
|
||||||
.on 'remove', ->
|
```coffeescript
|
||||||
.on 'removing', (data, done) -> done()
|
.on 'remove', ->
|
||||||
|
.on 'removing', (data, done) -> done()
|
||||||
|
```
|
||||||
|
|
||||||
.on 'valid', ->
|
```coffeescript
|
||||||
.on 'invalid', ->
|
.on 'valid', ->
|
||||||
|
.on 'invalid', ->
|
||||||
|
```
|
||||||
|
|
||||||
.on 'change', ->
|
```coffeescript
|
||||||
.on 'change email', ->
|
.on 'change', ->
|
||||||
|
.on 'change email', ->
|
||||||
|
```
|
||||||
|
|
||||||
.on 'initializing', (instance, attrs) ->
|
```coffeescript
|
||||||
.on 'initialize', ->
|
.on 'initializing', (instance, attrs) ->
|
||||||
|
.on 'initialize', ->
|
||||||
|
```
|
||||||
|
|
||||||
.on 'error', -> failed to save model
|
```coffeescript
|
||||||
|
.on 'error', -> failed to save model
|
||||||
|
```
|
||||||
|
|
||||||
.on 'setting', (instance, attrs) -> # on Model#set()
|
```coffeescript
|
||||||
.on 'attr', -> # new attr via Model.attr()
|
.on 'setting', (instance, attrs) -> # on Model#set()
|
||||||
|
.on 'attr', -> # new attr via Model.attr()
|
||||||
|
```
|
||||||
|
|
||||||
|
## Misc
|
||||||
|
|
||||||
### Plugins
|
### Plugins
|
||||||
|
|
||||||
MyPlugin = ->
|
```coffeescript
|
||||||
return (Model) ->
|
MyPlugin = ->
|
||||||
|
return (Model) ->
|
||||||
|
```
|
||||||
|
|
||||||
Model.method = ...
|
```coffeescript
|
||||||
Model.prototype.method = ...
|
Model.method = ...
|
||||||
Model.attr(...)
|
Model.prototype.method = ...
|
||||||
|
Model.attr(...)
|
||||||
|
```
|
||||||
|
|
||||||
Model
|
```coffeescript
|
||||||
|
Model
|
||||||
|
```
|
||||||
|
|
||||||
### Memory
|
### Memory
|
||||||
|
|
||||||
User
|
```coffeescript
|
||||||
.all (err, users) ->
|
User
|
||||||
.find id, (err, user) ->
|
.all (err, users) ->
|
||||||
|
.find id, (err, user) ->
|
||||||
.remove ->
|
```
|
||||||
.save ->
|
|
||||||
.update ->
|
|
||||||
|
|
||||||
|
```coffeescript
|
||||||
|
.remove ->
|
||||||
|
.save ->
|
||||||
|
.update ->
|
||||||
|
```
|
||||||
|
|
64
rtorrent.md
64
rtorrent.md
|
@ -1,39 +1,63 @@
|
||||||
---
|
---
|
||||||
title: Rtorrent
|
title: Rtorrent
|
||||||
category: CLI
|
category: CLI
|
||||||
|
layout: 2017/sheet
|
||||||
|
intro: |
|
||||||
|
[Rtorrent](https://rakshasa.github.io/rtorrent/) is a command-line torrent application. Here are some shortcut keys.
|
||||||
---
|
---
|
||||||
|
|
||||||
|
## Shortcuts
|
||||||
|
{: .-three-column}
|
||||||
|
|
||||||
### Global
|
### Global
|
||||||
|
|
||||||
^q Quit
|
| `^q` | Quit |
|
||||||
|
{: .-shortcuts}
|
||||||
|
|
||||||
### Main view
|
### Main view
|
||||||
|
|
||||||
bksp Add torrent
|
| Shortcut | Description |
|
||||||
|
| --- | --- |
|
||||||
-> View download
|
| `bksp` | Add torrent |
|
||||||
|
| --- | --- |
|
||||||
1 - 7 Change view
|
| `->` | View download |
|
||||||
|
| --- | --- |
|
||||||
^S Start download
|
| `1` _-_ `7` | Change view |
|
||||||
^D Stop download (or remove stopped)
|
| --- | --- |
|
||||||
^K Close a torrent
|
| `^S` | Start download |
|
||||||
|
| `^D` | Stop download (or remove stopped) |
|
||||||
+ - Change priority
|
| `^K` | Close a torrent |
|
||||||
|
| --- | --- |
|
||||||
|
| `+` _/_ `-` | Change priority |
|
||||||
|
{: .-shortcuts}
|
||||||
|
|
||||||
### Throttling
|
### Throttling
|
||||||
|
|
||||||
a/s/d Increase the upload throttle by 1/5/50 KB
|
#### Upload
|
||||||
z/x/c Decrease the upload throttle by 1/5/50 KB
|
|
||||||
A/S/D Increase the download throttle by 1/5/50 KB
|
| `a` _/_ `s` _/_ `d` | Increase upload throttle by 1/5/50 KB |
|
||||||
Z/X/C Decrease the download throttle by 1/5/50 KB
|
| `z` _/_ `x` _/_ `c` | Decrease upload throttle by 1/5/50 KB |
|
||||||
|
{: .-shortcuts}
|
||||||
|
|
||||||
|
#### Download
|
||||||
|
|
||||||
|
| `A` _/_ `S` _/_ `D` | Increase download throttle by 1/5/50 KB |
|
||||||
|
| `Z` _/_ `X` _/_ `C` | Decrease download throttle by 1/5/50 KB |
|
||||||
|
{: .-shortcuts}
|
||||||
|
|
||||||
### Download view
|
### Download view
|
||||||
|
|
||||||
1/2 Adjust max uploads
|
| `1` _/_ `2` | Adjust max uploads |
|
||||||
3/4 Adjust min peers
|
| `3` _/_ `4` | Adjust min peers |
|
||||||
5/6 Adjust max peers
|
| `5` _/_ `6` | Adjust max peers |
|
||||||
|
{: .-shortcuts}
|
||||||
|
|
||||||
### File list view
|
### File list view
|
||||||
|
|
||||||
space Change priority
|
| `space` | Change priority |
|
||||||
|
{: .-shortcuts}
|
||||||
|
|
||||||
|
## Also see
|
||||||
|
|
||||||
|
- [Rtorrent website](https://rakshasa.github.io/rtorrent/) _(rakshasa.github.io)_
|
||||||
|
- [Rtorrent wiki](https://github.com/rakshasa/rtorrent/wiki) _(github.com)_
|
||||||
|
|
Loading…
Reference in New Issue