Formatting: update formatting of 20+ files (#1490)
This commit is contained in:
parent
87ed01b739
commit
969967363f
63
ansi.md
63
ansi.md
|
@ -1,41 +1,52 @@
|
||||||
---
|
---
|
||||||
title: Ansi codes
|
title: Ansi codes
|
||||||
category: CLI
|
category: CLI
|
||||||
|
layout: 2017/sheet
|
||||||
|
intro: |
|
||||||
|
Quick reference to ANSI color codes.
|
||||||
---
|
---
|
||||||
|
|
||||||
Format
|
### Format
|
||||||
|
|
||||||
\033[#m
|
```
|
||||||
|
\033[#m
|
||||||
|
```
|
||||||
|
|
||||||
Where:
|
### ANSI codes
|
||||||
|
|
||||||
0 clear
|
```
|
||||||
1 bold
|
0 clear
|
||||||
4 underline
|
1 bold
|
||||||
5 blink
|
4 underline
|
||||||
|
5 blink
|
||||||
|
|
||||||
30-37 fg color
|
30-37 fg color
|
||||||
40-47 bg color
|
40-47 bg color
|
||||||
|
|
||||||
1K clear line (to beginning of line)
|
1K clear line (to beginning of line)
|
||||||
2K clear line (entire line)
|
2K clear line (entire line)
|
||||||
2J clear screen
|
2J clear screen
|
||||||
0;0H move cursor to 0;0
|
0;0H move cursor to 0;0
|
||||||
|
|
||||||
1A move up 1 line
|
1A move up 1 line
|
||||||
|
```
|
||||||
|
|
||||||
Colors
|
### Colors
|
||||||
|
|
||||||
0 black
|
```
|
||||||
1 red
|
0 black
|
||||||
2 green
|
1 red
|
||||||
3 yellow
|
2 green
|
||||||
4 blue
|
3 yellow
|
||||||
5 magenta
|
4 blue
|
||||||
6 cyan
|
5 magenta
|
||||||
7 white
|
6 cyan
|
||||||
|
7 white
|
||||||
|
```
|
||||||
|
|
||||||
Stuff
|
### Bash utilities
|
||||||
|
|
||||||
hide_cursor() { printf "\e[?25l"; }
|
```sh
|
||||||
show_cursor() { printf "\e[?25h"; }
|
hide_cursor() { printf "\e[?25l"; }
|
||||||
|
show_cursor() { printf "\e[?25h"; }
|
||||||
|
```
|
||||||
|
|
61
atom.md
61
atom.md
|
@ -5,14 +5,13 @@ layout: 2017/sheet
|
||||||
updated: 2017-09-20
|
updated: 2017-09-20
|
||||||
---
|
---
|
||||||
|
|
||||||
Shortcuts
|
## Shortcuts
|
||||||
---------
|
|
||||||
{: .-three-column}
|
{: .-three-column}
|
||||||
|
|
||||||
### Tree
|
### Tree
|
||||||
|
|
||||||
| Shortcut | Description |
|
| Shortcut | Description |
|
||||||
| --- | --- |
|
| -------- | ------------------- |
|
||||||
| `⌘\` | Toggle tree |
|
| `⌘\` | Toggle tree |
|
||||||
| `⌘⇧\` | Reveal current file |
|
| `⌘⇧\` | Reveal current file |
|
||||||
{: .-shortcuts}
|
{: .-shortcuts}
|
||||||
|
@ -20,14 +19,14 @@ Shortcuts
|
||||||
### Comments
|
### Comments
|
||||||
|
|
||||||
| Shortcut | Description |
|
| Shortcut | Description |
|
||||||
| --- | --- |
|
| -------- | --------------- |
|
||||||
| `⌘/` | Toggle comments |
|
| `⌘/` | Toggle comments |
|
||||||
{: .-shortcuts}
|
{: .-shortcuts}
|
||||||
|
|
||||||
### View
|
### View
|
||||||
|
|
||||||
| Shortcut | Description |
|
| Shortcut | Description |
|
||||||
| --- | --- |
|
| -------- | ---------------------- |
|
||||||
| `⌘k` `←` | Split pane to the left |
|
| `⌘k` `←` | Split pane to the left |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| `⌘⌥=` | Grow pane |
|
| `⌘⌥=` | Grow pane |
|
||||||
|
@ -38,6 +37,8 @@ Shortcuts
|
||||||
|
|
||||||
### Bracket matcher
|
### Bracket matcher
|
||||||
|
|
||||||
|
| Shortcut | Description |
|
||||||
|
| -------- | ------------------------------ |
|
||||||
| `^m` | Go to matching bracket |
|
| `^m` | Go to matching bracket |
|
||||||
| `^]` | Remove brackets from selection |
|
| `^]` | Remove brackets from selection |
|
||||||
| `^⌘m` | Select inside brackets |
|
| `^⌘m` | Select inside brackets |
|
||||||
|
@ -46,6 +47,8 @@ Shortcuts
|
||||||
|
|
||||||
### Symbols view
|
### Symbols view
|
||||||
|
|
||||||
|
| Shortcut | Description |
|
||||||
|
| -------- | -------------------------------- |
|
||||||
| `^⌥↓` | Jump to declaration under cursor |
|
| `^⌥↓` | Jump to declaration under cursor |
|
||||||
| `^⇧r` | Show tags |
|
| `^⇧r` | Show tags |
|
||||||
{: .-shortcuts}
|
{: .-shortcuts}
|
||||||
|
@ -62,34 +65,34 @@ See: [Symbols view](https://atom.io/packages/symbols-view)
|
||||||
|
|
||||||
### Editing
|
### Editing
|
||||||
|
|
||||||
| Shortcut | Description
|
| Shortcut | Description |
|
||||||
| --- | ---
|
| -------- | -------------- |
|
||||||
| `⌘d` | Select word
|
| `⌘d` | Select word |
|
||||||
| `⌘l` | Select line
|
| `⌘l` | Select line |
|
||||||
| --- | ---
|
| --- | --- |
|
||||||
| `⌘↓` | Move line down
|
| `⌘↓` | Move line down |
|
||||||
| `⌘↑` | Move line up
|
| `⌘↑` | Move line up |
|
||||||
| --- | ---
|
| --- | --- |
|
||||||
| `⌘⏎` | New line below
|
| `⌘⏎` | New line below |
|
||||||
| `⌘⇧⏎` | New line above
|
| `⌘⇧⏎` | New line above |
|
||||||
| --- | ---
|
| --- | --- |
|
||||||
| `⌘⇧k` | Delete line
|
| `⌘⇧k` | Delete line |
|
||||||
| `⌘⇧d` | Duplicate line
|
| `⌘⇧d` | Duplicate line |
|
||||||
{: .-shortcuts}
|
{: .-shortcuts}
|
||||||
|
|
||||||
### Project
|
### Project
|
||||||
|
|
||||||
| Shortcut | Description
|
| Shortcut | Description |
|
||||||
| --- | ---
|
| -------- | ----------------------- |
|
||||||
| `⌘⇧p` | Command palette
|
| `⌘⇧p` | Command palette |
|
||||||
| `⌘⇧a` | Add project folder
|
| `⌘⇧a` | Add project folder |
|
||||||
| --- | ---
|
| --- | --- |
|
||||||
| `⌘n` | New file
|
| `⌘n` | New file |
|
||||||
| `⌘⇧n` | New window
|
| `⌘⇧n` | New window |
|
||||||
| --- | ---
|
| --- | --- |
|
||||||
| `⌘f` | Find in file
|
| `⌘f` | Find in file |
|
||||||
| `⌘⇧f` | Find in project
|
| `⌘⇧f` | Find in project |
|
||||||
| `⌘t` | Search files in project
|
| `⌘t` | Search files in project |
|
||||||
{: .-shortcuts}
|
{: .-shortcuts}
|
||||||
|
|
||||||
## Notes
|
## Notes
|
||||||
|
|
|
@ -1,21 +0,0 @@
|
||||||
# bookshelf-contrib.Scopes
|
|
||||||
#
|
|
||||||
class Books
|
|
||||||
scopes:
|
|
||||||
published: (q) -> q.where(published: true)
|
|
||||||
|
|
||||||
Books.published().fetchAll()
|
|
||||||
|
|
||||||
|
|
||||||
# bookshelf-contrib.QueryProxy
|
|
||||||
#
|
|
||||||
Books.query().where(published: true)
|
|
||||||
Books.where(published: true)
|
|
||||||
|
|
||||||
# bookshelf-contrib.Migration
|
|
||||||
class Migration
|
|
||||||
up: ->
|
|
||||||
down: ->
|
|
||||||
|
|
||||||
|
|
||||||
|
|
39
cordova.md
39
cordova.md
|
@ -1,25 +1,34 @@
|
||||||
---
|
---
|
||||||
title: Cordova
|
title: Apache Cordova
|
||||||
|
layout: 2017/sheet
|
||||||
|
intro: |
|
||||||
|
A quick reference to common [Apache Cordova](https://cordova.apache.org/) commands.
|
||||||
---
|
---
|
||||||
|
|
||||||
cordova plugin ls
|
### Common commands
|
||||||
cordova plugin search facebook
|
|
||||||
cordova plugin add com.phonegap.plugins.facebookconnect
|
|
||||||
|
|
||||||
cordova platform add ios
|
```
|
||||||
cordova platform ls
|
cordova plugin ls
|
||||||
cordova platform update ios
|
cordova plugin search facebook
|
||||||
cordova platform check
|
cordova plugin add com.phonegap.plugins.facebookconnect
|
||||||
|
```
|
||||||
|
|
||||||
### Some plugins
|
```
|
||||||
|
cordova platform add ios
|
||||||
|
cordova platform ls
|
||||||
|
cordova platform update ios
|
||||||
|
cordova platform check
|
||||||
|
```
|
||||||
|
|
||||||
You'll likely need these:
|
### Common plugins
|
||||||
|
|
||||||
* [org.apache.cordova.console](https://github.com/apache/cordova-plugin-console)
|
Some commonly-used plugins:
|
||||||
* [org.apache.cordova.inappbrowser](https://github.com/apache/cordova-plugin-inappbrowser)
|
|
||||||
* [org.apache.cordova.statusbar](https://github.com/apache/cordova-plugin-statusbar)
|
- [org.apache.cordova.console](https://github.com/apache/cordova-plugin-console)
|
||||||
* org.apache.cordova.splashscreen
|
- [org.apache.cordova.inappbrowser](https://github.com/apache/cordova-plugin-inappbrowser)
|
||||||
|
- [org.apache.cordova.statusbar](https://github.com/apache/cordova-plugin-statusbar)
|
||||||
|
- org.apache.cordova.splashscreen
|
||||||
|
|
||||||
Also:
|
Also:
|
||||||
|
|
||||||
* com.phonegap.plugins.facebookconnect
|
- com.phonegap.plugins.facebookconnect
|
||||||
|
|
|
@ -1,9 +0,0 @@
|
||||||
---
|
|
||||||
title: Cryptography
|
|
||||||
---
|
|
||||||
|
|
||||||
* [PBKDF2](http://en.wikipedia.org/wiki/PBKDF2) - password-based key derivation
|
|
||||||
function
|
|
||||||
|
|
||||||
* [HMAC](http://en.wikipedia.org/wiki/HMAC) - Hash-based message authentication
|
|
||||||
code
|
|
24
freenode.md
24
freenode.md
|
@ -1,14 +1,26 @@
|
||||||
---
|
---
|
||||||
title: Freenode
|
title: Freenode
|
||||||
|
layout: 2017/sheet
|
||||||
|
tags: [WIP]
|
||||||
---
|
---
|
||||||
|
|
||||||
### irc.freenode.net
|
### IRC server
|
||||||
|
|
||||||
/msg nickserv identify [nick] <password>
|
```
|
||||||
/msg nickserv info <nick>
|
irc.freenode.net
|
||||||
|
```
|
||||||
|
|
||||||
|
### NickServ commands
|
||||||
|
|
||||||
|
```
|
||||||
|
/msg nickserv identify [nick] <password>
|
||||||
|
/msg nickserv info <nick>
|
||||||
|
```
|
||||||
|
|
||||||
### Add a nick
|
### Add a nick
|
||||||
|
|
||||||
/nick newnick
|
```
|
||||||
/msg nickserv identify <oldnick> <password>
|
/nick newnick
|
||||||
/msg nickserv group
|
/msg nickserv identify <oldnick> <password>
|
||||||
|
/msg nickserv group
|
||||||
|
```
|
||||||
|
|
|
@ -1,12 +1,26 @@
|
||||||
---
|
---
|
||||||
title: Google Webfonts
|
title: Google Webfonts
|
||||||
|
layout: 2017/sheet
|
||||||
|
intro: |
|
||||||
|
Short snippets on using [Google Webfonts](https://google.com/fonts) in a web page.
|
||||||
---
|
---
|
||||||
|
|
||||||
### Link tag
|
### Link tag
|
||||||
|
|
||||||
<link href='http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>
|
<!-- prettier-ignore -->
|
||||||
|
```html
|
||||||
|
<link href="http://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet" type="text/css" />
|
||||||
|
```
|
||||||
|
|
||||||
### CSS import
|
### CSS import
|
||||||
|
|
||||||
@import url(http://fonts.googleapis.com/css?family=Open+Sans);
|
<!-- prettier-ignore -->
|
||||||
@import url(http://fonts.googleapis.com/css?family=Open+Sans:400,400italic|Montserrat:400,700);
|
```css
|
||||||
|
/* One font */
|
||||||
|
@import url('https://fonts.googleapis.com/css?family=Open+Sans:400,700');
|
||||||
|
|
||||||
|
/* Combining multiple fonts */
|
||||||
|
@import url('https://fonts.googleapis.com/css?family=Open+Sans:400,400italic|Montserrat:400,700'');
|
||||||
|
```
|
||||||
|
|
||||||
|
Great for using with [Codepen.io](https://codepen.io/) or similar websites!
|
||||||
|
|
|
@ -1,31 +1,43 @@
|
||||||
---
|
---
|
||||||
title: Imagemagick
|
title: Imagemagick
|
||||||
|
layout: 2017/sheet
|
||||||
|
intro: |
|
||||||
|
A quick reference for common [Imagemagick](https://www.imagemagick.org) commands and switches.
|
||||||
---
|
---
|
||||||
|
|
||||||
### Stuff
|
### Common options
|
||||||
|
|
||||||
-resize 100x40
|
| Option | Description |
|
||||||
-crop 40x30+10+10 # (width)x(height)+(x)+y
|
| ------------------- | ------------------------------- |
|
||||||
-crop 40x30-10-10 # (width)x(height)+(x)+y
|
| `-resize 100x40` | Resize to a dimension |
|
||||||
-flip # vertical
|
| `-crop 40x30+10+10` | (width)x(height)+(x)+y |
|
||||||
-flop # horizontal
|
| `-crop 40x30-10-10` | (width)x(height)+(x)+y |
|
||||||
-transpose # flip vertical + rotate 90deg
|
| `-flip` | Vertical |
|
||||||
-transverse # flip horizontal + rotate 270deg
|
| `-flop` | Horizontal |
|
||||||
-trim # trim image edges
|
| `-transpose` | Flip vertical + rotate 90deg |
|
||||||
-rotate 90
|
| `-transverse` | Flip horizontal + rotate 270deg |
|
||||||
|
| `-trim` | Trim image edges |
|
||||||
|
| `-rotate 90` | Rotate 90 degrees |
|
||||||
|
|
||||||
### Resize to fit
|
### Resize to fit
|
||||||
|
|
||||||
convert input.jpg -resize 80x80^ -gravity center -extent 80x80 icon.png
|
```sh
|
||||||
|
convert input.jpg -resize 80x80^ -gravity center -extent 80x80 icon.png
|
||||||
|
```
|
||||||
|
|
||||||
### Convert all images to another format
|
### Convert all images to another format
|
||||||
|
|
||||||
mogrify -format jpg -quality 85 *.png
|
```sh
|
||||||
|
mogrify -format jpg -quality 85 *.png
|
||||||
|
```
|
||||||
|
|
||||||
### Make a pdf
|
### Make a pdf
|
||||||
|
|
||||||
convert *.jpg hello.pdf
|
```sh
|
||||||
|
convert *.jpg hello.pdf
|
||||||
|
```
|
||||||
|
|
||||||
### References
|
### References
|
||||||
|
|
||||||
* http://www.noah.org/wiki/ImageMagick
|
- <http://www.noah.org/wiki/ImageMagick>
|
||||||
|
- <https://www.imagemagick.org/>
|
||||||
|
|
|
@ -1,8 +1,12 @@
|
||||||
---
|
---
|
||||||
title: jQuery CDN
|
title: jQuery CDN
|
||||||
category: JavaScript libraries
|
category: JavaScript libraries
|
||||||
|
tags: [Archived]
|
||||||
|
layout: 2017/sheet
|
||||||
---
|
---
|
||||||
|
|
||||||
### Google jQuery
|
### Google jQuery
|
||||||
|
|
||||||
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
|
```html
|
||||||
|
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
|
||||||
|
```
|
||||||
|
|
|
@ -1,16 +1,25 @@
|
||||||
---
|
---
|
||||||
title: assert
|
title: assert
|
||||||
category: Node.js
|
category: Node.js
|
||||||
|
layout: 2017/sheet
|
||||||
---
|
---
|
||||||
|
|
||||||
assert(val)
|
### Assertions
|
||||||
assert.equal(actual, expected)
|
|
||||||
assert.notEqual(a, e)
|
|
||||||
|
|
||||||
assert.deepEqual(a, e)
|
```js
|
||||||
assert.notDeepEqual(a, e)
|
assert(val)
|
||||||
|
assert.equal(actual, expected)
|
||||||
|
assert.notEqual(a, e)
|
||||||
|
```
|
||||||
|
|
||||||
assert.throws(fn)
|
```js
|
||||||
|
assert.deepEqual(a, e)
|
||||||
|
assert.notDeepEqual(a, e)
|
||||||
|
```
|
||||||
|
|
||||||
|
```js
|
||||||
|
assert.throws(fn)
|
||||||
|
```
|
||||||
|
|
||||||
### References
|
### References
|
||||||
|
|
||||||
|
|
|
@ -1,18 +1,33 @@
|
||||||
---
|
---
|
||||||
title: path
|
title: Node.js path API
|
||||||
category: Node.js
|
category: Node.js
|
||||||
|
layout: 2017/sheet
|
||||||
|
intro: |
|
||||||
|
Quick reference to the [Node.js path API](https://nodejs.org/api/path.html).
|
||||||
---
|
---
|
||||||
|
|
||||||
fs.realpath('/etc/passwd', function(err, path) { /* "/private/etc/passwd" */
|
### Functions
|
||||||
});
|
|
||||||
|
|
||||||
dir = path.join('etc', 'passwd');
|
```js
|
||||||
dir = path.resolve('/etc', 'passwd', '..', 'var');
|
const fs = require('fs')
|
||||||
|
|
||||||
path.dirname('/etc/passwd') //=> "/etc"
|
fs.realpath('/etc/passwd', function (err, path) {
|
||||||
path.basename('/etc/passwd') //=> "passwd"
|
path // => "/private/etc/passwd"
|
||||||
path.basename('/etc/rc.d', '.d') //=> "rc"
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
```js
|
||||||
|
const path = require('path')
|
||||||
|
dir = path.join('etc', 'passwd')
|
||||||
|
dir = path.resolve('/etc', 'passwd', '..', 'var')
|
||||||
|
```
|
||||||
|
|
||||||
|
```js
|
||||||
|
path.dirname('/etc/passwd') // => "/etc"
|
||||||
|
path.basename('/etc/passwd') // => "passwd"
|
||||||
|
path.basename('/etc/rc.d', '.d') // => "rc"
|
||||||
|
```
|
||||||
|
|
||||||
### References
|
### References
|
||||||
|
|
||||||
- http://nodejs.org/api/path.html
|
- https://nodejs.org/api/path.html
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "^7.10.2",
|
"@babel/core": "^7.10.2",
|
||||||
"@babel/preset-env": "^7.10.2",
|
"@babel/preset-env": "^7.10.2",
|
||||||
|
"@rstacruz/prettier-plugin-markdown-code-fences": "^1.0.0",
|
||||||
"jest": "26.0.1",
|
"jest": "26.0.1",
|
||||||
"jest-html": "1.5.0",
|
"jest-html": "1.5.0",
|
||||||
"netlify-plugin-minify-html": "^0.2.3",
|
"netlify-plugin-minify-html": "^0.2.3",
|
||||||
|
|
11
passenger.md
11
passenger.md
|
@ -1,12 +1,19 @@
|
||||||
---
|
---
|
||||||
title: Phusion Passenger
|
title: Phusion Passenger
|
||||||
|
tags: [WIP]
|
||||||
|
layout: 2017/sheet
|
||||||
---
|
---
|
||||||
|
|
||||||
server {
|
### Enabling Phusion passenger
|
||||||
|
|
||||||
|
```
|
||||||
|
server {
|
||||||
listen 80;
|
listen 80;
|
||||||
server_name www.yourhost.com;
|
server_name www.yourhost.com;
|
||||||
root /somewhere/public; # <--- be sure to point to 'public'!
|
root /somewhere/public; # <--- be sure to point to 'public'!
|
||||||
passenger_enabled on;
|
passenger_enabled on;
|
||||||
autoindex on; # Show directory listings
|
autoindex on; # Show directory listings
|
||||||
}
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
This is an example nginx configuration.
|
||||||
|
|
31
premailer.md
31
premailer.md
|
@ -1,13 +1,28 @@
|
||||||
---
|
---
|
||||||
title: Premailer
|
title: Premailer
|
||||||
|
layout: 2017/sheet
|
||||||
|
tags: [WIP]
|
||||||
|
intro: |
|
||||||
|
[Premailer](https://github.com/premailer/premailer/) is a Ruby library that inlines CSS into HTML.
|
||||||
---
|
---
|
||||||
|
|
||||||
|
### Custom CSS properties
|
||||||
|
|
||||||
-premailer-width
|
<!-- prettier-ignore -->
|
||||||
Available on table, th and td elements
|
```css
|
||||||
-premailer-height
|
table, th, td {
|
||||||
Available on table, tr, th and td elements
|
/* Available on table, th and td elements */
|
||||||
-premailer-cellpadding
|
-premailer-width: 32px;
|
||||||
Available on table elements
|
}
|
||||||
-premailer-cellspacing
|
|
||||||
Available on table elements
|
table, tr, th, td {
|
||||||
|
/* Available on table, tr, th and td elements */
|
||||||
|
-premailer-height: 32px;
|
||||||
|
}
|
||||||
|
|
||||||
|
table {
|
||||||
|
/* Available on table elements */
|
||||||
|
-premailer-cellpadding: 32px;
|
||||||
|
-premailer-cellspacing: 32px;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
53
qunit.md
53
qunit.md
|
@ -1,32 +1,47 @@
|
||||||
---
|
---
|
||||||
title: Qunit
|
title: Qunit
|
||||||
category: JavaScript libraries
|
category: JavaScript libraries
|
||||||
|
layout: 2017/sheet
|
||||||
|
intro: |
|
||||||
|
A quick reference for the [QUnit](https://yarnpkg.com/package/qunit) testing library in JavaScript.
|
||||||
---
|
---
|
||||||
|
|
||||||
QUnit.module('a');
|
```js
|
||||||
QUnit.test('ok', function (t) { ... });
|
QUnit.module('a')
|
||||||
|
QUnit.test('ok', function (t) {
|
||||||
|
/* ... */
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
### Hooks
|
### Hooks
|
||||||
|
|
||||||
// each test
|
#### Each test
|
||||||
QUnit.testStart(function)
|
|
||||||
QUnit.testEnd(function)
|
|
||||||
|
|
||||||
// each module
|
```js
|
||||||
QUnit.moduleStart(function)
|
// each test
|
||||||
QUnit.moduleEnd(function)
|
QUnit.testStart(function)
|
||||||
|
QUnit.testEnd(function)
|
||||||
|
```
|
||||||
|
|
||||||
// all
|
```js
|
||||||
QUnit.begin(function)
|
// each module
|
||||||
QUnit.done(function)
|
QUnit.moduleStart(function)
|
||||||
|
QUnit.moduleEnd(function)
|
||||||
|
```
|
||||||
|
|
||||||
|
```js
|
||||||
|
// all
|
||||||
|
QUnit.begin(function)
|
||||||
|
QUnit.done(function)
|
||||||
|
```
|
||||||
|
|
||||||
### Assertions
|
### Assertions
|
||||||
|
|
||||||
t.equal(actual, expected)
|
```js
|
||||||
t.deepEqual(actual, expected)
|
t.equal(actual, expected)
|
||||||
t.strictEqual(actual, expected)
|
t.deepEqual(actual, expected)
|
||||||
t.propEqual(actual, expected)
|
t.strictEqual(actual, expected)
|
||||||
|
t.propEqual(actual, expected)
|
||||||
t.notEqual
|
t.notEqual(actual, expected)
|
||||||
|
t.expect(amount)
|
||||||
t.expect(amount)
|
```
|
||||||
|
|
|
@ -1,24 +0,0 @@
|
||||||
---
|
|
||||||
title: Rails gems
|
|
||||||
category: Rails
|
|
||||||
---
|
|
||||||
|
|
||||||
### Rico's preferred rails gems
|
|
||||||
|
|
||||||
Development:
|
|
||||||
|
|
||||||
gem 'spring' # code reloading
|
|
||||||
gem 'letter_opener'
|
|
||||||
gem 'better_errors'
|
|
||||||
gem 'meta-tags'
|
|
||||||
gem 'guard-rspec'
|
|
||||||
|
|
||||||
Prod:
|
|
||||||
|
|
||||||
gem 'kaminari' # pagination
|
|
||||||
gem 'devise'
|
|
||||||
gem 'meta-tags', require: 'meta_tags'
|
|
||||||
gem 'friendly_id'
|
|
||||||
gem 'bourbon'
|
|
||||||
gem 'neat'
|
|
||||||
gem 'turbolinks'
|
|
30
ruby21.md
30
ruby21.md
|
@ -1,25 +1,37 @@
|
||||||
---
|
---
|
||||||
title: Ruby 2.1
|
title: Ruby 2.1
|
||||||
category: Ruby
|
category: Ruby
|
||||||
|
layout: 2017/sheet
|
||||||
|
tags: [Archived]
|
||||||
|
intro: |
|
||||||
|
Quick reference to the [new features in Ruby 2.1](https://www.ruby-lang.org/).
|
||||||
---
|
---
|
||||||
|
|
||||||
### Named arguments with defaults
|
### Named arguments with defaults
|
||||||
|
|
||||||
# length is required
|
```ruby
|
||||||
def pad(num, length:, char: "0")
|
# length is required
|
||||||
|
def pad(num, length:, char: "0")
|
||||||
num.to_s.rjust(length, char)
|
num.to_s.rjust(length, char)
|
||||||
end
|
end
|
||||||
|
```
|
||||||
|
|
||||||
pad(42, length: 6) #=> "000042"
|
```ruby
|
||||||
pad(42) #=> #<ArgumentError: missing keyword: length>
|
pad(42, length: 6) #=> "000042"
|
||||||
|
pad(42) #=> #<ArgumentError: missing keyword: length>
|
||||||
|
```
|
||||||
|
|
||||||
### Module.prepend
|
### Module.prepend
|
||||||
|
|
||||||
prepend(Module.new do
|
```ruby
|
||||||
|
prepend(
|
||||||
|
Module.new do
|
||||||
define_method ...
|
define_method ...
|
||||||
end)
|
end
|
||||||
|
)
|
||||||
|
```
|
||||||
|
|
||||||
### References
|
### References
|
||||||
|
|
||||||
* http://globaldev.co.uk/2013/03/ruby-2-0-0-in-detail
|
- http://globaldev.co.uk/2013/03/ruby-2-0-0-in-detail
|
||||||
* http://globaldev.co.uk/2014/05/ruby-2-1-in-detail
|
- http://globaldev.co.uk/2014/05/ruby-2-1-in-detail
|
||||||
|
|
43
rubygems.md
43
rubygems.md
|
@ -1,21 +1,40 @@
|
||||||
---
|
---
|
||||||
title: Rubygems
|
title: Rubygems
|
||||||
category: Ruby
|
category: Ruby
|
||||||
|
layout: 2017/sheet
|
||||||
|
intro: |
|
||||||
|
A quick reference to common [rubygems](https://rubygems.org) CLI commands.
|
||||||
---
|
---
|
||||||
|
|
||||||
gem build *.gemspec # Build a gem
|
### Building and publishing
|
||||||
gem install *.gem # Install locally
|
|
||||||
gem push *.gem # Upload to rubygems.org
|
|
||||||
gem yank foogem -v 0.0.1 # Take it back
|
|
||||||
|
|
||||||
gem owner foogem -a rico@ricostacruz.com
|
```sh
|
||||||
|
gem build *.gemspec # Build a gem
|
||||||
|
gem install *.gem # Install locally
|
||||||
|
gem push *.gem # Upload to rubygems.org
|
||||||
|
gem yank foogem -v 0.0.1 # Take it back
|
||||||
|
```
|
||||||
|
|
||||||
gem list # List local gems
|
### Querying
|
||||||
gem which rake # Point to where lib/rake.rb is
|
|
||||||
gem search -r rails # [remote] Search for gems
|
|
||||||
|
|
||||||
# https://github.com/fnando/gem-open
|
```sh
|
||||||
gem open foogem
|
gem owner foogem -a rico@ricostacruz.com
|
||||||
GEM_EDITOR="vim" gem open foogem
|
|
||||||
|
|
||||||
cd $(basename `gem which rake`) # Go to a gem's path
|
gem list # List local gems
|
||||||
|
gem which rake # Point to where lib/rake.rb is
|
||||||
|
gem search -r rails # [remote] Search for gems
|
||||||
|
```
|
||||||
|
|
||||||
|
### Opening a gem
|
||||||
|
|
||||||
|
```sh
|
||||||
|
# https://github.com/fnando/gem-open
|
||||||
|
gem open foogem
|
||||||
|
GEM_EDITOR="vim" gem open foogem
|
||||||
|
```
|
||||||
|
|
||||||
|
### Changing to a directory
|
||||||
|
|
||||||
|
```sh
|
||||||
|
cd $(basename `gem which rake`) # Go to a gem's path
|
||||||
|
```
|
||||||
|
|
25
siege.md
25
siege.md
|
@ -1,11 +1,20 @@
|
||||||
---
|
---
|
||||||
title: Siege
|
title: Siege
|
||||||
category: Others
|
category: Others
|
||||||
|
layout: 2017/sheet
|
||||||
|
intro: |
|
||||||
|
[Siege](https://www.joedog.org/siege-home/) is an HTTP and HTTPS load testing tool.
|
||||||
---
|
---
|
||||||
|
|
||||||
|
### Basic usage
|
||||||
|
|
||||||
|
```sh
|
||||||
|
siege -b -c=10 -t=5m "http://..."
|
||||||
```
|
```
|
||||||
siege -b -c=10 -t=5m http://...
|
|
||||||
```
|
### Options
|
||||||
|
|
||||||
|
#### Repetitions
|
||||||
|
|
||||||
```
|
```
|
||||||
-c, --concurrent=N
|
-c, --concurrent=N
|
||||||
|
@ -13,24 +22,28 @@ siege -b -c=10 -t=5m http://...
|
||||||
-r, --reps=N
|
-r, --reps=N
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### Modes
|
||||||
|
|
||||||
```
|
```
|
||||||
-i, --internet Hit URLs randomly
|
-i, --internet Hit URLs randomly
|
||||||
-b, --benchmark No delay between requests
|
-b, --benchmark No delay between requests
|
||||||
```
|
```
|
||||||
|
|
||||||
### Configuration
|
#### Configuration
|
||||||
|
|
||||||
```
|
```
|
||||||
-f, --file=FILE load urls.txt
|
-f, --file=FILE load urls.txt
|
||||||
-R, --rc=FILE load siegerc
|
-R, --rc=FILE load siegerc
|
||||||
```
|
```
|
||||||
|
|
||||||
> Also see: [siegerc](https://gist.github.com/stansmet/3067988)
|
#### Headers
|
||||||
|
|
||||||
### Headers
|
|
||||||
|
|
||||||
```
|
```
|
||||||
-H, --header="Cookie: foo=bar"
|
-H, --header="Cookie: foo=bar"
|
||||||
-A, --user-agent="Mozilla"
|
-A, --user-agent="Mozilla"
|
||||||
-T, --content-type="text/html"
|
-T, --content-type="text/html"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### References
|
||||||
|
|
||||||
|
Also see: [siegerc](https://gist.github.com/stansmet/3067988)
|
||||||
|
|
|
@ -1,7 +1,11 @@
|
||||||
---
|
---
|
||||||
title: SimpleForm
|
title: SimpleForm
|
||||||
|
layout: 2017/sheet
|
||||||
|
tags: [WIP]
|
||||||
---
|
---
|
||||||
|
|
||||||
|
### Inputs
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
<%= f.input :email, required: false, autofocus: true %>
|
<%= f.input :email, required: false, autofocus: true %>
|
||||||
<%= f.input :password, required: false %>
|
<%= f.input :password, required: false %>
|
||||||
|
@ -9,7 +13,8 @@ title: SimpleForm
|
||||||
<%= f.button :submit, "Sign in" %>
|
<%= f.button :submit, "Sign in" %>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Adding a wrapper
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
simple_form_for @x,
|
simple_form_for @x, wrapper: :small
|
||||||
wrapper: :small
|
|
||||||
```
|
```
|
||||||
|
|
|
@ -1,35 +1,54 @@
|
||||||
---
|
---
|
||||||
title: Spreadsheet functions
|
title: Spreadsheet functions
|
||||||
|
tags: [WIP]
|
||||||
|
layout: 2017/sheet
|
||||||
---
|
---
|
||||||
|
|
||||||
### If
|
### If
|
||||||
|
|
||||||
=IF(test, then, else)
|
```
|
||||||
=IF(EQ(A1, "paid"), "true", "false")
|
=IF(test, then, else)
|
||||||
|
=IF(EQ(A1, "paid"), "true", "false")
|
||||||
|
```
|
||||||
|
|
||||||
### Comparators
|
### Comparators
|
||||||
|
|
||||||
=EQ(a,b) NE()
|
```
|
||||||
=GT() GTE() LT() LTE()
|
=EQ(a,b)
|
||||||
|
=NE(a,b)
|
||||||
|
=GT(a,b)
|
||||||
|
=GTE(a,b)
|
||||||
|
=LT(a,b)
|
||||||
|
=LTE(a,b)
|
||||||
|
```
|
||||||
|
|
||||||
### Math
|
### Math
|
||||||
|
|
||||||
=POW(2, 32) # 2^32
|
```
|
||||||
=SIN() ACOS() etc
|
=POW(2, 32) # 2^32
|
||||||
=CEILING(n,sig,mode)
|
=SIN() ACOS() etc
|
||||||
=FLOOR(n,sig,mode)
|
=CEILING(n,sig,mode)
|
||||||
=INT(n)
|
=FLOOR(n,sig,mode)
|
||||||
|
=INT(n)
|
||||||
|
```
|
||||||
|
|
||||||
=SUM(range)
|
```
|
||||||
|
=SUM(range)
|
||||||
|
```
|
||||||
|
|
||||||
=SUMIF(range, criteria, sum_range)
|
```
|
||||||
=SUMIF(A1:A5, ">300", B1:B5) # if A# is >300, use B#
|
=SUMIF(range, criteria, sum_range)
|
||||||
|
=SUMIF(A1:A5, ">300", B1:B5) # if A# is >300, use B#
|
||||||
|
```
|
||||||
|
|
||||||
### Core
|
### Core
|
||||||
|
|
||||||
=TO_DATE(number)
|
```
|
||||||
|
=TO_DATE(number)
|
||||||
|
```
|
||||||
|
|
||||||
### Vlook
|
### Vlook
|
||||||
|
|
||||||
=VLOOKUP(value, range, column_index)
|
```
|
||||||
|
=VLOOKUP(value, range, column_index)
|
||||||
|
```
|
||||||
|
|
|
@ -54,14 +54,18 @@ category: Vim
|
||||||
|
|
||||||
### `:EasyAlign = dr` (delimiter_align right)
|
### `:EasyAlign = dr` (delimiter_align right)
|
||||||
|
|
||||||
apple = 1
|
```
|
||||||
banana += apple
|
apple = 1
|
||||||
cake ||= banana
|
banana += apple
|
||||||
|
cake ||= banana
|
||||||
|
```
|
||||||
|
|
||||||
### `:EasyAlign :` (for json or yaml)
|
### `:EasyAlign :` (for json or yaml)
|
||||||
|
|
||||||
url: jdbc:mysql://localhost/test
|
```
|
||||||
database: test
|
url: jdbc:mysql://localhost/test
|
||||||
|
database: test
|
||||||
|
```
|
||||||
|
|
||||||
### `:EasyAlign *|` (markdown tables)
|
### `:EasyAlign *|` (markdown tables)
|
||||||
|
|
||||||
|
@ -71,8 +75,7 @@ category: Vim
|
||||||
| `2` | on 2nd occurrence (and so on) |
|
| `2` | on 2nd occurrence (and so on) |
|
||||||
```
|
```
|
||||||
|
|
||||||
Interactive mode
|
## Interactive mode
|
||||||
----------------
|
|
||||||
|
|
||||||
| `{Visual}` `⏎` | activate for selection |
|
| `{Visual}` `⏎` | activate for selection |
|
||||||
| `ga` `{motion}` | activate for motion/text object |
|
| `ga` `{motion}` | activate for motion/text object |
|
||||||
|
@ -90,11 +93,10 @@ Then press options (if available), then a delimiter.
|
||||||
|
|
||||||
### Example
|
### Example
|
||||||
|
|
||||||
* `gaip` `<ctrl-l>` `8⏎` `=` - puts 8 spaces before the equal sign
|
- `gaip` `<ctrl-l>` `8⏎` `=` - puts 8 spaces before the equal sign
|
||||||
|
|
||||||
Also see
|
## Also see
|
||||||
--------
|
|
||||||
|
|
||||||
* [vim-easy-align](https://github.com/junegunn/vim-easy-align)
|
- [vim-easy-align](https://github.com/junegunn/vim-easy-align)
|
||||||
* [Examples](https://github.com/junegunn/vim-easy-align#examples)
|
- [Examples](https://github.com/junegunn/vim-easy-align#examples)
|
||||||
* [Alignment options](https://github.com/junegunn/vim-easy-align#alignment-options)
|
- [Alignment options](https://github.com/junegunn/vim-easy-align#alignment-options)
|
||||||
|
|
32
weinre.md
32
weinre.md
|
@ -1,17 +1,35 @@
|
||||||
---
|
---
|
||||||
title: Weinre
|
title: Weinre
|
||||||
category: JavaScript libraries
|
category: JavaScript libraries
|
||||||
|
layout: 2017/sheet
|
||||||
|
tags: [Archived]
|
||||||
|
intro: |
|
||||||
|
[weinre](https://www.npmjs.com/package/weinre) is a remote Web inspector. Note that it has been deprecated since 2016.
|
||||||
---
|
---
|
||||||
|
|
||||||
* [Weinre](http://people.apache.org/~pmuellr/weinre/)
|
### Usage
|
||||||
|
|
||||||
Install:
|
#### Install:
|
||||||
|
|
||||||
$ npm install -g weinre
|
```
|
||||||
|
$ npm install -g weinre
|
||||||
|
```
|
||||||
|
|
||||||
Start the server:
|
#### Start the server:
|
||||||
|
|
||||||
$ weinre --boundHost 0.0.0.0
|
```
|
||||||
$ open http://localhost:8080
|
$ weinre --boundHost 0.0.0.0
|
||||||
|
$ open http://localhost:8080
|
||||||
|
```
|
||||||
|
|
||||||
|
### HTML to inject
|
||||||
|
|
||||||
|
<!--prettier-ignore -->
|
||||||
|
```html
|
||||||
|
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.async=1;js.src='http://'+location.hostname+':8080/target/target-script-min.js#anonymous';fjs.parentNode.insertBefore(js,fjs);}}(document,'script','weinre');</script>
|
||||||
|
```
|
||||||
|
|
||||||
|
### References
|
||||||
|
|
||||||
|
- [Weinre](http://people.apache.org/~pmuellr/weinre/)
|
||||||
|
|
||||||
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.async=1;js.src='http://'+location.hostname+':8080/target/target-script-min.js#anonymous';fjs.parentNode.insertBefore(js,fjs);}}(document,'script','weinre');</script>
|
|
||||||
|
|
|
@ -1170,6 +1170,11 @@
|
||||||
"@parcel/utils" "^1.11.0"
|
"@parcel/utils" "^1.11.0"
|
||||||
physical-cpu-count "^2.0.0"
|
physical-cpu-count "^2.0.0"
|
||||||
|
|
||||||
|
"@rstacruz/prettier-plugin-markdown-code-fences@^1.0.0":
|
||||||
|
version "1.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/@rstacruz/prettier-plugin-markdown-code-fences/-/prettier-plugin-markdown-code-fences-1.0.0.tgz#b432eed2db4726abe2c3efaa75c12322976a8ab6"
|
||||||
|
integrity sha512-p/P6BH6tGoCbgMemimUIXJSwi5enZ/HhLupATlPqJmjal00gociP1lbbUQEs97PWjLsgmY3kKu30yKzMSIs0mA==
|
||||||
|
|
||||||
"@sinonjs/commons@^1.7.0":
|
"@sinonjs/commons@^1.7.0":
|
||||||
version "1.8.0"
|
version "1.8.0"
|
||||||
resolved "https://registry.yarnpkg.com/@sinonjs/commons/-/commons-1.8.0.tgz#c8d68821a854c555bba172f3b06959a0039b236d"
|
resolved "https://registry.yarnpkg.com/@sinonjs/commons/-/commons-1.8.0.tgz#c8d68821a854c555bba172f3b06959a0039b236d"
|
||||||
|
|
46
znc.md
46
znc.md
|
@ -1,32 +1,40 @@
|
||||||
---
|
---
|
||||||
title: ZNC bouncer
|
title: ZNC bouncer
|
||||||
|
layout: 2017/sheet
|
||||||
|
intro: |
|
||||||
|
A quick reference to the [ZNC](https://znc.bg) IRC bouncer's common commands.
|
||||||
---
|
---
|
||||||
|
|
||||||
## Start
|
## Start
|
||||||
|
|
||||||
/msg *status addserver irc.undernet.org [6667]
|
```
|
||||||
/msg *status connect
|
/msg *status addserver irc.undernet.org [6667]
|
||||||
|
/msg *status connect
|
||||||
|
|
||||||
/msg *status loadmod webadmin
|
/msg *status loadmod webadmin
|
||||||
/msg *status loadmod admin
|
/msg *status loadmod admin
|
||||||
/msg *status loadmod away
|
/msg *status loadmod away
|
||||||
/msg *status loadmod awaynick
|
/msg *status loadmod awaynick
|
||||||
/msg *status loadmod clientnotify # Notifies when another client logs
|
/msg *status loadmod clientnotify # Notifies when another client logs
|
||||||
/msg *status loadmod keepnick
|
/msg *status loadmod keepnick
|
||||||
/msg *status loadmod kickrejoin
|
/msg *status loadmod kickrejoin
|
||||||
|
```
|
||||||
|
|
||||||
## Away
|
## Away
|
||||||
|
|
||||||
/msg *status loadmod away
|
```
|
||||||
/msg *away away
|
/msg *status loadmod away
|
||||||
/msg *away back
|
/msg *away away
|
||||||
/msg *away show #=> Show messages
|
/msg *away back
|
||||||
/msg *away delete all
|
/msg *away show #=> Show messages
|
||||||
|
/msg *away delete all
|
||||||
|
```
|
||||||
|
|
||||||
## Watch
|
## Watch
|
||||||
|
|
||||||
/msg *status loadmod watch
|
```
|
||||||
/msg *watch list
|
/msg *status loadmod watch
|
||||||
/msg *watch add * *watch *rico*
|
/msg *watch list
|
||||||
/msg *watch add * *watch *%nick%*
|
/msg *watch add * *watch *rico*
|
||||||
|
/msg *watch add * *watch *%nick%*
|
||||||
|
```
|
||||||
|
|
Loading…
Reference in New Issue