functiongetAttr(obj){ var a=[]; for(a[a.length] in obj); return a; } console.log(getAttr({'name':'zhangsan','age':'20'}));//输出:['name','age']
乍一看可能比较蒙,不过仔细分析还是不难理解的。常见用法是`for(var key in obj)`,这里`key`初始也是`undefined`的,`a[a.length]`整体也是`undefined`,所以二者其实是等价的。 在`for`循环中,`obj`的属性会依次赋值给`key`,同样,也依次赋值给`a[a.length]`,这里`length`一直在变,就巧妙地挨个赋值给数组的每一个元素了。
functiongetAttr(obj){ var a=[]; for(a[a.length] in obj); return a; } console.log(getAttr({'name':'zhangsan','age':'20'}));//输出:['name','age']
乍一看可能比较蒙,不过仔细分析还是不难理解的。常见用法是`for(var key in obj)`,这里`key`初始也是`undefined`的,`a[a.length]`整体也是`undefined`,所以二者其实是等价的。 在`for`循环中,`obj`的属性会依次赋值给`key`,同样,也依次赋值给`a[a.length]`,这里`length`一直在变,就巧妙地挨个赋值给数组的每一个元素了。
Enter passphrase (empty for no passphrase): [Typea passphrase] Enter same passphrase again: [Typepassphrase again]
然后你就会得到你的 SSH Key 的指纹,看起来像下面的代码:
1 2 3 4
Your identification has been saved in /Users/you/.ssh/id_rsa. Your public key has been saved in /Users/you/.ssh/id_rsa.pub. The key fingerprint is: 01:0f:f4:3b:ca:85:d6:17:a1:7d:f0:68:9d:f0:a2:db your_email@example.com
$ ssh -T git@GitHub.com # Attempts to ssh to GitHub
会得到如下的指纹提示:键入yes
1 2 3
The authenticity of host 'GitHub.com (207.97.227.239)' can't be established. RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48. Are you sure you want to continue connecting (yes/no)?
如果出现下面的提示,恭喜你,验证成功。
1
Hi username! You've successfully authenticated, but GitHub does not provide shell access.
Enter passphrase (empty for no passphrase): [Typea passphrase] Enter same passphrase again: [Typepassphrase again]
然后你就会得到你的 SSH Key 的指纹,看起来像下面的代码:
1 2 3 4
Your identification has been saved in /Users/you/.ssh/id_rsa. Your public key has been saved in /Users/you/.ssh/id_rsa.pub. The key fingerprint is: 01:0f:f4:3b:ca:85:d6:17:a1:7d:f0:68:9d:f0:a2:db your_email@example.com
$ ssh -T git@GitHub.com # Attempts to ssh to GitHub
会得到如下的指纹提示:键入yes
1 2 3
The authenticity of host 'GitHub.com (207.97.227.239)' can't be established. RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48. Are you sure you want to continue connecting (yes/no)?
如果出现下面的提示,恭喜你,验证成功。
1
Hi username! You've successfully authenticated, but GitHub does not provide shell access.
\ No newline at end of file
diff --git a/2015/hexo-your-blog/index.html b/2015/hexo-your-blog/index.html
index cff8b421..c912e977 100644
--- a/2015/hexo-your-blog/index.html
+++ b/2015/hexo-your-blog/index.html
@@ -1 +1 @@
-Hello World for Hexo | 云淡风轻
// bad var errorMessage = 'Thisis a super long error that was thrown because of Batman. When you stop to think about how Batman had anything to do with this, you would get nowhere fast.';
// bad var errorMessage = 'Thisis a super long error that \ was thrown because of Batman. \ When you stop to think about \ how Batman had anything to do \ with this, you would get nowhere \ fast.';
// good var errorMessage = 'Thisis a super long error that ' + 'was thrown because of Batman.' + 'When you stop to think about ' + 'how Batman had anything to do ' + 'with this, you would get nowhere ' + 'fast.';
messages = [{ state: 'success', message: 'This one worked.' },{ state: 'success', message: 'This one worked as well.' },{ state: 'error', message: 'This one did not work.' }];
length = messages.length;
// bad functioninbox(messages) { items = '<ul>'; for (i = 0; i < length; i++) { items += '<li>' + messages[i].message + '</li>'; } return items + '</ul>'; }
// good functioninbox(messages) { items = []; for (i = 0; i < length; i++) { items[i] = messages[i].message; } return'<ul><li>' + items.join('</li><li>') + '</li></ul>'; }
函数
函数表达式:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
// 匿名函数表达式 var anonymous = function() { returntrue; };
// 有名函数表达式 var named = functionnamed() { returntrue; };
// 立即调用函数表达式 (function() { console.log('Welcome to the Internet. Please follow me.'); })();
// bad // make() returns a new element // based on the passed in tag name // // @param <String> tag // @return <Element> element functionmake(tag) {
// ...stuff...
returnelement; }
// good /** * make() returns a new element * based on the passed in tag name * * @param <String> tag * @return <Element> element */ functionmake(tag) {
// good /** * parseInt was the reason my code was slow. * Bitshifting the String to coerce it to a * Number made it a lot faster. */ varval = inputValue >> 0;
布尔值:
1 2 3 4 5 6 7 8 9 10
var age = 0;
// bad var hasAge = newBoolean(age);
// good var hasAge = Boolean(age);
// good var hasAge = !!age;
命名约定
避免单个字符名,让你的变量名有描述意义。
1 2 3 4 5 6 7 8 9
// bad functionq() { // ...stuff... }
// good functionquery() { // ..stuff.. }
当命名对象、函数和实例时使用驼峰命名规则
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
// bad var OBJEcttsssss = {}; var this_is_my_object = {}; varthis-is-my-object = {}; function c() {}; var u = new user({ name: 'Bob Parr' });
// good var thisIsMyObject = {}; function thisIsMyFunction() {}; var user = new User({ name: 'Bob Parr' });
当命名构造函数或类时使用驼峰式大写
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
// bad functionuser(options) { this.name = options.name; }
var bad = newuser({ name: 'nope' });
// good functionUser(options) { this.name = options.name; }
var good = newUser({ name: 'yup' });
命名私有属性时前面加个下划线 _
1 2 3 4 5 6
// bad this.__firstName__ = 'Panda'; this.firstName_ = 'Panda';
// good this._firstName = 'Panda';
当保存对 this 的引用时使用 self(python 风格),避免this issue . Angular建议使用vm(MVVM模式中view-model)
1 2 3 4 5 6 7
// good function() { var self = this; returnfunction() { console.log(self); }; }
// bad var errorMessage = 'Thisis a super long error that was thrown because of Batman. When you stop to think about how Batman had anything to do with this, you would get nowhere fast.';
// bad var errorMessage = 'Thisis a super long error that \ was thrown because of Batman. \ When you stop to think about \ how Batman had anything to do \ with this, you would get nowhere \ fast.';
// good var errorMessage = 'Thisis a super long error that ' + 'was thrown because of Batman.' + 'When you stop to think about ' + 'how Batman had anything to do ' + 'with this, you would get nowhere ' + 'fast.';
messages = [{ state: 'success', message: 'This one worked.' },{ state: 'success', message: 'This one worked as well.' },{ state: 'error', message: 'This one did not work.' }];
length = messages.length;
// bad functioninbox(messages) { items = '<ul>'; for (i = 0; i < length; i++) { items += '<li>' + messages[i].message + '</li>'; } return items + '</ul>'; }
// good functioninbox(messages) { items = []; for (i = 0; i < length; i++) { items[i] = messages[i].message; } return'<ul><li>' + items.join('</li><li>') + '</li></ul>'; }
函数
函数表达式:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
// 匿名函数表达式 var anonymous = function() { returntrue; };
// 有名函数表达式 var named = functionnamed() { returntrue; };
// 立即调用函数表达式 (function() { console.log('Welcome to the Internet. Please follow me.'); })();
// bad // make() returns a new element // based on the passed in tag name // // @param <String> tag // @return <Element> element functionmake(tag) {
// ...stuff...
returnelement; }
// good /** * make() returns a new element * based on the passed in tag name * * @param <String> tag * @return <Element> element */ functionmake(tag) {
// good /** * parseInt was the reason my code was slow. * Bitshifting the String to coerce it to a * Number made it a lot faster. */ varval = inputValue >> 0;
布尔值:
1 2 3 4 5 6 7 8 9 10
var age = 0;
// bad var hasAge = newBoolean(age);
// good var hasAge = Boolean(age);
// good var hasAge = !!age;
命名约定
避免单个字符名,让你的变量名有描述意义。
1 2 3 4 5 6 7 8 9
// bad functionq() { // ...stuff... }
// good functionquery() { // ..stuff.. }
当命名对象、函数和实例时使用驼峰命名规则
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
// bad var OBJEcttsssss = {}; var this_is_my_object = {}; varthis-is-my-object = {}; function c() {}; var u = new user({ name: 'Bob Parr' });
// good var thisIsMyObject = {}; function thisIsMyFunction() {}; var user = new User({ name: 'Bob Parr' });
当命名构造函数或类时使用驼峰式大写
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
// bad functionuser(options) { this.name = options.name; }
var bad = newuser({ name: 'nope' });
// good functionUser(options) { this.name = options.name; }
var good = newUser({ name: 'yup' });
命名私有属性时前面加个下划线 _
1 2 3 4 5 6
// bad this.__firstName__ = 'Panda'; this.firstName_ = 'Panda';
// good this._firstName = 'Panda';
当保存对 this 的引用时使用 self(python 风格),避免this issue . Angular建议使用vm(MVVM模式中view-model)
1 2 3 4 5 6 7
// good function() { var self = this; returnfunction() { console.log(self); }; }
A markdown example shows how to write a markdown file. This document integrates core syntax and extensions (GMF).
Block Elements
Paragraphs and Line Breaks
Paragraphs
HTML Tag: <p>
One or more blank lines. (A blank line is a line containing nothing but spaces or tabs is considered blank.)
Code:
1 2 3 4
This will be inline.
This is second paragraph.
Preview:
This will be inline.
This is second paragraph.
Line Breaks
HTML Tag: <br />
End a line with two or more spaces.
Code:
1 2
This will be not inline.
Preview:
This will be not inline.
Headers
Markdown supports two styles of headers, Setext and atx.
Setext
HTML Tags: <h1>, <h2>
“Underlined” using equal signs (=) as <h1> and dashes (-) as <h2> in any number.
Code:
1 2 3 4
This is an H1 ============= This is an H2 -------------
Preview: *** This is an H1
This is an H2
atx
HTML Tags: <h1>, <h2>, <h3>, <h4>, <h5>, <h6>
Uses 1-6 hash characters (#) at the start of the line, corresponding to <h1> - <h6>.
Code:
1 2 3
# This is an H1 ## This is an H2 ###### This is an H6
Preview:
This is an H1
This is an H2
This is an H6
Optionally, you may “close” atx-style headers. The closing hashes don’t need to match the number of hashes used to open the header.
Code:
1 2 3
# This is an H1 # ## This is an H2 ## ### This is an H3 ######
Preview:
This is an H1
This is an H2
This is an H3
Blockquotes
HTML Tag: <blockquote>
Markdown uses email-style > characters for blockquoting. It looks best if you hard wrap the text and put a > before every line.
Code:
1 2 3 4 5 6
>This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet, >consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. >Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus. > >Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse >id sem consectetuer libero luctus adipiscing.
Preview:
This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing.
Markdown allows you to be lazy and only put the > before the first line of a hard-wrapped paragraph.
Code:
1 2 3 4 5 6
>This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
>Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing.
Preview:
This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing.
Blockquotes can be nested (i.e. a blockquote-in-a-blockquote) by adding additional levels of >.
Code:
1 2 3 4 5
>This is the first level of quoting. > >> This is nested blockquote. > >Back to the first level.
Preview:
This is the first level of quoting.
This is nested blockquote.
Back to the first level.
Blockquotes can contain other Markdown elements, including headers, lists, and code blocks.
Code:
1 2 3 4 5 6 7 8
>## This is a header. > >1.This is the first list item. >2.This is the second list item. > >Here's some example code: > > return shell_exec("echo $input | $markdown_script");
A markdown example shows how to write a markdown file. This document integrates core syntax and extensions (GMF).
Block Elements
Paragraphs and Line Breaks
Paragraphs
HTML Tag: <p>
One or more blank lines. (A blank line is a line containing nothing but spaces or tabs is considered blank.)
Code:
1 2 3 4
This will be inline.
This is second paragraph.
Preview:
This will be inline.
This is second paragraph.
Line Breaks
HTML Tag: <br />
End a line with two or more spaces.
Code:
1 2
This will be not inline.
Preview:
This will be not inline.
Headers
Markdown supports two styles of headers, Setext and atx.
Setext
HTML Tags: <h1>, <h2>
“Underlined” using equal signs (=) as <h1> and dashes (-) as <h2> in any number.
Code:
1 2 3 4
This is an H1 ============= This is an H2 -------------
Preview: *** This is an H1
This is an H2
atx
HTML Tags: <h1>, <h2>, <h3>, <h4>, <h5>, <h6>
Uses 1-6 hash characters (#) at the start of the line, corresponding to <h1> - <h6>.
Code:
1 2 3
# This is an H1 ## This is an H2 ###### This is an H6
Preview:
This is an H1
This is an H2
This is an H6
Optionally, you may “close” atx-style headers. The closing hashes don’t need to match the number of hashes used to open the header.
Code:
1 2 3
# This is an H1 # ## This is an H2 ## ### This is an H3 ######
Preview:
This is an H1
This is an H2
This is an H3
Blockquotes
HTML Tag: <blockquote>
Markdown uses email-style > characters for blockquoting. It looks best if you hard wrap the text and put a > before every line.
Code:
1 2 3 4 5 6
>This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet, >consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. >Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus. > >Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse >id sem consectetuer libero luctus adipiscing.
Preview:
This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing.
Markdown allows you to be lazy and only put the > before the first line of a hard-wrapped paragraph.
Code:
1 2 3 4 5 6
>This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
>Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing.
Preview:
This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing.
Blockquotes can be nested (i.e. a blockquote-in-a-blockquote) by adding additional levels of >.
Code:
1 2 3 4 5
>This is the first level of quoting. > >> This is nested blockquote. > >Back to the first level.
Preview:
This is the first level of quoting.
This is nested blockquote.
Back to the first level.
Blockquotes can contain other Markdown elements, including headers, lists, and code blocks.
Code:
1 2 3 4 5 6 7 8
>## This is a header. > >1.This is the first list item. >2.This is the second list item. > >Here's some example code: > > return shell_exec("echo $input | $markdown_script");
*** Following sections Fenced Code Blocks and Syntax Highlighting are extensions, you can use the other way to write the code block. #### Fenced Code Blocks Just wrap your code in \`\`\` \`\`\` (as shown below) and you won't need to indent it by four spaces.
Code:
Here’s an example: ``` function test() { console.log(“notice the blank line before this function?”); } ```
Preview:
Here’s an example:
1 2 3
functiontest() { console.log("notice the blank line before this function?"); }
Syntax Highlighting
In your fenced block, add an optional language identifier and we’ll run it through syntax highlighting (Support Languages).
HTML Tag: <hr /> Places three or more hyphens (-), asterisks (*), or underscores (_) on a line by themselves. You may use spaces between the hyphens or asterisks.
Square brackets containing the link identifier (not case sensitive, optionally indented from the left margin using up to three spaces);
followed by a colon;
followed by one or more spaces (or tabs);
followed by the URL for the link;
The link URL may, optionally, be surrounded by angle brackets.
optionally followed by a title attribute for the link, enclosed in double or single quotes, or enclosed in parentheses.
The following three link definitions are equivalent:
Code:
1 2 3 4
[foo]: http://example.com/ "Optional Title Here" [foo]: http://example.com/ 'Optional Title Here' [foo]: http://example.com/ (Optional Title Here) [foo]: <http://example.com/> "Optional Title Here"
Uses an empty set of square brackets, the link text itself is used as the name.
Markdown treats asterisks (*) and underscores (_) as indicators of emphasis. One delimiter will be <em>; *double delimiters will be <strong>.
Code:
1 2 3 4 5 6 7
*single asterisks*
_single underscores_
**double asterisks**
__double underscores__
Preview:
single asterisks
single underscores
double asterisks
double underscores
But if you surround an * or _ with spaces, it’ll be treated as a literal asterisk or underscore.
You can backslash escape it:
Code:
1
*this text is surrounded by literal asterisks*
Preview:
*this text is surrounded by literal asterisks*
Code
HTML Tag: <code>
Wraps it with backtick quotes (`).
Code:
1
Use the `printf()` function.
Preview:
Use the printf() function.
To include a literal backtick character within a code span, you can use multiple backticks as the opening and closing delimiters:
Code:
1
``There is a literal backtick (`) here.``
Preview:
There is a literal backtick (`) here.
The backtick delimiters surrounding a code span may include spaces — one after the opening, one before the closing. This allows you to place literal backtick characters at the beginning or end of a code span:
Code:
1 2 3
Asinglebacktickinacodespan: `` ` ``
Abacktick-delimitedstringinacodespan: `` `foo` ``
Preview:
A single backtick in a code span: `
A backtick-delimited string in a code span: `foo`
Images
HTML Tag: <img />
Markdown uses an image syntax that is intended to resemble the syntax for links, allowing for two styles: inline and reference.
Inline
Inline image syntax looks like this: ![Alt text](URL "Title")
Title is optional.
Code:
1 2 3
![Alt text](/path/to/img.jpg)
![Alt text](/path/to/img.jpg "Optional title")
Preview:
That is:
An exclamation mark: !;
followed by a set of square brackets, containing the alt attribute text for the image;
followed by a set of parentheses, containing the URL or path to the image, and an optional title attribute enclosed in double or single quotes.
Reference
Reference-style image syntax looks like this: ![Alt text][id]
Code:
1 2
[img id]: url/to/image "Optional title attribute" ![Alt text][img id]
Preview:
Strikethrough
HTML Tag: <del>
It’s an extension.
GFM adds syntax to strikethrough text.
Code:
1
~~Mistaken text.~~
Preview:
Mistaken text.
Miscellaneous
Automatic Links
Markdown supports a shortcut style for creating “automatic” links for URLs and email addresses: simply surround the URL or email address with angle brackets.
Markdown allows you to use backslash escapes to generate literal characters which would otherwise have special meaning in Markdown’s formatting syntax.
Code:
1
\*literal asterisks\*
Preview:
*literal asterisks*
Markdown provides backslash escapes for the following characters:
Code:
1 2 3 4 5 6 7 8 9 10 11 12
\ backslash ` backtick * asterisk _ underscore {} curly braces [] square brackets () parentheses # hash mark + plus sign - minus sign (hyphen) . dot ! exclamation mark
Inline HTML
For any markup that is not covered by Markdown’s syntax, you simply use HTML itself. There’s no need to preface it or delimit it to indicate that you’re switching from Markdown to HTML; you just use the tags.
Code:
1 2 3 4 5 6 7 8 9
This is a regular paragraph.
<table> <tr> <td>Foo</td> </tr> </table>
This is another regular paragraph.
Preview:
This is a regular paragraph.
Foo
This is another regular paragraph. *** Note that Markdown formatting syntax is **not processed within block-level HTML tags**.
Unlike block-level HTML tags, Markdown syntax is processed within span-level tags.
*** Following sections Fenced Code Blocks and Syntax Highlighting are extensions, you can use the other way to write the code block. #### Fenced Code Blocks Just wrap your code in \`\`\` \`\`\` (as shown below) and you won't need to indent it by four spaces.
Code:
Here’s an example: ``` function test() { console.log(“notice the blank line before this function?”); } ```
Preview:
Here’s an example:
1 2 3
functiontest() { console.log("notice the blank line before this function?"); }
Syntax Highlighting
In your fenced block, add an optional language identifier and we’ll run it through syntax highlighting (Support Languages).
HTML Tag: <hr /> Places three or more hyphens (-), asterisks (*), or underscores (_) on a line by themselves. You may use spaces between the hyphens or asterisks.
Square brackets containing the link identifier (not case sensitive, optionally indented from the left margin using up to three spaces);
followed by a colon;
followed by one or more spaces (or tabs);
followed by the URL for the link;
The link URL may, optionally, be surrounded by angle brackets.
optionally followed by a title attribute for the link, enclosed in double or single quotes, or enclosed in parentheses.
The following three link definitions are equivalent:
Code:
1 2 3 4
[foo]: http://example.com/ "Optional Title Here" [foo]: http://example.com/ 'Optional Title Here' [foo]: http://example.com/ (Optional Title Here) [foo]: <http://example.com/> "Optional Title Here"
Uses an empty set of square brackets, the link text itself is used as the name.
Markdown treats asterisks (*) and underscores (_) as indicators of emphasis. One delimiter will be <em>; *double delimiters will be <strong>.
Code:
1 2 3 4 5 6 7
*single asterisks*
_single underscores_
**double asterisks**
__double underscores__
Preview:
single asterisks
single underscores
double asterisks
double underscores
But if you surround an * or _ with spaces, it’ll be treated as a literal asterisk or underscore.
You can backslash escape it:
Code:
1
*this text is surrounded by literal asterisks*
Preview:
*this text is surrounded by literal asterisks*
Code
HTML Tag: <code>
Wraps it with backtick quotes (`).
Code:
1
Use the `printf()` function.
Preview:
Use the printf() function.
To include a literal backtick character within a code span, you can use multiple backticks as the opening and closing delimiters:
Code:
1
``There is a literal backtick (`) here.``
Preview:
There is a literal backtick (`) here.
The backtick delimiters surrounding a code span may include spaces — one after the opening, one before the closing. This allows you to place literal backtick characters at the beginning or end of a code span:
Code:
1 2 3
Asinglebacktickinacodespan: `` ` ``
Abacktick-delimitedstringinacodespan: `` `foo` ``
Preview:
A single backtick in a code span: `
A backtick-delimited string in a code span: `foo`
Images
HTML Tag: <img />
Markdown uses an image syntax that is intended to resemble the syntax for links, allowing for two styles: inline and reference.
Inline
Inline image syntax looks like this: ![Alt text](URL "Title")
Title is optional.
Code:
1 2 3
![Alt text](/path/to/img.jpg)
![Alt text](/path/to/img.jpg "Optional title")
Preview:
That is:
An exclamation mark: !;
followed by a set of square brackets, containing the alt attribute text for the image;
followed by a set of parentheses, containing the URL or path to the image, and an optional title attribute enclosed in double or single quotes.
Reference
Reference-style image syntax looks like this: ![Alt text][id]
Code:
1 2
[img id]: url/to/image "Optional title attribute" ![Alt text][img id]
Preview:
Strikethrough
HTML Tag: <del>
It’s an extension.
GFM adds syntax to strikethrough text.
Code:
1
~~Mistaken text.~~
Preview:
Mistaken text.
Miscellaneous
Automatic Links
Markdown supports a shortcut style for creating “automatic” links for URLs and email addresses: simply surround the URL or email address with angle brackets.
Markdown allows you to use backslash escapes to generate literal characters which would otherwise have special meaning in Markdown’s formatting syntax.
Code:
1
\*literal asterisks\*
Preview:
*literal asterisks*
Markdown provides backslash escapes for the following characters:
Code:
1 2 3 4 5 6 7 8 9 10 11 12
\ backslash ` backtick * asterisk _ underscore {} curly braces [] square brackets () parentheses # hash mark + plus sign - minus sign (hyphen) . dot ! exclamation mark
Inline HTML
For any markup that is not covered by Markdown’s syntax, you simply use HTML itself. There’s no need to preface it or delimit it to indicate that you’re switching from Markdown to HTML; you just use the tags.
Code:
1 2 3 4 5 6 7 8 9
This is a regular paragraph.
<table> <tr> <td>Foo</td> </tr> </table>
This is another regular paragraph.
Preview:
This is a regular paragraph.
Foo
This is another regular paragraph. *** Note that Markdown formatting syntax is **not processed within block-level HTML tags**.
Unlike block-level HTML tags, Markdown syntax is processed within span-level tags.
@mediaonly screen and (min-device-width: 375px) and (max-device-width: 667px) and (orientation : portrait) { /*iPhone 6 Portrait*/ } @mediaonly screen and (min-device-width: 375px) and (max-device-width: 667px) and (orientation : landscape) { /*iPhone 6 landscape*/ } @mediaonly screen and (min-device-width: 414px) and (max-device-width: 736px) and (orientation : portrait) { /*iPhone 6+ Portrait*/ } @mediaonly screen and (min-device-width: 414px) and (max-device-width: 736px) and (orientation : landscape) { /*iPhone 6+ landscape*/ } @mediaonly screen and (max-device-width: 640px), only screen and (max-device-width: 667px), only screen and (max-width: 480px){ /*iPhone 6 and iPhone 6+ portrait and landscape*/ } @mediaonly screen and (max-device-width: 640px), only screen and (max-device-width: 667px), only screen and (max-width: 480px) and (orientation : portrait){ /*iPhone 6 and iPhone 6+ portrait*/ } @mediaonly screen and (max-device-width: 640px), only screen and (max-device-width: 667px), only screen and (max-width: 480px) and (orientation : landscape){ /*iPhone 6 and iPhone 6+ landscape*/ }
HTC Evo,BlackBerry Torch,HTC Thunderbolt,HD2
1 2 3
@media screen and (max-device-width: 480px){ /*some rules*/ }
@mediaonly screen and (min-device-width: 375px) and (max-device-width: 667px) and (orientation : portrait) { /*iPhone 6 Portrait*/ } @mediaonly screen and (min-device-width: 375px) and (max-device-width: 667px) and (orientation : landscape) { /*iPhone 6 landscape*/ } @mediaonly screen and (min-device-width: 414px) and (max-device-width: 736px) and (orientation : portrait) { /*iPhone 6+ Portrait*/ } @mediaonly screen and (min-device-width: 414px) and (max-device-width: 736px) and (orientation : landscape) { /*iPhone 6+ landscape*/ } @mediaonly screen and (max-device-width: 640px), only screen and (max-device-width: 667px), only screen and (max-width: 480px){ /*iPhone 6 and iPhone 6+ portrait and landscape*/ } @mediaonly screen and (max-device-width: 640px), only screen and (max-device-width: 667px), only screen and (max-width: 480px) and (orientation : portrait){ /*iPhone 6 and iPhone 6+ portrait*/ } @mediaonly screen and (max-device-width: 640px), only screen and (max-device-width: 667px), only screen and (max-width: 480px) and (orientation : landscape){ /*iPhone 6 and iPhone 6+ landscape*/ }
HTC Evo,BlackBerry Torch,HTC Thunderbolt,HD2
1 2 3
@media screen and (max-device-width: 480px){ /*some rules*/ }
// This is bad, since you do create a global without having anyone to tell you (function () { a = 42; console.log(a); // → 42 })(); console.log(a); // → 42
使用use strict,你可以得到更多的确切的错误:
1 2 3 4 5
(function () { "use strict"; a = 42; // Error: Uncaught ReferenceError: a is not defined })();
var foo = "42"; var myNumber = +foo; // shortcut for Number(foo) // → 42
// Tip: you can convert it directly into a negative number var negativeFoo = -foo; // or -Number(foo) // → -42
// From object to array // Tip: `arguments` is an object and in general you want to use it as array var args = { 0: "foo", 1: "bar", length: 2 }; Array.prototype.slice.call(args) // → [ 'foo', 'bar' ]
// Anything to boolean /// Non non p is a boolean p var t = 1; var f = 0; !!t // → true !!f // → false
/// And non-p is a boolean non-p !t // → false !f // → true
// Anything to string var foo = 42; "" + foo // shortcut for String(foo) // → "42"
\ No newline at end of file
diff --git a/2016/judgment-variable-type/index.html b/2016/judgment-variable-type/index.html
index 6020912e..dafc69e1 100644
--- a/2016/judgment-variable-type/index.html
+++ b/2016/judgment-variable-type/index.html
@@ -1 +1 @@
-判断变量类型的一些方法 | 云淡风轻
var a = [1,2,3]; var b = {name:'zhangsan',sex:123}; var fn = function(){}; var detectType = function(o){ if(o instanceofArray){ return'Array' }elseif( o instanceofObject ){ return'Object'; }else{ return'param is no object type'; } } console.log( detectType(a) ); // Array console.log( detectType(b) ); // Object console.log( detectType(1) ); // param is no object type console.log( detectType(true) ); // param is no object type console.log( detectType('a') ); // param is no object type
var a = [1,2,3]; var b = {name:'zhangsan',sex:123}; var fn = function(){}; var detectType = function(o){ if(o instanceofArray){ return'Array' }elseif( o instanceofObject ){ return'Object'; }else{ return'param is no object type'; } } console.log( detectType(a) ); // Array console.log( detectType(b) ); // Object console.log( detectType(1) ); // param is no object type console.log( detectType(true) ); // param is no object type console.log( detectType('a') ); // param is no object type
The project aims to make encrypted connections in the World Wide Web the default case. By getting rid of payment, web server configuration, validation emails and dealing with expired certificates it is meant to significantly lower the complexity of setting up and maintaining TLS encryption.On a Linux web server, execution of only two commands is sufficient to set up HTTPS encryption, acquire and install certificates within 20 to 30 seconds.
Congratulations! Your certificate and chain have been saved at /etc/letsencrypt/live/example.com/fullchain.pem. Your cert will expire on 2017-06-19. To obtain a new or tweaked version of this certificate in the future, simply run certbot again. To non-interactively renew all of your certificates, run “certbot renew”
The project aims to make encrypted connections in the World Wide Web the default case. By getting rid of payment, web server configuration, validation emails and dealing with expired certificates it is meant to significantly lower the complexity of setting up and maintaining TLS encryption.On a Linux web server, execution of only two commands is sufficient to set up HTTPS encryption, acquire and install certificates within 20 to 30 seconds.
Congratulations! Your certificate and chain have been saved at /etc/letsencrypt/live/example.com/fullchain.pem. Your cert will expire on 2017-06-19. To obtain a new or tweaked version of this certificate in the future, simply run certbot again. To non-interactively renew all of your certificates, run “certbot renew”
\ No newline at end of file
diff --git a/2017/country-city-and-language/index.html b/2017/country-city-and-language/index.html
index c4d5c0d0..09bb52a6 100644
--- a/2017/country-city-and-language/index.html
+++ b/2017/country-city-and-language/index.html
@@ -1 +1 @@
-不同的国家/地区与语言缩写代码 | 云淡风轻
\ No newline at end of file
diff --git a/2017/git-command-backup/index.html b/2017/git-command-backup/index.html
index 9b0c209d..967f4d8c 100644
--- a/2017/git-command-backup/index.html
+++ b/2017/git-command-backup/index.html
@@ -1 +1 @@
-Git中的一些骚操作 | 云淡风轻
\ No newline at end of file
diff --git a/2017/mysql-tutorial/index.html b/2017/mysql-tutorial/index.html
index 677af6ed..b26779bc 100644
--- a/2017/mysql-tutorial/index.html
+++ b/2017/mysql-tutorial/index.html
@@ -1 +1 @@
-从删库到跑路 -- MySql 不算初体验的初体验 | 云淡风轻
$mysql> CREATE USER 'dog'@'localhost' IDENTIFIED BY '123456'; $mysql> CREATE USER 'pig'@'192.168.1.101_' IDENDIFIED BY '123456'; $mysql> CREATE USER 'pig'@'%' IDENTIFIED BY '123456'; $mysql> CREATE USER 'pig'@'%' IDENTIFIED BY ''; $mysql> CREATE USER 'pig'@'%';
授权
命令:
1
$mysql> GRANT privileges ON databasename.tablename TO 'username'@'host'
注意: 假如你在给用户'pig'@'%'授权的时候是这样的(或类似的):GRANT SELECT ON test.user TO 'pig'@'%',则在使用REVOKE SELECT ON *.* FROM 'pig'@'%'; 命令并不能撤销该用户对test数据库中user表的SELECT 操作。 相反,如果授权使用的是GRANT SELECT ON *.* TO 'pig'@'%', 则REVOKE SELECT ON test.user FROM 'pig'@'%'; 命令也不能撤销该用户对test数据库中user表的SELECT权限。 具体信息可以用命令SHOW GRANTS FOR 'pig'@'%'; 查看。
$mysql> CREATE USER 'dog'@'localhost' IDENTIFIED BY '123456'; $mysql> CREATE USER 'pig'@'192.168.1.101_' IDENDIFIED BY '123456'; $mysql> CREATE USER 'pig'@'%' IDENTIFIED BY '123456'; $mysql> CREATE USER 'pig'@'%' IDENTIFIED BY ''; $mysql> CREATE USER 'pig'@'%';
授权
命令:
1
$mysql> GRANT privileges ON databasename.tablename TO 'username'@'host'
注意: 假如你在给用户'pig'@'%'授权的时候是这样的(或类似的):GRANT SELECT ON test.user TO 'pig'@'%',则在使用REVOKE SELECT ON *.* FROM 'pig'@'%'; 命令并不能撤销该用户对test数据库中user表的SELECT 操作。 相反,如果授权使用的是GRANT SELECT ON *.* TO 'pig'@'%', 则REVOKE SELECT ON test.user FROM 'pig'@'%'; 命令也不能撤销该用户对test数据库中user表的SELECT权限。 具体信息可以用命令SHOW GRANTS FOR 'pig'@'%'; 查看。
deb http://deb.debian.org/debian bullseye-backports main contrib non-free deb-src http://deb.debian.org/debian bullseye-backports main contrib non-free
deb http://deb.debian.org/debian bullseye-backports main contrib non-free deb-src http://deb.debian.org/debian bullseye-backports main contrib non-free
\ No newline at end of file
diff --git a/404.html b/404.html
index de93281d..27428f26 100644
--- a/404.html
+++ b/404.html
@@ -1 +1 @@
-404 Not Found:该页无法显示 | 云淡风轻
\ No newline at end of file
diff --git a/about/index.html b/about/index.html
index 3b8c1a2f..fac31f33 100644
--- a/about/index.html
+++ b/about/index.html
@@ -1 +1 @@
-关于 | 云淡风轻
\ No newline at end of file
diff --git a/archives/index.html b/archives/index.html
index ef81c323..cbfa3ca6 100644
--- a/archives/index.html
+++ b/archives/index.html
@@ -1 +1 @@
-归档 | 云淡风轻
\ No newline at end of file
diff --git a/archives/page/2/index.html b/archives/page/2/index.html
index 78d3edde..370529b4 100644
--- a/archives/page/2/index.html
+++ b/archives/page/2/index.html
@@ -1 +1 @@
-归档 | 云淡风轻
deb http://deb.debian.org/debian bullseye-backports main contrib non-free deb-src http://deb.debian.org/debian bullseye-backports main contrib non-free
deb http://deb.debian.org/debian bullseye-backports main contrib non-free deb-src http://deb.debian.org/debian bullseye-backports main contrib non-free
$mysql> CREATE USER 'dog'@'localhost' IDENTIFIED BY '123456'; $mysql> CREATE USER 'pig'@'192.168.1.101_' IDENDIFIED BY '123456'; $mysql> CREATE USER 'pig'@'%' IDENTIFIED BY '123456'; $mysql> CREATE USER 'pig'@'%' IDENTIFIED BY ''; $mysql> CREATE USER 'pig'@'%';
授权
命令:
1
$mysql> GRANT privileges ON databasename.tablename TO 'username'@'host'
注意: 假如你在给用户'pig'@'%'授权的时候是这样的(或类似的):GRANT SELECT ON test.user TO 'pig'@'%',则在使用REVOKE SELECT ON *.* FROM 'pig'@'%'; 命令并不能撤销该用户对test数据库中user表的SELECT 操作。 相反,如果授权使用的是GRANT SELECT ON *.* TO 'pig'@'%', 则REVOKE SELECT ON test.user FROM 'pig'@'%'; 命令也不能撤销该用户对test数据库中user表的SELECT权限。 具体信息可以用命令SHOW GRANTS FOR 'pig'@'%'; 查看。
The project aims to make encrypted connections in the World Wide Web the default case. By getting rid of payment, web server configuration, validation emails and dealing with expired certificates it is meant to significantly lower the complexity of setting up and maintaining TLS encryption.On a Linux web server, execution of only two commands is sufficient to set up HTTPS encryption, acquire and install certificates within 20 to 30 seconds.
Congratulations! Your certificate and chain have been saved at /etc/letsencrypt/live/example.com/fullchain.pem. Your cert will expire on 2017-06-19. To obtain a new or tweaked version of this certificate in the future, simply run certbot again. To non-interactively renew all of your certificates, run “certbot renew”
The project aims to make encrypted connections in the World Wide Web the default case. By getting rid of payment, web server configuration, validation emails and dealing with expired certificates it is meant to significantly lower the complexity of setting up and maintaining TLS encryption.On a Linux web server, execution of only two commands is sufficient to set up HTTPS encryption, acquire and install certificates within 20 to 30 seconds.
Congratulations! Your certificate and chain have been saved at /etc/letsencrypt/live/example.com/fullchain.pem. Your cert will expire on 2017-06-19. To obtain a new or tweaked version of this certificate in the future, simply run certbot again. To non-interactively renew all of your certificates, run “certbot renew”
var a = [1,2,3]; var b = {name:'zhangsan',sex:123}; var fn = function(){}; var detectType = function(o){ if(o instanceofArray){ return'Array' }elseif( o instanceofObject ){ return'Object'; }else{ return'param is no object type'; } } console.log( detectType(a) ); // Array console.log( detectType(b) ); // Object console.log( detectType(1) ); // param is no object type console.log( detectType(true) ); // param is no object type console.log( detectType('a') ); // param is no object type
// This is bad, since you do create a global without having anyone to tell you (function () { a = 42; console.log(a); // → 42 })(); console.log(a); // → 42
使用use strict,你可以得到更多的确切的错误:
1 2 3 4 5
(function () { "use strict"; a = 42; // Error: Uncaught ReferenceError: a is not defined })();
var foo = "42"; var myNumber = +foo; // shortcut for Number(foo) // → 42
// Tip: you can convert it directly into a negative number var negativeFoo = -foo; // or -Number(foo) // → -42
// From object to array // Tip: `arguments` is an object and in general you want to use it as array var args = { 0: "foo", 1: "bar", length: 2 }; Array.prototype.slice.call(args) // → [ 'foo', 'bar' ]
// Anything to boolean /// Non non p is a boolean p var t = 1; var f = 0; !!t // → true !!f // → false
/// And non-p is a boolean non-p !t // → false !f // → true
// Anything to string var foo = 42; "" + foo // shortcut for String(foo) // → "42"
A markdown example shows how to write a markdown file. This document integrates core syntax and extensions (GMF).
Block Elements
Paragraphs and Line Breaks
Paragraphs
HTML Tag: <p>
One or more blank lines. (A blank line is a line containing nothing but spaces or tabs is considered blank.)
Code:
1 2 3 4
This will be inline.
This is second paragraph.
Preview:
This will be inline.
This is second paragraph.
Line Breaks
HTML Tag: <br />
End a line with two or more spaces.
Code:
1 2
This will be not inline.
Preview:
This will be not inline.
Headers
Markdown supports two styles of headers, Setext and atx.
Setext
HTML Tags: <h1>, <h2>
“Underlined” using equal signs (=) as <h1> and dashes (-) as <h2> in any number.
Code:
1 2 3 4
This is an H1 ============= This is an H2 -------------
Preview: *** This is an H1
This is an H2
atx
HTML Tags: <h1>, <h2>, <h3>, <h4>, <h5>, <h6>
Uses 1-6 hash characters (#) at the start of the line, corresponding to <h1> - <h6>.
Code:
1 2 3
# This is an H1 ## This is an H2 ###### This is an H6
Preview:
This is an H1
This is an H2
This is an H6
Optionally, you may “close” atx-style headers. The closing hashes don’t need to match the number of hashes used to open the header.
Code:
1 2 3
# This is an H1 # ## This is an H2 ## ### This is an H3 ######
Preview:
This is an H1
This is an H2
This is an H3
Blockquotes
HTML Tag: <blockquote>
Markdown uses email-style > characters for blockquoting. It looks best if you hard wrap the text and put a > before every line.
Code:
1 2 3 4 5 6
>This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet, >consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. >Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus. > >Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse >id sem consectetuer libero luctus adipiscing.
Preview:
This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing.
Markdown allows you to be lazy and only put the > before the first line of a hard-wrapped paragraph.
Code:
1 2 3 4 5 6
>This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
>Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing.
Preview:
This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing.
Blockquotes can be nested (i.e. a blockquote-in-a-blockquote) by adding additional levels of >.
Code:
1 2 3 4 5
>This is the first level of quoting. > >> This is nested blockquote. > >Back to the first level.
Preview:
This is the first level of quoting.
This is nested blockquote.
Back to the first level.
Blockquotes can contain other Markdown elements, including headers, lists, and code blocks.
Code:
1 2 3 4 5 6 7 8
>## This is a header. > >1.This is the first list item. >2.This is the second list item. > >Here's some example code: > > return shell_exec("echo $input | $markdown_script");
***Following sections Fenced Code Blocks and Syntax Highlighting are extensions, you can use the other way to write the code block.#### Fenced Code BlocksJust wrap your code in \`\`\` \`\`\` (as shown below) and you won't need to indent it by four spaces.
Code:
Here’s an example: ``` function test() { console.log(“notice the blank line before this function?”); } ```
Preview:
Here’s an example:
1 2 3
functiontest() { console.log("notice the blank line before this function?"); }
Syntax Highlighting
In your fenced block, add an optional language identifier and we’ll run it through syntax highlighting (Support Languages).
HTML Tag: <hr /> Places three or more hyphens (-), asterisks (*), or underscores (_) on a line by themselves. You may use spaces between the hyphens or asterisks.
Square brackets containing the link identifier (not case sensitive, optionally indented from the left margin using up to three spaces);
followed by a colon;
followed by one or more spaces (or tabs);
followed by the URL for the link;
The link URL may, optionally, be surrounded by angle brackets.
optionally followed by a title attribute for the link, enclosed in double or single quotes, or enclosed in parentheses.
The following three link definitions are equivalent:
Code:
1 2 3 4
[foo]: http://example.com/ "Optional Title Here" [foo]: http://example.com/ 'Optional Title Here' [foo]: http://example.com/ (Optional Title Here) [foo]: <http://example.com/> "Optional Title Here"
Uses an empty set of square brackets, the link text itself is used as the name.
Markdown treats asterisks (*) and underscores (_) as indicators of emphasis. One delimiter will be <em>; *double delimiters will be <strong>.
Code:
1 2 3 4 5 6 7
*single asterisks*
_single underscores_
**double asterisks**
__double underscores__
Preview:
single asterisks
single underscores
double asterisks
double underscores
But if you surround an * or _ with spaces, it’ll be treated as a literal asterisk or underscore.
You can backslash escape it:
Code:
1
*this text is surrounded by literal asterisks*
Preview:
*this text is surrounded by literal asterisks*
Code
HTML Tag: <code>
Wraps it with backtick quotes (`).
Code:
1
Use the `printf()` function.
Preview:
Use the printf() function.
To include a literal backtick character within a code span, you can use multiple backticks as the opening and closing delimiters:
Code:
1
``There is a literal backtick (`) here.``
Preview:
There is a literal backtick (`) here.
The backtick delimiters surrounding a code span may include spaces — one after the opening, one before the closing. This allows you to place literal backtick characters at the beginning or end of a code span:
Code:
1 2 3
Asinglebacktickinacodespan: `` ` ``
Abacktick-delimitedstringinacodespan: `` `foo` ``
Preview:
A single backtick in a code span: `
A backtick-delimited string in a code span: `foo`
Images
HTML Tag: <img />
Markdown uses an image syntax that is intended to resemble the syntax for links, allowing for two styles: inline and reference.
Inline
Inline image syntax looks like this: ![Alt text](URL "Title")
Title is optional.
Code:
1 2 3
![Alt text](/path/to/img.jpg)
![Alt text](/path/to/img.jpg "Optional title")
Preview:
That is:
An exclamation mark: !;
followed by a set of square brackets, containing the alt attribute text for the image;
followed by a set of parentheses, containing the URL or path to the image, and an optional title attribute enclosed in double or single quotes.
Reference
Reference-style image syntax looks like this: ![Alt text][id]
Code:
1 2
[img id]: url/to/image "Optional title attribute" ![Alt text][img id]
Preview:
Strikethrough
HTML Tag: <del>
It’s an extension.
GFM adds syntax to strikethrough text.
Code:
1
~~Mistaken text.~~
Preview:
Mistaken text.
Miscellaneous
Automatic Links
Markdown supports a shortcut style for creating “automatic” links for URLs and email addresses: simply surround the URL or email address with angle brackets.
Markdown allows you to use backslash escapes to generate literal characters which would otherwise have special meaning in Markdown’s formatting syntax.
Code:
1
\*literal asterisks\*
Preview:
*literal asterisks*
Markdown provides backslash escapes for the following characters:
Code:
1 2 3 4 5 6 7 8 9 10 11 12
\ backslash ` backtick * asterisk _ underscore {} curly braces [] square brackets () parentheses # hash mark + plus sign - minus sign (hyphen) . dot ! exclamation mark
Inline HTML
For any markup that is not covered by Markdown’s syntax, you simply use HTML itself. There’s no need to preface it or delimit it to indicate that you’re switching from Markdown to HTML; you just use the tags.
Code:
1 2 3 4 5 6 7 8 9
This is a regular paragraph.
<table> <tr> <td>Foo</td> </tr> </table>
This is another regular paragraph.
Preview:
This is a regular paragraph.
Foo
This is another regular paragraph.***Note that Markdown formatting syntax is **not processed within block-level HTML tags**.
Unlike block-level HTML tags, Markdown syntax is processed within span-level tags.
A markdown example shows how to write a markdown file. This document integrates core syntax and extensions (GMF).
Block Elements
Paragraphs and Line Breaks
Paragraphs
HTML Tag: <p>
One or more blank lines. (A blank line is a line containing nothing but spaces or tabs is considered blank.)
Code:
1 2 3 4
This will be inline.
This is second paragraph.
Preview:
This will be inline.
This is second paragraph.
Line Breaks
HTML Tag: <br />
End a line with two or more spaces.
Code:
1 2
This will be not inline.
Preview:
This will be not inline.
Headers
Markdown supports two styles of headers, Setext and atx.
Setext
HTML Tags: <h1>, <h2>
“Underlined” using equal signs (=) as <h1> and dashes (-) as <h2> in any number.
Code:
1 2 3 4
This is an H1 ============= This is an H2 -------------
Preview: *** This is an H1
This is an H2
atx
HTML Tags: <h1>, <h2>, <h3>, <h4>, <h5>, <h6>
Uses 1-6 hash characters (#) at the start of the line, corresponding to <h1> - <h6>.
Code:
1 2 3
# This is an H1 ## This is an H2 ###### This is an H6
Preview:
This is an H1
This is an H2
This is an H6
Optionally, you may “close” atx-style headers. The closing hashes don’t need to match the number of hashes used to open the header.
Code:
1 2 3
# This is an H1 # ## This is an H2 ## ### This is an H3 ######
Preview:
This is an H1
This is an H2
This is an H3
Blockquotes
HTML Tag: <blockquote>
Markdown uses email-style > characters for blockquoting. It looks best if you hard wrap the text and put a > before every line.
Code:
1 2 3 4 5 6
>This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet, >consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. >Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus. > >Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse >id sem consectetuer libero luctus adipiscing.
Preview:
This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing.
Markdown allows you to be lazy and only put the > before the first line of a hard-wrapped paragraph.
Code:
1 2 3 4 5 6
>This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
>Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing.
Preview:
This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing.
Blockquotes can be nested (i.e. a blockquote-in-a-blockquote) by adding additional levels of >.
Code:
1 2 3 4 5
>This is the first level of quoting. > >> This is nested blockquote. > >Back to the first level.
Preview:
This is the first level of quoting.
This is nested blockquote.
Back to the first level.
Blockquotes can contain other Markdown elements, including headers, lists, and code blocks.
Code:
1 2 3 4 5 6 7 8
>## This is a header. > >1.This is the first list item. >2.This is the second list item. > >Here's some example code: > > return shell_exec("echo $input | $markdown_script");
***Following sections Fenced Code Blocks and Syntax Highlighting are extensions, you can use the other way to write the code block.#### Fenced Code BlocksJust wrap your code in \`\`\` \`\`\` (as shown below) and you won't need to indent it by four spaces.
Code:
Here’s an example: ``` function test() { console.log(“notice the blank line before this function?”); } ```
Preview:
Here’s an example:
1 2 3
functiontest() { console.log("notice the blank line before this function?"); }
Syntax Highlighting
In your fenced block, add an optional language identifier and we’ll run it through syntax highlighting (Support Languages).
HTML Tag: <hr /> Places three or more hyphens (-), asterisks (*), or underscores (_) on a line by themselves. You may use spaces between the hyphens or asterisks.
Square brackets containing the link identifier (not case sensitive, optionally indented from the left margin using up to three spaces);
followed by a colon;
followed by one or more spaces (or tabs);
followed by the URL for the link;
The link URL may, optionally, be surrounded by angle brackets.
optionally followed by a title attribute for the link, enclosed in double or single quotes, or enclosed in parentheses.
The following three link definitions are equivalent:
Code:
1 2 3 4
[foo]: http://example.com/ "Optional Title Here" [foo]: http://example.com/ 'Optional Title Here' [foo]: http://example.com/ (Optional Title Here) [foo]: <http://example.com/> "Optional Title Here"
Uses an empty set of square brackets, the link text itself is used as the name.
Markdown treats asterisks (*) and underscores (_) as indicators of emphasis. One delimiter will be <em>; *double delimiters will be <strong>.
Code:
1 2 3 4 5 6 7
*single asterisks*
_single underscores_
**double asterisks**
__double underscores__
Preview:
single asterisks
single underscores
double asterisks
double underscores
But if you surround an * or _ with spaces, it’ll be treated as a literal asterisk or underscore.
You can backslash escape it:
Code:
1
*this text is surrounded by literal asterisks*
Preview:
*this text is surrounded by literal asterisks*
Code
HTML Tag: <code>
Wraps it with backtick quotes (`).
Code:
1
Use the `printf()` function.
Preview:
Use the printf() function.
To include a literal backtick character within a code span, you can use multiple backticks as the opening and closing delimiters:
Code:
1
``There is a literal backtick (`) here.``
Preview:
There is a literal backtick (`) here.
The backtick delimiters surrounding a code span may include spaces — one after the opening, one before the closing. This allows you to place literal backtick characters at the beginning or end of a code span:
Code:
1 2 3
Asinglebacktickinacodespan: `` ` ``
Abacktick-delimitedstringinacodespan: `` `foo` ``
Preview:
A single backtick in a code span: `
A backtick-delimited string in a code span: `foo`
Images
HTML Tag: <img />
Markdown uses an image syntax that is intended to resemble the syntax for links, allowing for two styles: inline and reference.
Inline
Inline image syntax looks like this: ![Alt text](URL "Title")
Title is optional.
Code:
1 2 3
![Alt text](/path/to/img.jpg)
![Alt text](/path/to/img.jpg "Optional title")
Preview:
That is:
An exclamation mark: !;
followed by a set of square brackets, containing the alt attribute text for the image;
followed by a set of parentheses, containing the URL or path to the image, and an optional title attribute enclosed in double or single quotes.
Reference
Reference-style image syntax looks like this: ![Alt text][id]
Code:
1 2
[img id]: url/to/image "Optional title attribute" ![Alt text][img id]
Preview:
Strikethrough
HTML Tag: <del>
It’s an extension.
GFM adds syntax to strikethrough text.
Code:
1
~~Mistaken text.~~
Preview:
Mistaken text.
Miscellaneous
Automatic Links
Markdown supports a shortcut style for creating “automatic” links for URLs and email addresses: simply surround the URL or email address with angle brackets.
Markdown allows you to use backslash escapes to generate literal characters which would otherwise have special meaning in Markdown’s formatting syntax.
Code:
1
\*literal asterisks\*
Preview:
*literal asterisks*
Markdown provides backslash escapes for the following characters:
Code:
1 2 3 4 5 6 7 8 9 10 11 12
\ backslash ` backtick * asterisk _ underscore {} curly braces [] square brackets () parentheses # hash mark + plus sign - minus sign (hyphen) . dot ! exclamation mark
Inline HTML
For any markup that is not covered by Markdown’s syntax, you simply use HTML itself. There’s no need to preface it or delimit it to indicate that you’re switching from Markdown to HTML; you just use the tags.
Code:
1 2 3 4 5 6 7 8 9
This is a regular paragraph.
<table> <tr> <td>Foo</td> </tr> </table>
This is another regular paragraph.
Preview:
This is a regular paragraph.
Foo
This is another regular paragraph.***Note that Markdown formatting syntax is **not processed within block-level HTML tags**.
Unlike block-level HTML tags, Markdown syntax is processed within span-level tags.
@mediaonly screen and (min-device-width: 375px) and (max-device-width: 667px) and (orientation : portrait) { /*iPhone 6 Portrait*/ } @mediaonly screen and (min-device-width: 375px) and (max-device-width: 667px) and (orientation : landscape) { /*iPhone 6 landscape*/ } @mediaonly screen and (min-device-width: 414px) and (max-device-width: 736px) and (orientation : portrait) { /*iPhone 6+ Portrait*/ } @mediaonly screen and (min-device-width: 414px) and (max-device-width: 736px) and (orientation : landscape) { /*iPhone 6+ landscape*/ } @mediaonly screen and (max-device-width: 640px), only screen and (max-device-width: 667px), only screen and (max-width: 480px){ /*iPhone 6 and iPhone 6+ portrait and landscape*/ } @mediaonly screen and (max-device-width: 640px), only screen and (max-device-width: 667px), only screen and (max-width: 480px) and (orientation : portrait){ /*iPhone 6 and iPhone 6+ portrait*/ } @mediaonly screen and (max-device-width: 640px), only screen and (max-device-width: 667px), only screen and (max-width: 480px) and (orientation : landscape){ /*iPhone 6 and iPhone 6+ landscape*/ }
HTC Evo,BlackBerry Torch,HTC Thunderbolt,HD2
1 2 3
@media screen and (max-device-width: 480px){ /*some rules*/ }
Enter passphrase (empty for no passphrase): [Typea passphrase] Enter same passphrase again: [Typepassphrase again]
然后你就会得到你的 SSH Key 的指纹,看起来像下面的代码:
1 2 3 4
Your identification has been saved in /Users/you/.ssh/id_rsa. Your public key has been saved in /Users/you/.ssh/id_rsa.pub. The key fingerprint is: 01:0f:f4:3b:ca:85:d6:17:a1:7d:f0:68:9d:f0:a2:db your_email@example.com
$ ssh -T git@GitHub.com # Attempts to ssh to GitHub
会得到如下的指纹提示:键入yes
1 2 3
The authenticity of host 'GitHub.com (207.97.227.239)' can't be established. RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48. Are you sure you want to continue connecting (yes/no)?
如果出现下面的提示,恭喜你,验证成功。
1
Hi username! You've successfully authenticated, but GitHub does not provide shell access.
// bad var errorMessage = 'Thisis a super long error that was thrown because of Batman. When you stop to think about how Batman had anything to do with this, you would get nowhere fast.';
// bad var errorMessage = 'Thisis a super long error that \ was thrown because of Batman. \ When you stop to think about \ how Batman had anything to do \ with this, you would get nowhere \ fast.';
// good var errorMessage = 'Thisis a super long error that ' + 'was thrown because of Batman.' + 'When you stop to think about ' + 'how Batman had anything to do ' + 'with this, you would get nowhere ' + 'fast.';
messages = [{ state: 'success', message: 'This one worked.' },{ state: 'success', message: 'This one worked as well.' },{ state: 'error', message: 'This one did not work.' }];
length = messages.length;
// bad functioninbox(messages) { items = '<ul>'; for (i = 0; i < length; i++) { items += '<li>' + messages[i].message + '</li>'; } return items + '</ul>'; }
// good functioninbox(messages) { items = []; for (i = 0; i < length; i++) { items[i] = messages[i].message; } return'<ul><li>' + items.join('</li><li>') + '</li></ul>'; }
函数
函数表达式:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
// 匿名函数表达式 var anonymous = function() { returntrue; };
// 有名函数表达式 var named = functionnamed() { returntrue; };
// 立即调用函数表达式 (function() { console.log('Welcome to the Internet. Please follow me.'); })();
// bad // make() returns a new element // based on the passed in tag name // // @param <String> tag // @return <Element> element functionmake(tag) {
// ...stuff...
returnelement; }
// good /** * make() returns a new element * based on the passed in tag name * * @param <String> tag * @return <Element> element */ functionmake(tag) {
// good /** * parseInt was the reason my code was slow. * Bitshifting the String to coerce it to a * Number made it a lot faster. */ varval = inputValue >> 0;
布尔值:
1 2 3 4 5 6 7 8 9 10
var age = 0;
// bad var hasAge = newBoolean(age);
// good var hasAge = Boolean(age);
// good var hasAge = !!age;
命名约定
避免单个字符名,让你的变量名有描述意义。
1 2 3 4 5 6 7 8 9
// bad functionq() { // ...stuff... }
// good functionquery() { // ..stuff.. }
当命名对象、函数和实例时使用驼峰命名规则
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
// bad var OBJEcttsssss = {}; var this_is_my_object = {}; varthis-is-my-object = {}; function c() {}; var u = new user({ name: 'Bob Parr' });
// good var thisIsMyObject = {}; function thisIsMyFunction() {}; var user = new User({ name: 'Bob Parr' });
当命名构造函数或类时使用驼峰式大写
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
// bad functionuser(options) { this.name = options.name; }
var bad = newuser({ name: 'nope' });
// good functionUser(options) { this.name = options.name; }
var good = newUser({ name: 'yup' });
命名私有属性时前面加个下划线 _
1 2 3 4 5 6
// bad this.__firstName__ = 'Panda'; this.firstName_ = 'Panda';
// good this._firstName = 'Panda';
当保存对 this 的引用时使用 self(python 风格),避免this issue . Angular建议使用vm(MVVM模式中view-model)
1 2 3 4 5 6 7
// good function() { var self = this; returnfunction() { console.log(self); }; }
// bad var errorMessage = 'Thisis a super long error that was thrown because of Batman. When you stop to think about how Batman had anything to do with this, you would get nowhere fast.';
// bad var errorMessage = 'Thisis a super long error that \ was thrown because of Batman. \ When you stop to think about \ how Batman had anything to do \ with this, you would get nowhere \ fast.';
// good var errorMessage = 'Thisis a super long error that ' + 'was thrown because of Batman.' + 'When you stop to think about ' + 'how Batman had anything to do ' + 'with this, you would get nowhere ' + 'fast.';
messages = [{ state: 'success', message: 'This one worked.' },{ state: 'success', message: 'This one worked as well.' },{ state: 'error', message: 'This one did not work.' }];
length = messages.length;
// bad functioninbox(messages) { items = '<ul>'; for (i = 0; i < length; i++) { items += '<li>' + messages[i].message + '</li>'; } return items + '</ul>'; }
// good functioninbox(messages) { items = []; for (i = 0; i < length; i++) { items[i] = messages[i].message; } return'<ul><li>' + items.join('</li><li>') + '</li></ul>'; }
函数
函数表达式:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
// 匿名函数表达式 var anonymous = function() { returntrue; };
// 有名函数表达式 var named = functionnamed() { returntrue; };
// 立即调用函数表达式 (function() { console.log('Welcome to the Internet. Please follow me.'); })();
// bad // make() returns a new element // based on the passed in tag name // // @param <String> tag // @return <Element> element functionmake(tag) {
// ...stuff...
returnelement; }
// good /** * make() returns a new element * based on the passed in tag name * * @param <String> tag * @return <Element> element */ functionmake(tag) {
// good /** * parseInt was the reason my code was slow. * Bitshifting the String to coerce it to a * Number made it a lot faster. */ varval = inputValue >> 0;
布尔值:
1 2 3 4 5 6 7 8 9 10
var age = 0;
// bad var hasAge = newBoolean(age);
// good var hasAge = Boolean(age);
// good var hasAge = !!age;
命名约定
避免单个字符名,让你的变量名有描述意义。
1 2 3 4 5 6 7 8 9
// bad functionq() { // ...stuff... }
// good functionquery() { // ..stuff.. }
当命名对象、函数和实例时使用驼峰命名规则
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
// bad var OBJEcttsssss = {}; var this_is_my_object = {}; varthis-is-my-object = {}; function c() {}; var u = new user({ name: 'Bob Parr' });
// good var thisIsMyObject = {}; function thisIsMyFunction() {}; var user = new User({ name: 'Bob Parr' });
当命名构造函数或类时使用驼峰式大写
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
// bad functionuser(options) { this.name = options.name; }
var bad = newuser({ name: 'nope' });
// good functionUser(options) { this.name = options.name; }
var good = newUser({ name: 'yup' });
命名私有属性时前面加个下划线 _
1 2 3 4 5 6
// bad this.__firstName__ = 'Panda'; this.firstName_ = 'Panda';
// good this._firstName = 'Panda';
当保存对 this 的引用时使用 self(python 风格),避免this issue . Angular建议使用vm(MVVM模式中view-model)
1 2 3 4 5 6 7
// good function() { var self = this; returnfunction() { console.log(self); }; }
functiongetAttr(obj){ var a=[]; for(a[a.length] in obj); return a; } console.log(getAttr({'name':'zhangsan','age':'20'}));//输出:['name','age']
乍一看可能比较蒙,不过仔细分析还是不难理解的。常见用法是`for(var key in obj)`,这里`key`初始也是`undefined`的,`a[a.length]`整体也是`undefined`,所以二者其实是等价的。 在`for`循环中,`obj`的属性会依次赋值给`key`,同样,也依次赋值给`a[a.length]`,这里`length`一直在变,就巧妙地挨个赋值给数组的每一个元素了。
functiongetAttr(obj){ var a=[]; for(a[a.length] in obj); return a; } console.log(getAttr({'name':'zhangsan','age':'20'}));//输出:['name','age']
乍一看可能比较蒙,不过仔细分析还是不难理解的。常见用法是`for(var key in obj)`,这里`key`初始也是`undefined`的,`a[a.length]`整体也是`undefined`,所以二者其实是等价的。 在`for`循环中,`obj`的属性会依次赋值给`key`,同样,也依次赋值给`a[a.length]`,这里`length`一直在变,就巧妙地挨个赋值给数组的每一个元素了。
\ No newline at end of file
diff --git a/categories/index.html b/categories/index.html
index 9827b41c..f33c78de 100644
--- a/categories/index.html
+++ b/categories/index.html
@@ -1 +1 @@
-分类 | 云淡风轻
\ No newline at end of file
diff --git a/links/index.html b/links/index.html
index 4bed640e..446c55c8 100644
--- a/links/index.html
+++ b/links/index.html
@@ -1 +1 @@
-友情链接 | 云淡风轻
\ No newline at end of file
diff --git a/page/2/index.html b/page/2/index.html
index 7e7bc955..4cfd395f 100644
--- a/page/2/index.html
+++ b/page/2/index.html
@@ -1 +1 @@
-云淡风轻
\ No newline at end of file
diff --git a/repository/index.html b/repository/index.html
index 57725f4e..2335694b 100644
--- a/repository/index.html
+++ b/repository/index.html
@@ -1,4 +1,4 @@
-Repositories | 云淡风轻
\ No newline at end of file
diff --git a/tags/Comment-System/index.html b/tags/Comment-System/index.html
index 6ae098ca..bcb8b3d5 100644
--- a/tags/Comment-System/index.html
+++ b/tags/Comment-System/index.html
@@ -1 +1 @@
-标签: Comment System | 云淡风轻
\ No newline at end of file
diff --git a/tags/Media-Query/index.html b/tags/Media-Query/index.html
index 71bcbb1a..752429e6 100644
--- a/tags/Media-Query/index.html
+++ b/tags/Media-Query/index.html
@@ -1 +1 @@
-标签: Media Query | 云淡风轻
\ No newline at end of file
diff --git a/tags/MySql/index.html b/tags/MySql/index.html
index 014862ff..2e00b294 100644
--- a/tags/MySql/index.html
+++ b/tags/MySql/index.html
@@ -1 +1 @@
-标签: MySql | 云淡风轻
\ No newline at end of file
diff --git a/tags/index.html b/tags/index.html
index 8dbfeb26..c9358211 100644
--- a/tags/index.html
+++ b/tags/index.html
@@ -1 +1 @@
-标签 | 云淡风轻
\ No newline at end of file
diff --git a/tags/linux/index.html b/tags/linux/index.html
index 1d53bef1..e3374c13 100644
--- a/tags/linux/index.html
+++ b/tags/linux/index.html
@@ -1 +1 @@
-标签: linux | 云淡风轻