OSDN Git Service

Regular updates
authorErik <erikgronwal@users.osdn.me>
Mon, 3 Aug 2020 14:55:05 +0000 (23:55 +0900)
committerErik <erikgronwal@users.osdn.me>
Mon, 3 Aug 2020 14:55:05 +0000 (23:55 +0900)
_includes/common/moment_format.md
bash.md
composer.md
docker.md
flow.md
go.md
jsdoc.md
markdown.md
slim.md
tig.md
xpath.md

index 67054cc..1c8f1ad 100644 (file)
@@ -5,18 +5,17 @@
 
 #### Date
 
-| Example              | Output                             |
-| ---                  | ---                                |
-| `YYYY-MM-DD`         | `2014-01-01`                       |
-| `dddd, MMMM Do YYYY` | `Friday, May 16th 2014`            |
-{: .-shortcuts}
+| Example                   | Output                 |
+| ------------------------- | ---------------------- |
+| `YYYY-MM-DD`              | 2014-01-01             |
+| `dddd, MMMM Do YYYY`      | Friday, May 16th 2014  |
+| `dddd [the] Do [of] MMMM` | Friday the 16th of May |
 
 #### Time
 
-| Example              | Output                             |
-| ---                  | ---                                |
-| `hh:mm a`            | `12:30 pm`                         |
-{: .-shortcuts}
+| Example   | Output   |
+| --------- | -------- |
+| `hh:mm a` | 12:30 pm |
 
 Used by [Moment.js](http://momentjs.com/docs/#/displaying/) and [date-fns/format](https://date-fns.org/v1.28.5/docs/format). Similar to Java [SimpleDateFormat](https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html).
 
@@ -86,17 +85,16 @@ Used by [Moment.js](http://momentjs.com/docs/#/displaying/) and [date-fns/format
 
 ### Presets
 
-| Example              | Output                             |
-| ---                  | ---                                |
-| `LT`                 | `8:30 PM`                          |
-| `LTS`                | `8:30:25 PM`                       |
-| ---                  | ---                                |
-| `LL`                 | `August 2 1985`                    |
-| `ll`                 | `Aug 2 1985`                       |
-| ---                  | ---                                |
-| `LLL`                | `August 2 1985 08:30 PM`           |
-| `lll`                | `Aug 2 1985 08:30 PM`              |
-| ---                  | ---                                |
-| `LLLL`               | `Thursday, August 2 1985 08:30 PM` |
-| `llll`               | `Thu, Aug 2 1985 08:30 PM`         |
-{: .-shortcuts}
+| Example | Output                           |
+| ------- | -------------------------------- |
+| `LT`    | 8:30 PM                          |
+| `LTS`   | 8:30:25 PM                       |
+| ---     | ---                              |
+| `LL`    | August 2 1985                    |
+| `ll`    | Aug 2 1985                       |
+| ---     | ---                              |
+| `LLL`   | August 2 1985 08:30 PM           |
+| `lll`   | Aug 2 1985 08:30 PM              |
+| ---     | ---                              |
+| `LLLL`  | Thursday, August 2 1985 08:30 PM |
+| `llll`  | Thu, Aug 2 1985 08:30 PM         |
diff --git a/bash.md b/bash.md
index 73e0b1a..9452dba 100644 (file)
--- a/bash.md
+++ b/bash.md
@@ -623,7 +623,7 @@ $((a + 200))      # Add 200 to $a
 ```
 
 ```bash
-$((RANDOM%=200))  # Random number 0..200
+$(($RANDOM%200))  # Random number 0..199
 ```
 
 ### Subshells
index a838f3f..e82856f 100644 (file)
@@ -55,6 +55,21 @@ This command changes only the `composer.lock` file.
 
 This command changes both the `composer.json` and `composer.lock` files.
 
+### Passing versions
+
+| Command                                         | Description                              |
+| ----------------------------------------------- | ---------------------------------------- |
+| `composer require vendor/pkg "1.3.2"`           | Installs `1.3.2`                         |
+| `composer require vendor/pkg ">=1.3.2"`         | Above or equal `1.3.2`                   |
+| `composer require vendor/pkg "<1.3.2"`          | Below `1.3.2`                            |
+| `composer require vendor/pkg "1.3.*"`           | Latest of `>=1.3.0 <1.4.0`               |
+| `composer require vendor/pkg "~1.3.2"`          | Latest of `>=1.3.2 <1.4.0`               |
+| `composer require vendor/pkg "~1.3"`            | Latest of `>=1.3.0 <2.0.0`               |
+| `composer require vendor/pkg "^1.3.2"`          | Latest of `>=1.3.2 <2.0.0`               |
+| `composer require vendor/pkg "^1.3"`            | Latest of `>=1.3.0 <2.0.0`               |
+| `composer require vendor/pkg "^0.3.2"`          | Latest of `>=0.3.0 <0.4.0` (for pre-1.0) |
+| `composer require vendor/pkg "dev-BRANCH_NAME"` | From the branch `BRANCH_NAME`            |
+
 ### Removing packages
 
 | Command                   | Description                                                 |
index 12800d8..eafad3f 100644 (file)
--- a/docker.md
+++ b/docker.md
@@ -43,7 +43,7 @@ docker create [options] IMAGE
   -i, --interactive          # attach stdin (interactive)
   -t, --tty                  # pseudo-tty
       --name NAME            # name your image
-  -p, --publish 5000:5000    # port map
+  -p, --publish 5000:5000    # port map (host:container)
       --expose 5432          # expose a port to linked containers
   -P, --publish-all          # publish all ports
       --link container:alias # linking
diff --git a/flow.md b/flow.md
index 10bff77..7117391 100644 (file)
--- a/flow.md
+++ b/flow.md
@@ -198,7 +198,7 @@ type Items = {
 ```
 {: data-line="2"}
 
-See: [Dynamic object keys](https://flow.org/docs/objects.html#objects-as-maps)
+See: [Dynamic object keys](https://flow.org/en/docs/types/objects/#toc-objects-as-maps)
 
 ## Advanced features
 
@@ -239,7 +239,7 @@ const countries = {
 type Country = $Keys<typeof countries>
 ```
 
-See: [Enums](https://flow.org/docs/utility-types.html#keyst)
+See: [Enums](https://flow.org/en/docs/types/utilities/#toc-keys)
 
 ### Type aliases
 
@@ -255,7 +255,7 @@ type Generic<T> = {
 }
 ```
 
-See: [Type aliases](https://flow.org/docs/quick-reference.html#type-aliases)
+See: [Type aliases](https://flow.org/en/docs/types/aliases/)
 
 ### Generic classes
 
@@ -268,7 +268,7 @@ class GenericClass<T> {
 var n: GenericClass<number> = new GenericClass(0)
 ```
 
-See: [Generic classes](https://flow.org/docs/quick-reference.html#generics)
+See: [Generic classes](https://flow.org/en/docs/types/generics/#toc-classes-with-generics)
 
 ### Interfaces
 
@@ -284,7 +284,7 @@ class Foo {
 (new Foo: Jsonable)
 ```
 
-See: [Interfaces](https://flow.org/docs/quick-reference.html#interfaces)
+See: [Interfaces](https://flow.org/en/docs/types/interfaces/)
 
 ### Functions
 
@@ -301,7 +301,7 @@ function filter<T> (
 }
 ```
 
-See: [Functions](https://flow.org/docs/functions.html)
+See: [Functions](https://flow.org/en/docs/types/functions/)
 
 ### Imports
 
diff --git a/go.md b/go.md
index 581521d..ed3d480 100644 (file)
--- a/go.md
+++ b/go.md
@@ -184,13 +184,13 @@ See: [If](https://tour.golang.org/flowcontrol/5)
 ### Statements in if
 
 ```go
-if _, err := getResult(); err != nil {
+if _, err := doThing(); err != nil {
   fmt.Println("Uh oh")
 }
 ```
 {: data-line="1"}
 
-A condition in an `if` statement can be preceded with a statement before a `;`.
+A condition in an `if` statement can be preceded with a statement before a `;`. Variables declared by the statement are only in scope until the end of the `if`.
 
 See: [If with a short statement](https://tour.golang.org/flowcontrol/6)
 
@@ -581,6 +581,50 @@ By defining your receiver as a pointer (`*Vertex`), you can do mutations.
 
 See: [Pointer receivers](https://tour.golang.org/methods/4)
 
+## Interfaces
+
+### A basic interface
+
+```go
+type Shape interface {
+  Area() float64
+  Perimeter() float64
+}
+```
+
+### Struct
+
+```go
+type Rectangle struct {
+  Length, Width float64
+}
+```
+
+Struct `Rectangle` implicitly implements interface `Shape` by implementing all of its methods.
+
+### Methods
+
+```go
+func (r Rectangle) Area() float64 {
+  return r.Length * r.Width
+}
+
+func (r Rectangle) Perimeter() float64 {
+  return 2 * (r.Length + r.Width)
+}
+```
+
+The methods defined in `Shape` are implemented in `Rectangle`.
+
+### Interface example
+
+```go
+func main() {
+  var r Shape = Rectangle{Length: 3, Width: 4}
+  fmt.Printf("Type of r: %T, Area: %v, Perimeter: %v.", r, r.Area(), r.Perimeter())
+}
+```
+
 ## References
 
 ### Official resources
index abbd3c0..6171f0c 100644 (file)
--- a/jsdoc.md
+++ b/jsdoc.md
@@ -25,7 +25,7 @@ function foo(n) {
 }
 ```
 
-See: <http://usejsdoc.org/index.html>
+See: <https://jsdoc.app/index.html>
 
 ### Types
 
@@ -40,7 +40,7 @@ See: <http://usejsdoc.org/index.html>
 | `@param {string[]} n`           | Array of strings                      |
 | `@return {Promise<string[]>} n` | Promise fulfilled by array of strings |
 
-See: <http://usejsdoc.org/tags-type.html>
+See: <https://jsdoc.app/tags-type.html>
 
 ### Variables
 
@@ -79,7 +79,7 @@ const FOO = 1
 function play(song) {}
 ```
 
-See: <http://usejsdoc.org/tags-typedef.html>
+See: <https://jsdoc.app/tags-typedef.html>
 
 ### Typedef Shorthand
 
@@ -103,7 +103,7 @@ See: <http://usejsdoc.org/tags-typedef.html>
 function play(song) {}
 ```
 
-See: <http://usejsdoc.org/tags-typedef.html>
+See: <https://jsdoc.app/tags-typedef.html>
 
 ### Importing types
 
@@ -146,4 +146,4 @@ See the full list: <https://jsdoc.app/index.html#block-tags>
  */
 ```
 
-Prefer `alias` over `name`. See: <http://usejsdoc.org/tags-alias.html>
+Prefer `alias` over `name`. See: <https://jsdoc.app/tags-alias.html>
index 588522b..1ba1c88 100644 (file)
@@ -3,7 +3,7 @@ title: Markdown
 category: Markup
 layout: 2017/sheet
 prism_languages: [markdown]
-updated: 2020-06-24
+updated: 2020-07-01
 weight: -1
 ---
 
@@ -16,6 +16,9 @@ weight: -1
 # h1
 ## h2
 ### h3
+#### h4
+##### h5
+###### h6
 ```
 
 ```markdown
@@ -61,6 +64,11 @@ __bold__
 - [x] Checkbox on
 ```
 
+```markdown
+1. Item 1
+2. Item 2
+```
+
 ### Links
 
 ```markdown
diff --git a/slim.md b/slim.md
index 953501e..de185db 100644 (file)
--- a/slim.md
+++ b/slim.md
@@ -105,6 +105,19 @@ div
     it is nice
 ```
 
+### Advanced whitespaces
+
+```jade
+div
+  ' This appends a whitespace
+div
+  |  This hackily prepends a whitespace
+div
+  => 'This appends a whitespace'
+div
+  =< 'This prepends a whitespace'
+```
+
 ### Inline HTML
 
 ```jade
diff --git a/tig.md b/tig.md
index 16130da..a0d42af 100644 (file)
--- a/tig.md
+++ b/tig.md
@@ -21,7 +21,7 @@ $ sudo apt install tig
 ### Invocation
 
 | Command             | Description                                  |
-| ---                 | ---                                          |
+| ------------------- | -------------------------------------------- |
 | `tig`               |                                              |
 | ---                 | ---                                          |
 | `tig status`        | Status                                       |
@@ -31,6 +31,7 @@ $ sudo apt install tig
 | `tig test..master`  | Show difference between two branches         |
 | `tig FILE`          | Show history of file                         |
 | `tig v0.0.3:README` | Show contents of file in a specific revision |
+| `tig -C /repo/path` | Run in dir `/repo/path` (like `git -C`)      |
 
 You can substitute `git log` → `tig`.
 
index afbe5e4..5b75592 100644 (file)
--- a/xpath.md
+++ b/xpath.md
@@ -234,7 +234,7 @@ Order is significant, these two are different.
 ### Nesting predicates
 
 ```
-//section[//h1[@id='hi']]
+//section[.//h1[@id='hi']]
 ```
 
 This returns `<section>` if it has an `<h1>` descendant with `id='hi'`.