rtorrent: update

This commit is contained in:
Rico Sta. Cruz 2017-10-11 15:50:19 +08:00
parent da34aa0572
commit d1a7f94e64
No known key found for this signature in database
GPG Key ID: CAAD38AE2962619A
2 changed files with 139 additions and 70 deletions

View File

@ -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('name')
.attr('email', { required: true }) .attr('email', { required: true })
.use(require('modella-validators') .use(require('modella-validators'))
```
```coffeescript
.validator (u) -> .validator (u) ->
u.error('username', 'is required') unless u.has('username') u.error('username', 'is required') unless u.has('username')
```
### Instances
user ```coffeescript
user
.name() .name()
.name('John') .name('John')
.set(name: 'John') .set(name: 'John')
```
.has('name') //=> true ```coffeescript
.has('name') # → true
.isNew() .isNew()
.isValid() .isValid()
```
```coffeescript
.save (err) -> .save (err) ->
.remove (err) -> .remove (err) ->
.removed .removed
.model // === User .model # === User
```
### Events ## Events
Model.emit('event', [data...]) ### Emitting
record.emit('event', [data...])
```coffeescript
Model.emit('event', [data...])
record.emit('event', [data...])
```
### List of events ### List of events
user ```coffeescript
user
.on 'save', -> .on 'save', ->
.on 'create', -> .on 'create', ->
.on 'saving', (data, done) -> done() .on 'saving', (data, done) -> done()
```
```coffeescript
.on 'remove', -> .on 'remove', ->
.on 'removing', (data, done) -> done() .on 'removing', (data, done) -> done()
```
```coffeescript
.on 'valid', -> .on 'valid', ->
.on 'invalid', -> .on 'invalid', ->
```
```coffeescript
.on 'change', -> .on 'change', ->
.on 'change email', -> .on 'change email', ->
```
```coffeescript
.on 'initializing', (instance, attrs) -> .on 'initializing', (instance, attrs) ->
.on 'initialize', -> .on 'initialize', ->
```
```coffeescript
.on 'error', -> failed to save model .on 'error', -> failed to save model
```
```coffeescript
.on 'setting', (instance, attrs) -> # on Model#set() .on 'setting', (instance, attrs) -> # on Model#set()
.on 'attr', -> # new attr via Model.attr() .on 'attr', -> # new attr via Model.attr()
```
## Misc
### Plugins ### Plugins
MyPlugin = -> ```coffeescript
MyPlugin = ->
return (Model) -> return (Model) ->
```
```coffeescript
Model.method = ... Model.method = ...
Model.prototype.method = ... Model.prototype.method = ...
Model.attr(...) Model.attr(...)
```
```coffeescript
Model Model
```
### Memory ### Memory
User ```coffeescript
User
.all (err, users) -> .all (err, users) ->
.find id, (err, user) -> .find id, (err, user) ->
```
```coffeescript
.remove -> .remove ->
.save -> .save ->
.update -> .update ->
```

View File

@ -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)_