Feature new sheets
This commit is contained in:
parent
7121fa106d
commit
4f8c49d162
|
@ -38,5 +38,6 @@ title: React.js
|
||||||
category: React
|
category: React
|
||||||
layout: 2017/sheet # 'default' | '2017/sheet'
|
layout: 2017/sheet # 'default' | '2017/sheet'
|
||||||
ads: false # Add this to disable ads
|
ads: false # Add this to disable ads
|
||||||
|
updated: 201708 # To show in the updated list
|
||||||
---
|
---
|
||||||
```
|
```
|
||||||
|
|
|
@ -69,3 +69,5 @@ category_names:
|
||||||
|
|
||||||
# https://help.github.com/articles/repository-metadata-on-github-pages/
|
# https://help.github.com/articles/repository-metadata-on-github-pages/
|
||||||
repository: rstacruz/cheatsheets
|
repository: rstacruz/cheatsheets
|
||||||
|
|
||||||
|
last_updated: 201708
|
||||||
|
|
|
@ -30,6 +30,16 @@ type: website
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
|
<h2 class='category item' data-js-searchable-header>
|
||||||
|
<span>Recently updated</span>
|
||||||
|
</h2>
|
||||||
|
|
||||||
|
{% for page in site.pages %}
|
||||||
|
{% if page.updated >= site.last_updated %}
|
||||||
|
{% include 2017/pages-list-item.html page=page class='article item' %}
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
{% for category in site.category_names %}
|
{% for category in site.category_names %}
|
||||||
<h2 class='category item' id='{{ category | downcase | replace: " ", "-" }}' data-js-searchable-header>
|
<h2 class='category item' id='{{ category | downcase | replace: " ", "-" }}' data-js-searchable-header>
|
||||||
<span>{{ category }}</span>
|
<span>{{ category }}</span>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
{% assign target = {{ page.redirect.to | remove: '.html' | replace: 'cheatsheets/cheatsheets', 'cheatsheets' %}
|
{% assign target = page.redirect.to | remove: '.html' | replace: 'cheatsheets/cheatsheets', 'cheatsheets' %}
|
||||||
<html lang="en-US">
|
<html lang="en-US">
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title>Redirecting…</title>
|
<title>Redirecting…</title>
|
||||||
|
|
3
bash.md
3
bash.md
|
@ -3,9 +3,6 @@ title: Bash scripting
|
||||||
category: CLI
|
category: CLI
|
||||||
layout: 2017/sheet
|
layout: 2017/sheet
|
||||||
tags: [Featured]
|
tags: [Featured]
|
||||||
redirect_from:
|
|
||||||
- /sh
|
|
||||||
- /sh.html
|
|
||||||
---
|
---
|
||||||
|
|
||||||
Getting started
|
Getting started
|
||||||
|
|
1
cron.md
1
cron.md
|
@ -2,6 +2,7 @@
|
||||||
title: Cron
|
title: Cron
|
||||||
category: CLI
|
category: CLI
|
||||||
layout: 2017/sheet
|
layout: 2017/sheet
|
||||||
|
updated: 201708
|
||||||
---
|
---
|
||||||
|
|
||||||
## Format
|
## Format
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
title: Elixir
|
title: Elixir
|
||||||
category: Elixir
|
category: Elixir
|
||||||
layout: 2017/sheet
|
layout: 2017/sheet
|
||||||
|
tags: [New]
|
||||||
|
updated: 201708
|
||||||
---
|
---
|
||||||
|
|
||||||
## Reference
|
## Reference
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
title: ES2015
|
||||||
|
category: JavaScript
|
||||||
|
redirect_to: /es6
|
||||||
|
---
|
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
title: ES2016
|
||||||
|
category: JavaScript
|
||||||
|
redirect_to: /es6
|
||||||
|
---
|
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
title: ES2017
|
||||||
|
category: JavaScript
|
||||||
|
redirect_to: /es6
|
||||||
|
---
|
4
es6.md
4
es6.md
|
@ -1,8 +1,8 @@
|
||||||
---
|
---
|
||||||
title: ES2015
|
title: ES2015+
|
||||||
category: JavaScript
|
category: JavaScript
|
||||||
layout: 2017/sheet
|
layout: 2017/sheet
|
||||||
ads: true
|
tags: [Featured]
|
||||||
---
|
---
|
||||||
|
|
||||||
### Promises
|
### Promises
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
title: ExUnit
|
title: ExUnit
|
||||||
category: Elixir
|
category: Elixir
|
||||||
layout: 2017/sheet
|
layout: 2017/sheet
|
||||||
|
updated: 201708
|
||||||
---
|
---
|
||||||
|
|
||||||
### Test cases
|
### Test cases
|
||||||
|
|
|
@ -0,0 +1,201 @@
|
||||||
|
---
|
||||||
|
title: Flow
|
||||||
|
layout: 2017/sheet
|
||||||
|
updated: 201708
|
||||||
|
---
|
||||||
|
|
||||||
|
### Simple failing example
|
||||||
|
|
||||||
|
```js
|
||||||
|
/* @flow */
|
||||||
|
|
||||||
|
function foo(x) { return x * 10 }
|
||||||
|
foo('Hello, world!')
|
||||||
|
```
|
||||||
|
|
||||||
|
### Annotations
|
||||||
|
|
||||||
|
```js
|
||||||
|
// Simple
|
||||||
|
function foo(x: string, y: number): string { ... }
|
||||||
|
```
|
||||||
|
|
||||||
|
```js
|
||||||
|
// Arrays
|
||||||
|
function total(numbers: Array<number>) { ... }
|
||||||
|
```
|
||||||
|
|
||||||
|
### Primitives
|
||||||
|
|
||||||
|
| Type | Description |
|
||||||
|
| --- | --- |
|
||||||
|
| `any` | |
|
||||||
|
| `boolean` | |
|
||||||
|
| `mixed` | |
|
||||||
|
| `number` | |
|
||||||
|
| `string` | |
|
||||||
|
| `void` | undefined |
|
||||||
|
| `null` | null (but not undefined) |
|
||||||
|
| --- | --- |
|
||||||
|
| `{a: Number}` | Object with a shape |
|
||||||
|
| `[any, number]` | Tuples (fixed-length arrays) |
|
||||||
|
| --- | --- |
|
||||||
|
| `Array<T>` | |
|
||||||
|
| `Class<T>` | |
|
||||||
|
| `Function` | |
|
||||||
|
| `Object` | |
|
||||||
|
| --- | --- |
|
||||||
|
| `?number` | Maybe (number, void, null) |
|
||||||
|
| `a | b` | Union types |
|
||||||
|
|
||||||
|
### Dynamic keys
|
||||||
|
|
||||||
|
```js
|
||||||
|
type Items = {
|
||||||
|
[key: string]: Item
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
See: [Dynamic object keys](https://flow.org/docs/objects.html#objects-as-maps)
|
||||||
|
|
||||||
|
### Enums
|
||||||
|
|
||||||
|
```js
|
||||||
|
type Suit = "Diamonds" | "Clubs" | "Hearts" | "Spades"
|
||||||
|
|
||||||
|
const countries = {
|
||||||
|
US: "United States",
|
||||||
|
IT: "Italy",
|
||||||
|
FR: "France"
|
||||||
|
}
|
||||||
|
|
||||||
|
type Country = $Keys<typeof countries>
|
||||||
|
```
|
||||||
|
|
||||||
|
See: [Enums](https://flow.org/docs/utility-types.html#keyst)
|
||||||
|
|
||||||
|
### Type aliases
|
||||||
|
|
||||||
|
```js
|
||||||
|
type Tree = {
|
||||||
|
foo: string,
|
||||||
|
bar: number,
|
||||||
|
qux: (foo: string, bar: number) => boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
type Generic<T> = {
|
||||||
|
foo: T
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
See: [Type aliases](https://flow.org/docs/quick-reference.html#type-aliases)
|
||||||
|
|
||||||
|
### Generic classes
|
||||||
|
|
||||||
|
```js
|
||||||
|
class GenericClass<T> {
|
||||||
|
x: T
|
||||||
|
constructor (x: T) { ... }
|
||||||
|
}
|
||||||
|
|
||||||
|
var n: GenericClass<number> = new GenericClass(0)
|
||||||
|
```
|
||||||
|
|
||||||
|
See: [Generic classes](https://flow.org/docs/quick-reference.html#generics)
|
||||||
|
|
||||||
|
### Interfaces
|
||||||
|
|
||||||
|
```js
|
||||||
|
interface Jsonable {
|
||||||
|
toJSON(): string
|
||||||
|
}
|
||||||
|
|
||||||
|
class Foo {
|
||||||
|
toJSON() { return '{}' }
|
||||||
|
}
|
||||||
|
|
||||||
|
(new Foo: Jsonable)
|
||||||
|
```
|
||||||
|
|
||||||
|
See: [Interfaces](https://flow.org/docs/quick-reference.html#interfaces)
|
||||||
|
|
||||||
|
### Functions
|
||||||
|
|
||||||
|
```js
|
||||||
|
const callback: () => void = function () {}
|
||||||
|
```
|
||||||
|
|
||||||
|
```js
|
||||||
|
function filter<T> (
|
||||||
|
list: Array<T>,
|
||||||
|
callback: (item: T) => boolean
|
||||||
|
): Array<T> {
|
||||||
|
···
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
See: [Functions](https://flow.org/docs/functions.html)
|
||||||
|
|
||||||
|
### Imports
|
||||||
|
|
||||||
|
```js
|
||||||
|
import type { Person } from '../person'
|
||||||
|
import typeof Config from '../config'
|
||||||
|
```
|
||||||
|
|
||||||
|
```js
|
||||||
|
export type Person = { id: string }
|
||||||
|
```
|
||||||
|
|
||||||
|
### Comment syntax
|
||||||
|
|
||||||
|
```js
|
||||||
|
/*::
|
||||||
|
export type Foo = { ... }
|
||||||
|
*/
|
||||||
|
|
||||||
|
function add(n /*: number */) { ... }
|
||||||
|
```
|
||||||
|
|
||||||
|
### React
|
||||||
|
|
||||||
|
```js
|
||||||
|
React$Element<any>
|
||||||
|
```
|
||||||
|
|
||||||
|
```js
|
||||||
|
class Foo extends React.Component {
|
||||||
|
/*:: state: { open: boolean } */
|
||||||
|
/*:: props: { open: boolean } */
|
||||||
|
}
|
||||||
|
```
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
### Examples
|
||||||
|
|
||||||
|
```js
|
||||||
|
var myNumbers: Array<number> = [42]
|
||||||
|
function foo(): any { return 42 }
|
||||||
|
var b: boolean = false
|
||||||
|
var b: ?boolean = false /* maybe */
|
||||||
|
var b: string | boolean = false
|
||||||
|
|
||||||
|
var a: Class<MyClass> = MyClass
|
||||||
|
var b: MyClass = new a()
|
||||||
|
```
|
||||||
|
|
||||||
|
### Function signature
|
||||||
|
|
||||||
|
```js
|
||||||
|
var add: ((num1: number, num2: number) => number) = function (num1, num2) {
|
||||||
|
return num1 + num2
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
You don't need to do this! It's inferred. This is better:
|
||||||
|
|
||||||
|
```js
|
||||||
|
var add = function (num1: number, num2: number) {
|
||||||
|
return num1 + num2
|
||||||
|
}
|
||||||
|
```
|
168
flowtype.md
168
flowtype.md
|
@ -1,168 +0,0 @@
|
||||||
---
|
|
||||||
title: Flow
|
|
||||||
---
|
|
||||||
|
|
||||||
### Simple failing example
|
|
||||||
|
|
||||||
```js
|
|
||||||
/* @flow */
|
|
||||||
|
|
||||||
function foo(x) { return x * 10; }
|
|
||||||
foo('Hello, world!');
|
|
||||||
```
|
|
||||||
|
|
||||||
### Annotations
|
|
||||||
|
|
||||||
```js
|
|
||||||
// Simple
|
|
||||||
function foo(x: string, y: number): string { ... }
|
|
||||||
|
|
||||||
// Arrays
|
|
||||||
function total(numbers: Array<number>) { ... }
|
|
||||||
```
|
|
||||||
|
|
||||||
### Primitives
|
|
||||||
|
|
||||||
```
|
|
||||||
any
|
|
||||||
boolean
|
|
||||||
mixed
|
|
||||||
number
|
|
||||||
string
|
|
||||||
void // undefined
|
|
||||||
null // null (but not undefined)
|
|
||||||
|
|
||||||
?number // maybe (number | void | null)
|
|
||||||
|
|
||||||
{a: Number} // object with a shape
|
|
||||||
[any, number] // tuples (fixed-length arrays)
|
|
||||||
|
|
||||||
Array<T>
|
|
||||||
Class<T>
|
|
||||||
Function
|
|
||||||
Object
|
|
||||||
```
|
|
||||||
|
|
||||||
## [Dynamic object keys](https://flowtype.org/docs/objects.html#objects-as-maps)
|
|
||||||
|
|
||||||
```js
|
|
||||||
type Items = {
|
|
||||||
[key: string]: Item
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## [Enums](https://flowtype.org/docs/utility-types.html#keyst)
|
|
||||||
|
|
||||||
```js
|
|
||||||
type Suit = "Diamonds" | "Clubs" | "Hearts" | "Spades"
|
|
||||||
|
|
||||||
const countries = {
|
|
||||||
US: "United States",
|
|
||||||
IT: "Italy",
|
|
||||||
FR: "France"
|
|
||||||
}
|
|
||||||
|
|
||||||
type Country = $Keys<typeof countries>
|
|
||||||
```
|
|
||||||
|
|
||||||
## [Type aliases](https://flowtype.org/docs/quick-reference.html#type-aliases)
|
|
||||||
|
|
||||||
```js
|
|
||||||
type Tree = {
|
|
||||||
foo: string,
|
|
||||||
bar: number,
|
|
||||||
qux: (foo: string, bar: number) => boolean
|
|
||||||
}
|
|
||||||
|
|
||||||
type Generic<T> = {
|
|
||||||
foo: T
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## [Generic classes](https://flowtype.org/docs/quick-reference.html#generics)
|
|
||||||
|
|
||||||
```js
|
|
||||||
class GenericClass<T> {
|
|
||||||
x: T;
|
|
||||||
constructor (x: T) { ... }
|
|
||||||
}
|
|
||||||
|
|
||||||
var n: GenericClass<number> = new GenericClass(0)
|
|
||||||
```
|
|
||||||
|
|
||||||
## [Interfaces](https://flowtype.org/docs/quick-reference.html#interfaces)
|
|
||||||
|
|
||||||
```js
|
|
||||||
interface Jsonable {
|
|
||||||
toJSON(): string
|
|
||||||
}
|
|
||||||
|
|
||||||
class Foo {
|
|
||||||
toJSON() { return '{}' }
|
|
||||||
}
|
|
||||||
|
|
||||||
(new Foo: Jsonable)
|
|
||||||
```
|
|
||||||
|
|
||||||
## [Functions](https://flowtype.org/docs/functions.html)
|
|
||||||
|
|
||||||
```js
|
|
||||||
const callback: () => void = function () {}
|
|
||||||
```
|
|
||||||
|
|
||||||
```js
|
|
||||||
function filter<T> (list: Array<T>, callback: (item: T) => boolean): Array<T> {
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## Imports
|
|
||||||
|
|
||||||
```js
|
|
||||||
import type { Person } from '../person'
|
|
||||||
import typeof Config from '../config'
|
|
||||||
```
|
|
||||||
|
|
||||||
```js
|
|
||||||
export type Person = { id: string }
|
|
||||||
```
|
|
||||||
|
|
||||||
## Examples
|
|
||||||
|
|
||||||
```js
|
|
||||||
var myNumbers: Array<number> = [42]
|
|
||||||
function foo(): any { return 42 }
|
|
||||||
var b: boolean = false
|
|
||||||
var b: ?boolean = false /* maybe */
|
|
||||||
var b: string | boolean = false /* maybe */
|
|
||||||
|
|
||||||
var a: Class<MyClass> = MyClass
|
|
||||||
var b: MyClass = new a()
|
|
||||||
|
|
||||||
// Function signature
|
|
||||||
var add: ((num1: number, num2: number) => number) = function(num1, num2) {
|
|
||||||
return num1 + num2;
|
|
||||||
};
|
|
||||||
```
|
|
||||||
|
|
||||||
## Comment syntax
|
|
||||||
|
|
||||||
```js
|
|
||||||
/*::
|
|
||||||
export type Foo = { ... }
|
|
||||||
*/
|
|
||||||
|
|
||||||
function add(n /*: number */) { ... }
|
|
||||||
```
|
|
||||||
|
|
||||||
## React
|
|
||||||
|
|
||||||
```js
|
|
||||||
React$Element<any>
|
|
||||||
```
|
|
||||||
|
|
||||||
```js
|
|
||||||
class Foo extends React.Component {
|
|
||||||
/*:: state: { open: boolean } */
|
|
||||||
/*:: props: { open: boolean } */
|
|
||||||
}
|
|
||||||
```
|
|
|
@ -1,7 +1,6 @@
|
||||||
---
|
---
|
||||||
title: Homebrew
|
title: Homebrew
|
||||||
layout: 2017/sheet
|
layout: 2017/sheet
|
||||||
tags: [Featured]
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### Commands
|
### Commands
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
---
|
---
|
||||||
title: Meta tags
|
title: HTML meta tags
|
||||||
category: HTML
|
category: HTML
|
||||||
layout: 2017/sheet
|
layout: 2017/sheet
|
||||||
|
updated: 201708
|
||||||
---
|
---
|
||||||
|
|
||||||
### Meta tags
|
### Meta tags
|
||||||
|
|
Loading…
Reference in New Issue