├── source ├── CNAME ├── README.md ├── tags │ └── index.md ├── images │ ├── happypack1.png │ ├── happypack-cache.png │ ├── happypack-eslint.png │ ├── chrome-stack-error.png │ ├── safari-loose-error.jpg │ └── safari-strict-error.jpg ├── _drafts │ ├── Promise的十个问题.md │ └── 如何从-nginx-查看response-body.md ├── _posts │ ├── git-找回删除的文件.md │ ├── 微软的8条人才评价标准.md │ ├── command-dev-null-2-1-表示什么意思?.md │ ├── 使用hexo在github上搭建博客.md │ ├── JavaScript-中的函数柯里化-Currying.md │ ├── too-many-open-files.md │ ├── 指定Python源文件编码-why-where-and-what.md │ ├── GNU-Readline-让命令行编辑倍速提升.md │ ├── javascript中的microtask与task.md │ ├── strategy-pattern.md │ ├── vue-new-instance.md │ └── nodejs-如何保证安装-node-modules-的一致性?.md └── sharing │ └── index.md ├── themes └── next │ ├── source │ ├── fonts │ │ └── .gitkeep │ ├── css │ │ ├── _mixins │ │ │ ├── Mist.styl │ │ │ ├── Muse.styl │ │ │ ├── custom.styl │ │ │ ├── Pisces.styl │ │ │ └── base.styl │ │ ├── _variables │ │ │ ├── Muse.styl │ │ │ ├── custom.styl │ │ │ ├── Mist.styl │ │ │ └── Pisces.styl │ │ ├── _custom │ │ │ └── custom.styl │ │ ├── _schemes │ │ │ ├── Mist │ │ │ │ ├── _logo.styl │ │ │ │ ├── outline │ │ │ │ │ └── outline.styl │ │ │ │ ├── sidebar │ │ │ │ │ └── sidebar-blogroll.styl │ │ │ │ ├── _search.styl │ │ │ │ ├── _base.styl │ │ │ │ ├── _menu.styl │ │ │ │ ├── _header.styl │ │ │ │ ├── _posts-expanded.styl │ │ │ │ └── index.styl │ │ │ ├── Pisces │ │ │ │ ├── _posts.styl │ │ │ │ ├── index.styl │ │ │ │ ├── _brand.styl │ │ │ │ ├── _menu.styl │ │ │ │ ├── _sidebar.styl │ │ │ │ └── _layout.styl │ │ │ └── Muse │ │ │ │ ├── sidebar │ │ │ │ └── sidebar-blogroll.styl │ │ │ │ ├── _search.styl │ │ │ │ ├── index.styl │ │ │ │ ├── _layout.styl │ │ │ │ ├── _logo.styl │ │ │ │ └── _menu.styl │ │ ├── _common │ │ │ ├── components │ │ │ │ ├── comments.styl │ │ │ │ ├── header │ │ │ │ │ ├── headerband.styl │ │ │ │ │ ├── header.styl │ │ │ │ │ ├── site-nav.styl │ │ │ │ │ ├── menu.styl │ │ │ │ │ └── site-meta.styl │ │ │ │ ├── tag-cloud.styl │ │ │ │ ├── pages │ │ │ │ │ ├── pages.styl │ │ │ │ │ ├── post-detail.styl │ │ │ │ │ ├── categories.styl │ │ │ │ │ ├── archive.styl │ │ │ │ │ └── schedule.styl │ │ │ │ ├── tags │ │ │ │ │ ├── tags.styl │ │ │ │ │ ├── full-image.styl │ │ │ │ │ ├── exturl.styl │ │ │ │ │ ├── group-pictures.styl │ │ │ │ │ ├── blockquote-center.styl │ │ │ │ │ └── note.styl │ │ │ │ ├── third-party │ │ │ │ │ ├── jiathis.styl │ │ │ │ │ ├── third-party.styl │ │ │ │ │ ├── baidushare.styl │ │ │ │ │ ├── gentie.styl │ │ │ │ │ ├── busuanzi-counter.styl │ │ │ │ │ ├── localsearch.styl │ │ │ │ │ └── algolia-search.styl │ │ │ │ ├── post │ │ │ │ │ ├── post-tags.styl │ │ │ │ │ ├── post-type.styl │ │ │ │ │ ├── post-copyright.styl │ │ │ │ │ ├── post-eof.styl │ │ │ │ │ ├── post-button.styl │ │ │ │ │ ├── post-gallery.styl │ │ │ │ │ ├── post-title.styl │ │ │ │ │ ├── post-nav.styl │ │ │ │ │ ├── post.styl │ │ │ │ │ ├── post-expand.styl │ │ │ │ │ ├── post-meta.styl │ │ │ │ │ ├── post-reward.styl │ │ │ │ │ └── post-collapse.styl │ │ │ │ ├── highlight │ │ │ │ │ ├── diff.styl │ │ │ │ │ └── theme.styl │ │ │ │ ├── sidebar │ │ │ │ │ ├── sidebar-blogroll.styl │ │ │ │ │ ├── sidebar-feed-link.styl │ │ │ │ │ ├── sidebar-author-links.styl │ │ │ │ │ ├── sidebar-toggle.styl │ │ │ │ │ ├── sidebar-author.styl │ │ │ │ │ ├── site-state.styl │ │ │ │ │ ├── sidebar-nav.styl │ │ │ │ │ ├── sidebar.styl │ │ │ │ │ └── sidebar-toc.styl │ │ │ │ ├── components.styl │ │ │ │ ├── back-to-top-sidebar.styl │ │ │ │ ├── footer │ │ │ │ │ └── footer.styl │ │ │ │ ├── back-to-top.styl │ │ │ │ ├── buttons.styl │ │ │ │ └── pagination.styl │ │ │ ├── scaffolding │ │ │ │ ├── scaffolding.styl │ │ │ │ ├── tables.styl │ │ │ │ ├── helpers.styl │ │ │ │ └── base.styl │ │ │ └── outline │ │ │ │ └── outline.styl │ │ └── main.styl │ ├── images │ │ ├── avatar.gif │ │ ├── loading.gif │ │ ├── searchicon.png │ │ ├── placeholder.gif │ │ ├── quote-r.svg │ │ └── quote-l.svg │ ├── lib │ │ ├── fancybox │ │ │ ├── source │ │ │ │ ├── blank.gif │ │ │ │ ├── fancybox_loading.gif │ │ │ │ ├── fancybox_overlay.png │ │ │ │ ├── fancybox_sprite.png │ │ │ │ ├── fancybox_loading@2x.gif │ │ │ │ ├── fancybox_sprite@2x.png │ │ │ │ └── helpers │ │ │ │ │ ├── fancybox_buttons.png │ │ │ │ │ ├── jquery.fancybox-thumbs.css │ │ │ │ │ └── jquery.fancybox-buttons.css │ │ │ ├── .gitattributes │ │ │ └── .bower.json │ │ ├── font-awesome │ │ │ ├── fonts │ │ │ │ ├── FontAwesome.otf │ │ │ │ ├── fontawesome-webfont.eot │ │ │ │ ├── fontawesome-webfont.ttf │ │ │ │ ├── fontawesome-webfont.woff │ │ │ │ └── fontawesome-webfont.woff2 │ │ │ ├── HELP-US-OUT.txt │ │ │ ├── .gitignore │ │ │ ├── bower.json │ │ │ ├── .npmignore │ │ │ └── .bower.json │ │ ├── fastclick │ │ │ ├── bower.json │ │ │ ├── .bower.json │ │ │ └── LICENSE │ │ ├── jquery │ │ │ └── .bower.json │ │ ├── jquery_lazyload │ │ │ ├── bower.json │ │ │ ├── .bower.json │ │ │ ├── CONTRIBUTING.md │ │ │ ├── README.md │ │ │ └── jquery.scrollstop.js │ │ ├── velocity │ │ │ ├── bower.json │ │ │ └── .bower.json │ │ └── canvas-nest │ │ │ └── canvas-nest.min.js │ └── js │ │ └── src │ │ ├── schemes │ │ └── pisces.js │ │ ├── bootstrap.js │ │ └── exturl.js │ ├── layout │ ├── _custom │ │ ├── header.swig │ │ └── sidebar.swig │ ├── _scripts │ │ ├── schemes │ │ │ ├── mist.swig │ │ │ ├── muse.swig │ │ │ └── pisces.swig │ │ ├── pages │ │ │ └── post-details.swig │ │ ├── boostrap.swig │ │ ├── commons.swig │ │ └── vendors.swig │ ├── _partials │ │ ├── head │ │ │ ├── custom-head.swig │ │ │ └── external-fonts.swig │ │ ├── search │ │ │ ├── tinysou.swig │ │ │ ├── swiftype.swig │ │ │ └── localsearch.swig │ │ ├── share │ │ │ ├── add-this.swig │ │ │ ├── duoshuo_share.swig │ │ │ ├── jiathis.swig │ │ │ └── baidushare.swig │ │ ├── pagination.swig │ │ ├── search.swig │ │ ├── page-header.swig │ │ ├── footer.swig │ │ ├── comments.swig │ │ └── header.swig │ ├── _third-party │ │ ├── search │ │ │ ├── index.swig │ │ │ ├── algolia-search │ │ │ │ ├── dom.swig │ │ │ │ └── assets.swig │ │ │ └── tinysou.swig │ │ ├── exturl.swig │ │ ├── duoshuo-hot-articles.swig │ │ ├── comments │ │ │ ├── index.swig │ │ │ ├── youyan.swig │ │ │ ├── gentie.swig │ │ │ ├── livere.swig │ │ │ ├── disqus.swig │ │ │ ├── hypercomments.swig │ │ │ ├── changyan.swig │ │ │ └── duoshuo.swig │ │ ├── analytics │ │ │ ├── cnzz-analytics.swig │ │ │ ├── index.swig │ │ │ ├── tencent-analytics.swig │ │ │ ├── baidu-analytics.swig │ │ │ ├── tencent-mta.swig │ │ │ ├── google-analytics.swig │ │ │ ├── facebook-sdk.swig │ │ │ ├── busuanzi-counter.swig │ │ │ ├── vkontakte-api.swig │ │ │ └── application-insights.swig │ │ ├── seo │ │ │ └── baidu-push.swig │ │ └── mathjax.swig │ ├── _macro │ │ ├── wechat-subscriber.swig │ │ ├── post-copyright.swig │ │ ├── reward.swig │ │ └── post-collapse.swig │ ├── schedule.swig │ ├── index.swig │ ├── tag.swig │ ├── category.swig │ ├── post.swig │ ├── page.swig │ ├── archive.swig │ └── _layout.swig │ ├── scripts │ ├── tags │ │ ├── note.js │ │ ├── center-quote.js │ │ ├── full-image.js │ │ ├── button.js │ │ └── exturl.js │ └── merge-configs.js │ ├── test │ ├── .jshintrc │ └── intern.js │ ├── package.json │ ├── LICENSE │ ├── languages │ ├── zh-Hans.yml │ └── en.yml │ └── README.md ├── scaffolds ├── draft.md ├── page.md └── post.md ├── .gitignore ├── README.md ├── package.json └── _config.yml /source/CNAME: -------------------------------------------------------------------------------- 1 | flyyang.me 2 | -------------------------------------------------------------------------------- /themes/next/source/fonts/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /themes/next/layout/_custom/header.swig: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /themes/next/source/css/_mixins/Mist.styl: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /themes/next/source/css/_mixins/Muse.styl: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /themes/next/source/css/_mixins/custom.styl: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /themes/next/source/css/_variables/Muse.styl: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /themes/next/layout/_custom/sidebar.swig: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /themes/next/layout/_scripts/schemes/mist.swig: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /themes/next/layout/_scripts/schemes/muse.swig: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /themes/next/source/css/_variables/custom.styl: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /scaffolds/draft.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: {{ title }} 3 | tags: 4 | --- 5 | -------------------------------------------------------------------------------- /themes/next/source/css/_custom/custom.styl: -------------------------------------------------------------------------------- 1 | // Custom styles. 2 | -------------------------------------------------------------------------------- /scaffolds/page.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: {{ title }} 3 | date: {{ date }} 4 | --- 5 | -------------------------------------------------------------------------------- /themes/next/layout/_partials/head/custom-head.swig: -------------------------------------------------------------------------------- 1 | {# 2 | Custom head. 3 | #} 4 | -------------------------------------------------------------------------------- /scaffolds/post.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: {{ title }} 3 | date: {{ date }} 4 | tags: 5 | --- 6 | -------------------------------------------------------------------------------- /themes/next/source/css/_schemes/Mist/_logo.styl: -------------------------------------------------------------------------------- 1 | .site-subtitle { display: none; } 2 | -------------------------------------------------------------------------------- /source/README.md: -------------------------------------------------------------------------------- 1 | # Read ME 2 | 3 | This is [my blog](https://flyyang.me) source code. 4 | -------------------------------------------------------------------------------- /themes/next/source/css/_common/components/comments.styl: -------------------------------------------------------------------------------- 1 | .comments { margin: 60px 20px 0; } 2 | -------------------------------------------------------------------------------- /themes/next/source/css/_schemes/Mist/outline/outline.styl: -------------------------------------------------------------------------------- 1 | .main-inner { margin-top: 80px; } 2 | -------------------------------------------------------------------------------- /source/tags/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: tags 3 | date: 2017-04-05 11:36:12 4 | type: "tags" 5 | --- 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | Thumbs.db 3 | db.json 4 | *.log 5 | node_modules/ 6 | public/ 7 | .deploy*/ 8 | -------------------------------------------------------------------------------- /source/images/happypack1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flyyang/blog/HEAD/source/images/happypack1.png -------------------------------------------------------------------------------- /source/images/happypack-cache.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flyyang/blog/HEAD/source/images/happypack-cache.png -------------------------------------------------------------------------------- /source/images/happypack-eslint.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flyyang/blog/HEAD/source/images/happypack-eslint.png -------------------------------------------------------------------------------- /source/images/chrome-stack-error.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flyyang/blog/HEAD/source/images/chrome-stack-error.png -------------------------------------------------------------------------------- /source/images/safari-loose-error.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flyyang/blog/HEAD/source/images/safari-loose-error.jpg -------------------------------------------------------------------------------- /source/images/safari-strict-error.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flyyang/blog/HEAD/source/images/safari-strict-error.jpg -------------------------------------------------------------------------------- /themes/next/source/images/avatar.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flyyang/blog/HEAD/themes/next/source/images/avatar.gif -------------------------------------------------------------------------------- /themes/next/source/images/loading.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flyyang/blog/HEAD/themes/next/source/images/loading.gif -------------------------------------------------------------------------------- /themes/next/source/css/_schemes/Pisces/_posts.styl: -------------------------------------------------------------------------------- 1 | .post-body { 2 | +mobile() { 3 | text-align: justify; 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /themes/next/source/images/searchicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flyyang/blog/HEAD/themes/next/source/images/searchicon.png -------------------------------------------------------------------------------- /themes/next/source/images/placeholder.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flyyang/blog/HEAD/themes/next/source/images/placeholder.gif -------------------------------------------------------------------------------- /themes/next/source/css/_schemes/Mist/sidebar/sidebar-blogroll.styl: -------------------------------------------------------------------------------- 1 | .links-of-blogroll-inline .links-of-blogroll-item { display: inline-block; } 2 | -------------------------------------------------------------------------------- /themes/next/source/css/_schemes/Muse/sidebar/sidebar-blogroll.styl: -------------------------------------------------------------------------------- 1 | .links-of-blogroll-inline .links-of-blogroll-item { display: inline-block; } 2 | -------------------------------------------------------------------------------- /themes/next/source/lib/fancybox/source/blank.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flyyang/blog/HEAD/themes/next/source/lib/fancybox/source/blank.gif -------------------------------------------------------------------------------- /themes/next/source/css/_common/components/header/headerband.styl: -------------------------------------------------------------------------------- 1 | .headband { 2 | height: $headband-height; 3 | background: $headband-bg; 4 | } 5 | -------------------------------------------------------------------------------- /themes/next/source/css/_schemes/Pisces/index.styl: -------------------------------------------------------------------------------- 1 | @import "_layout"; 2 | @import "_brand"; 3 | @import "_menu"; 4 | @import "_sidebar"; 5 | @import "_posts"; 6 | -------------------------------------------------------------------------------- /themes/next/source/lib/font-awesome/fonts/FontAwesome.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flyyang/blog/HEAD/themes/next/source/lib/font-awesome/fonts/FontAwesome.otf -------------------------------------------------------------------------------- /themes/next/layout/_third-party/search/index.swig: -------------------------------------------------------------------------------- 1 | {% include 'tinysou.swig' %} 2 | {% include 'localsearch.swig' %} 3 | {% include 'algolia-search/assets.swig' %} 4 | -------------------------------------------------------------------------------- /themes/next/source/css/_schemes/Mist/_search.styl: -------------------------------------------------------------------------------- 1 | // Search 2 | // -------------------------------------------------- 3 | .site-search form { 4 | display: none; 5 | } -------------------------------------------------------------------------------- /themes/next/source/css/_schemes/Muse/_search.styl: -------------------------------------------------------------------------------- 1 | // Search 2 | // -------------------------------------------------- 3 | .site-search form { 4 | display: none; 5 | } -------------------------------------------------------------------------------- /themes/next/source/lib/fancybox/source/fancybox_loading.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flyyang/blog/HEAD/themes/next/source/lib/fancybox/source/fancybox_loading.gif -------------------------------------------------------------------------------- /themes/next/source/lib/fancybox/source/fancybox_overlay.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flyyang/blog/HEAD/themes/next/source/lib/fancybox/source/fancybox_overlay.png -------------------------------------------------------------------------------- /themes/next/source/lib/fancybox/source/fancybox_sprite.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flyyang/blog/HEAD/themes/next/source/lib/fancybox/source/fancybox_sprite.png -------------------------------------------------------------------------------- /themes/next/layout/_partials/search/tinysou.swig: -------------------------------------------------------------------------------- 1 |
2 | 3 |
4 | -------------------------------------------------------------------------------- /themes/next/source/lib/fancybox/source/fancybox_loading@2x.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flyyang/blog/HEAD/themes/next/source/lib/fancybox/source/fancybox_loading@2x.gif -------------------------------------------------------------------------------- /themes/next/source/lib/fancybox/source/fancybox_sprite@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flyyang/blog/HEAD/themes/next/source/lib/fancybox/source/fancybox_sprite@2x.png -------------------------------------------------------------------------------- /themes/next/source/css/_common/components/tag-cloud.styl: -------------------------------------------------------------------------------- 1 | .tag-cloud { 2 | text-align: center; 3 | 4 | a { 5 | display: inline-block; 6 | margin: 10px; 7 | } 8 | } -------------------------------------------------------------------------------- /themes/next/source/lib/font-awesome/fonts/fontawesome-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flyyang/blog/HEAD/themes/next/source/lib/font-awesome/fonts/fontawesome-webfont.eot -------------------------------------------------------------------------------- /themes/next/source/lib/font-awesome/fonts/fontawesome-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flyyang/blog/HEAD/themes/next/source/lib/font-awesome/fonts/fontawesome-webfont.ttf -------------------------------------------------------------------------------- /themes/next/source/lib/fancybox/source/helpers/fancybox_buttons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flyyang/blog/HEAD/themes/next/source/lib/fancybox/source/helpers/fancybox_buttons.png -------------------------------------------------------------------------------- /themes/next/source/lib/font-awesome/fonts/fontawesome-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flyyang/blog/HEAD/themes/next/source/lib/font-awesome/fonts/fontawesome-webfont.woff -------------------------------------------------------------------------------- /themes/next/source/lib/font-awesome/fonts/fontawesome-webfont.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flyyang/blog/HEAD/themes/next/source/lib/font-awesome/fonts/fontawesome-webfont.woff2 -------------------------------------------------------------------------------- /source/_drafts/Promise的十个问题.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Promise的十个问题 3 | tags: 4 | --- 5 | # Promise 的十个问题 6 | 7 | 8 | 9 | 10 | > * [Promise A+](https://promisesaplus.com/) 11 | > * 12 | -------------------------------------------------------------------------------- /themes/next/source/css/_common/components/pages/pages.styl: -------------------------------------------------------------------------------- 1 | // Page specific styles 2 | 3 | @import "archive"; 4 | @import "categories"; 5 | @import "schedule"; 6 | @import "post-detail"; 7 | -------------------------------------------------------------------------------- /themes/next/layout/_third-party/exturl.swig: -------------------------------------------------------------------------------- 1 | {% if theme.exturl %} 2 | 3 | {% endif %} 4 | -------------------------------------------------------------------------------- /themes/next/source/css/_schemes/Muse/index.styl: -------------------------------------------------------------------------------- 1 | @import "_layout.styl"; 2 | @import "_logo.styl"; 3 | @import "_menu.styl"; 4 | @import "_search.styl"; 5 | @import "sidebar/sidebar-blogroll"; 6 | -------------------------------------------------------------------------------- /source/_drafts/如何从-nginx-查看response-body.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 如何从 nginx 查看 response body 3 | date: 2017-07-27 21:07:51 4 | tags: 5 | --- 6 | 7 | 总有一个原因让你想看一下 NGXINX 到底返回了什么。譬如我,界面没有返回数据,后端API 又有数据, 8 | -------------------------------------------------------------------------------- /themes/next/source/css/_common/components/pages/post-detail.styl: -------------------------------------------------------------------------------- 1 | .page-post-detail { 2 | 3 | .sidebar-toggle-line { background: $sidebar-highlight; } 4 | 5 | .comments { overflow: hidden; } 6 | } 7 | -------------------------------------------------------------------------------- /themes/next/source/css/_common/components/tags/tags.styl: -------------------------------------------------------------------------------- 1 | @import "full-image"; 2 | @import "blockquote-center"; 3 | @import "group-pictures"; 4 | @import "note"; 5 | @import "exturl" if hexo-config('exturl'); 6 | -------------------------------------------------------------------------------- /themes/next/source/css/_common/components/third-party/jiathis.styl: -------------------------------------------------------------------------------- 1 | .post-spread { 2 | margin-top: 20px; 3 | text-align: center; 4 | } 5 | 6 | .jiathis_style { 7 | display: inline-block; 8 | 9 | a { border: none; } 10 | } -------------------------------------------------------------------------------- /themes/next/source/css/_common/scaffolding/scaffolding.styl: -------------------------------------------------------------------------------- 1 | // 2 | // Scaffolding 3 | // ================================================= 4 | 5 | @import "normalize"; 6 | @import "base"; 7 | @import "helpers"; 8 | @import "tables"; 9 | -------------------------------------------------------------------------------- /themes/next/layout/_third-party/duoshuo-hot-articles.swig: -------------------------------------------------------------------------------- 1 | {# 多说热评文章 #} 2 | {% if (theme.duoshuo_hotartical and page.title) %} 3 |

热评文章

4 |
5 | {% endif %} 6 | -------------------------------------------------------------------------------- /themes/next/source/lib/fancybox/.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Denote all files that are truly binary and should not be modified. 5 | *.png binary 6 | *.jpg binary 7 | *.gif binary -------------------------------------------------------------------------------- /themes/next/source/css/_schemes/Muse/_layout.styl: -------------------------------------------------------------------------------- 1 | .header-inner, .container .main-inner, .footer-inner { 2 | +mobile() { width: auto; } 3 | } 4 | 5 | // embed tag 6 | embed { 7 | display: block; 8 | margin: 0px auto 25px auto; 9 | } 10 | -------------------------------------------------------------------------------- /themes/next/source/css/_common/components/header/header.styl: -------------------------------------------------------------------------------- 1 | .header { background: $head-bg; } 2 | 3 | .header-inner { position: relative; } 4 | 5 | 6 | @import "headerband"; 7 | @import "site-meta"; 8 | @import "site-nav"; 9 | @import "menu"; 10 | -------------------------------------------------------------------------------- /themes/next/source/css/_common/components/post/post-tags.styl: -------------------------------------------------------------------------------- 1 | .posts-expand .post-tags { 2 | margin-top: 40px; 3 | text-align: center; 4 | 5 | a { 6 | display: inline-block; 7 | margin-right: 10px; 8 | font-size: 13px; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /themes/next/source/lib/fastclick/bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "fastclick", 3 | "main": "lib/fastclick.js", 4 | "ignore": [ 5 | "**/.*", 6 | "component.json", 7 | "package.json", 8 | "Makefile", 9 | "tests", 10 | "examples" 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /themes/next/layout/_scripts/pages/post-details.swig: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /themes/next/layout/_third-party/comments/index.swig: -------------------------------------------------------------------------------- 1 | {% include 'duoshuo.swig' %} 2 | {% include 'disqus.swig' %} 3 | {% include 'hypercomments.swig' %} 4 | {% include 'gentie.swig' %} 5 | {% include 'youyan.swig' %} 6 | {% include 'livere.swig' %} 7 | {% include 'changyan.swig' %} 8 | -------------------------------------------------------------------------------- /themes/next/layout/_scripts/boostrap.swig: -------------------------------------------------------------------------------- 1 | {% 2 | set boot_scripts = [ 3 | 'src/bootstrap.js' 4 | ] 5 | %} 6 | 7 | {% for bs in boot_scripts %} 8 | 9 | {% endfor %} 10 | -------------------------------------------------------------------------------- /themes/next/source/css/_common/components/third-party/third-party.styl: -------------------------------------------------------------------------------- 1 | @import "duoshuo"; 2 | @import "gentie"; 3 | @import "jiathis"; 4 | @import "baidushare"; 5 | @import "localsearch"; 6 | @import "busuanzi-counter"; 7 | @import "algolia-search" if hexo-config('algolia_search.enable'); 8 | -------------------------------------------------------------------------------- /themes/next/layout/_third-party/analytics/cnzz-analytics.swig: -------------------------------------------------------------------------------- 1 | {% if theme.cnzz_siteid %} 2 | 3 |
4 | 5 |
6 | 7 | {% endif %} 8 | -------------------------------------------------------------------------------- /themes/next/source/css/_common/components/third-party/baidushare.styl: -------------------------------------------------------------------------------- 1 | .post-spread { 2 | margin-top: 20px; 3 | text-align: center; 4 | } 5 | 6 | .bdshare-slide-button-box a { border: none; } 7 | 8 | .bdsharebuttonbox { 9 | display: inline-block; 10 | 11 | a { border: none; } 12 | } 13 | -------------------------------------------------------------------------------- /themes/next/layout/_scripts/commons.swig: -------------------------------------------------------------------------------- 1 | {% 2 | set js_commons = [ 3 | 'src/utils.js', 4 | 'src/motion.js' 5 | ] 6 | %} 7 | 8 | {% for common in js_commons %} 9 | 10 | {% endfor %} 11 | -------------------------------------------------------------------------------- /themes/next/layout/_partials/share/add-this.swig: -------------------------------------------------------------------------------- 1 | 2 |
3 | 4 |
5 | -------------------------------------------------------------------------------- /themes/next/source/css/_common/components/highlight/diff.styl: -------------------------------------------------------------------------------- 1 | $highlight_theme = hexo-config("highlight_theme") 2 | 3 | if $highlight_theme == "normal" 4 | $highlight-deletion = #fdd 5 | $highlight-addition = #dfd 6 | else 7 | $highlight-deletion = #008000 8 | $highlight-addition = #800000 9 | -------------------------------------------------------------------------------- /themes/next/layout/_scripts/schemes/pisces.swig: -------------------------------------------------------------------------------- 1 | {% 2 | set scripts = [ 3 | 'src/affix.js', 4 | 'src/schemes/pisces.js' 5 | ] 6 | %} 7 | 8 | {% for script in scripts %} 9 | 10 | {% endfor %} 11 | -------------------------------------------------------------------------------- /themes/next/source/css/_schemes/Mist/_base.styl: -------------------------------------------------------------------------------- 1 | // Tags 2 | // -------------------------------------------------- 3 | h1, h2, h3, h4, h5, h6 { margin: 20px 0 10px; } 4 | 5 | p { margin: 0 0 25px 0; } 6 | 7 | a { border-bottom-color: $grey-light; } 8 | 9 | hr { 10 | margin: 20px 0; 11 | height: 2px; 12 | } 13 | -------------------------------------------------------------------------------- /themes/next/source/css/_common/components/post/post-type.styl: -------------------------------------------------------------------------------- 1 | // TODO: Refactor. 2 | 3 | .page-home, .page-post-detail { 4 | .post-type-quote { 5 | .post-header, 6 | .post-tags { 7 | display: none; 8 | } 9 | 10 | blockquote { 11 | @extend .blockquote-center 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /themes/next/source/css/_common/components/post/post-copyright.styl: -------------------------------------------------------------------------------- 1 | .post-copyright { 2 | margin: $post-copyright.margin; 3 | padding: $post-copyright.padding; 4 | border-left: $post-copyright.border.width $post-copyright.border.style $post-copyright.border.color; 5 | background-color: $post-copyright.bg; 6 | list-style: none; 7 | } 8 | -------------------------------------------------------------------------------- /themes/next/layout/_partials/pagination.swig: -------------------------------------------------------------------------------- 1 | {% if page.prev or page.next %} 2 | 11 | {% endif %} 12 | -------------------------------------------------------------------------------- /themes/next/layout/_third-party/analytics/index.swig: -------------------------------------------------------------------------------- 1 | {% include 'facebook-sdk.swig' %} 2 | {% include 'vkontakte-api.swig' %} 3 | {% include 'google-analytics.swig' %} 4 | {% include 'baidu-analytics.swig' %} 5 | {% include 'tencent-analytics.swig' %} 6 | {% include 'tencent-mta.swig' %} 7 | {% include 'cnzz-analytics.swig' %} 8 | {% include 'application-insights.swig' %} 9 | -------------------------------------------------------------------------------- /themes/next/source/css/_common/components/third-party/gentie.styl: -------------------------------------------------------------------------------- 1 | .cloud-tie-wrapper { 2 | img { 3 | display: inline-block; 4 | } 5 | 6 | .total-txt { 7 | font-size: 1em !important; 8 | } 9 | } 10 | 11 | .cloud-tie-join-count .join-count { 12 | color: #555 !important; 13 | font-size: inherit !important; 14 | margin: 0 !important; 15 | } 16 | -------------------------------------------------------------------------------- /themes/next/source/lib/font-awesome/HELP-US-OUT.txt: -------------------------------------------------------------------------------- 1 | I hope you love Font Awesome. If you've found it useful, please do me a favor and check out my latest project, 2 | Fort Awesome (https://fortawesome.com). It makes it easy to put the perfect icons on your website. Choose from our awesome, 3 | comprehensive icon sets or copy and paste your own. 4 | 5 | Please. Check it out. 6 | 7 | -Dave Gandy 8 | -------------------------------------------------------------------------------- /themes/next/source/css/_common/components/sidebar/sidebar-blogroll.styl: -------------------------------------------------------------------------------- 1 | .links-of-blogroll { font-size: 13px; } 2 | 3 | .links-of-blogroll-title { 4 | margin-top: 20px; 5 | font-size: 14px; 6 | font-weight: $font-weight-bold; 7 | } 8 | .links-of-blogroll-list { 9 | margin: 0; 10 | padding: 0; 11 | list-style: none; 12 | } 13 | 14 | .links-of-blogroll-item { padding: 2px 10px; } 15 | -------------------------------------------------------------------------------- /themes/next/source/css/_mixins/Pisces.styl: -------------------------------------------------------------------------------- 1 | sidebar-inline-links-item() { 2 | float: left; 3 | margin: 5px 0 0; 4 | width: 50%; 5 | 6 | & a { 7 | box-sizing: border-box; 8 | display: inline-block; 9 | margin-right: 0; 10 | margin-bottom: 0; 11 | padding: 0 5px; 12 | overflow: hidden; 13 | white-space: nowrap; 14 | text-overflow: ellipsis; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /themes/next/layout/_partials/search.swig: -------------------------------------------------------------------------------- 1 | {% if theme.algolia_search.enable %} 2 | {% include '../_third-party/search/algolia-search/dom.swig' %} 3 | {% elseif theme.swiftype_key %} 4 | {% include 'search/swiftype.swig' %} 5 | {% elseif theme.tinysou_Key %} 6 | {% include 'search/tinysou.swig' %} 7 | {% elseif theme.local_search.enable %} 8 | {% include 'search/localsearch.swig' %} 9 | {% endif %} 10 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Source code for my blog: [https://flyyang.me](https://flyyang.me) 2 | 3 | ## Setup 4 | 5 | 1. Install deps 6 | 7 | ``` 8 | npm install 9 | ``` 10 | 11 | 2. Run server 12 | 13 | ``` 14 | # This step is optional 15 | hexo server 16 | ``` 17 | 18 | 3. Write post 19 | 20 | ``` 21 | hexo new post "your-post-name" 22 | ``` 23 | 24 | 4. Deploy to github 25 | 26 | ``` 27 | npm run deploy 28 | ``` 29 | -------------------------------------------------------------------------------- /themes/next/layout/_partials/page-header.swig: -------------------------------------------------------------------------------- 1 |
2 | 3 | <{% if theme.seo %}h2{% else %}h1{% endif %} class="post-title" itemprop="name headline">{{ page.title }} 4 | 5 | {% if page.description %} 6 |
7 |
{{ page.description }}
8 |
9 | {% endif %} 10 | 11 |
12 | -------------------------------------------------------------------------------- /themes/next/source/css/_common/components/post/post-eof.styl: -------------------------------------------------------------------------------- 1 | .posts-expand { 2 | .post-eof { 3 | display: block; 4 | margin: $post-eof-margin-top auto $post-eof-margin-bottom; 5 | width: 8%; 6 | height: 1px; 7 | background: $grey-light; 8 | text-align: center; 9 | } 10 | } 11 | 12 | 13 | .post:last-child { 14 | .post-eof.post-eof.post-eof { 15 | display: none; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /themes/next/source/css/_common/components/tags/full-image.styl: -------------------------------------------------------------------------------- 1 | // Expand image to 126% with nagative margin-left/right on Desktop. 2 | .full-image.full-image.full-image { 3 | border: none; 4 | max-width: 100%; 5 | width: auto; 6 | margin: 20px auto; 7 | +desktop() { 8 | max-width: none; 9 | width: $full-image-width; 10 | margin: $full-image-margin-vertical $full-image-margin-horizontal; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /themes/next/source/css/_common/components/components.styl: -------------------------------------------------------------------------------- 1 | @import "highlight"; 2 | @import "tags"; 3 | 4 | @import "buttons"; 5 | @import "pagination"; 6 | @import "comments"; 7 | @import "tag-cloud"; 8 | @import hexo-config('sidebar.b2t') ? "back-to-top-sidebar" : "back-to-top"; 9 | 10 | @import "header"; 11 | @import "post"; 12 | @import "sidebar"; 13 | @import "footer"; 14 | @import "third-party"; 15 | 16 | @import "pages"; 17 | -------------------------------------------------------------------------------- /themes/next/source/css/_variables/Mist.styl: -------------------------------------------------------------------------------- 1 | // Variables of Mist scheme 2 | // ================================================= 3 | 4 | $font-size-headings-base = 26px 5 | 6 | $brand-color = $black-deep 7 | $brand-hover-color = $brand-color 8 | 9 | $site-meta-text-align = left 10 | $posts-collapse-left = 0 11 | 12 | $read-more-color = $link-color 13 | $read-more-bg-color = transparent 14 | -------------------------------------------------------------------------------- /themes/next/layout/_third-party/analytics/tencent-analytics.swig: -------------------------------------------------------------------------------- 1 | {% if theme.tencent_analytics %} 2 | 10 | {% endif %} 11 | -------------------------------------------------------------------------------- /themes/next/layout/_macro/wechat-subscriber.swig: -------------------------------------------------------------------------------- 1 | {% if theme.wechat_subscriber.enabled %} 2 |
3 | {{ theme.author }} wechat 4 |
{{ theme.wechat_subscriber.description }}
5 |
6 | {% endif %} 7 | -------------------------------------------------------------------------------- /themes/next/scripts/tags/note.js: -------------------------------------------------------------------------------- 1 | /* global hexo */ 2 | // Class: default, primary, success, info, warning, danger 3 | // Usage: {% note class %} Content {% endnote %} 4 | 5 | function bscallOut (args, content) { 6 | return '
' + 7 | hexo.render.renderSync({text: content, engine: 'markdown'}) + 8 | '
'; 9 | } 10 | 11 | hexo.extend.tag.register('note', bscallOut, {ends: true}); 12 | -------------------------------------------------------------------------------- /themes/next/source/css/_schemes/Muse/_logo.styl: -------------------------------------------------------------------------------- 1 | .custom-logo { 2 | .site-meta-headline { text-align: center; } 3 | 4 | .brand { background: none; } 5 | 6 | .site-title { 7 | margin: 10px auto 0; 8 | font-size: 24px; 9 | color: $black-deep; 10 | a { border: none; } 11 | } 12 | 13 | 14 | } 15 | 16 | .custom-logo-image { 17 | margin: 0 auto; 18 | padding: 5px; 19 | max-width: 150px; 20 | background: white; 21 | } 22 | -------------------------------------------------------------------------------- /themes/next/layout/_third-party/analytics/baidu-analytics.swig: -------------------------------------------------------------------------------- 1 | {% if theme.baidu_analytics %} 2 | 11 | {% endif %} 12 | -------------------------------------------------------------------------------- /themes/next/scripts/merge-configs.js: -------------------------------------------------------------------------------- 1 | /* global hexo */ 2 | 3 | var merge = require('./merge'); 4 | 5 | /** 6 | * Merge configs in _data/next.yml into hexo.theme.config. 7 | * Note: configs in _data/next.yml will override configs in hexo.theme.config. 8 | */ 9 | hexo.on('generateBefore', function () { 10 | if (hexo.locals.get) { 11 | var data = hexo.locals.get('data'); 12 | data && data.next && merge(hexo.theme.config, data.next); 13 | } 14 | }); 15 | -------------------------------------------------------------------------------- /themes/next/source/lib/fancybox/.bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "fancybox", 3 | "homepage": "https://github.com/fancyapps/fancyBox", 4 | "version": "2.1.5", 5 | "_release": "2.1.5", 6 | "_resolution": { 7 | "type": "version", 8 | "tag": "v2.1.5", 9 | "commit": "18d171278d21ca59067aace6d52a1adeb6462219" 10 | }, 11 | "_source": "git://github.com/fancyapps/fancyBox.git", 12 | "_target": "~2.1.5", 13 | "_originalSource": "fancybox", 14 | "_direct": true 15 | } -------------------------------------------------------------------------------- /themes/next/test/.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "curly": true, 3 | "eqnull": true, 4 | "eqeqeq": true, 5 | "undef": true, 6 | "newcap": true, 7 | "unused": true, 8 | "laxcomma": false, 9 | "asi": false, 10 | "expr": true, 11 | "loopfunc": false, 12 | "strict": false, 13 | 14 | "globals": { 15 | "define": true, 16 | "require": true, 17 | "it": true, 18 | "module": true, 19 | "describe": true, 20 | "window": true, 21 | "$": true 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /themes/next/source/css/_common/components/post/post-button.styl: -------------------------------------------------------------------------------- 1 | .post-button { 2 | margin-top: 50px; 3 | 4 | .btn { 5 | color: $read-more-color; 6 | font-size: $read-more-font-size; 7 | background: $read-more-bg-color; 8 | border-radius: $read-more-border-radius; 9 | line-height: 2; 10 | margin: 0 4px 8px 4px; 11 | } 12 | .btn:hover { 13 | @extend .btn:hover; 14 | } 15 | .fa-fw { 16 | width: (18em / 14); 17 | text-align: left; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /themes/next/source/lib/font-awesome/.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | *.egg-info 3 | *.db 4 | *.db.old 5 | *.swp 6 | *.db-journal 7 | 8 | .coverage 9 | .DS_Store 10 | .installed.cfg 11 | _gh_pages/* 12 | 13 | .idea/* 14 | .svn/* 15 | src/website/static/* 16 | src/website/media/* 17 | 18 | bin 19 | cfcache 20 | develop-eggs 21 | dist 22 | downloads 23 | eggs 24 | parts 25 | tmp 26 | .sass-cache 27 | node_modules 28 | 29 | src/website/settingslocal.py 30 | stunnel.log 31 | 32 | .ruby-version 33 | .bundle 34 | -------------------------------------------------------------------------------- /themes/next/layout/_third-party/analytics/tencent-mta.swig: -------------------------------------------------------------------------------- 1 | {% if theme.tencent_mta %} 2 | 14 | {% endif %} -------------------------------------------------------------------------------- /themes/next/source/css/_common/components/tags/exturl.styl: -------------------------------------------------------------------------------- 1 | .exturl { 2 | // Remove the gray background color from active links in IE 10. 3 | background-color: transparent; 4 | 5 | cursor: pointer; 6 | border-bottom: 1px solid #999; 7 | 8 | .fa { 9 | font-size: 14px; 10 | } 11 | } 12 | 13 | // Improve readability when focused and also mouse hovered in all browsers. 14 | .exturl:active, .exturl:hover { 15 | outline: 0; 16 | color: $black-deep; 17 | border-bottom-color: $black-deep; 18 | } 19 | -------------------------------------------------------------------------------- /themes/next/layout/schedule.swig: -------------------------------------------------------------------------------- 1 | {% extends '_layout.swig' %} 2 | {% import '_macro/sidebar.swig' as sidebar_template %} 3 | 4 | {% block title %} {{ __('title.schedule') }} | {{ config.title }} {% endblock %} 5 | 6 | {% block page_class %}page-post-detail page-calendar{% endblock %} 7 | 8 | {% block content %} 9 |
10 | 12 |
13 | {% endblock %} 14 | 15 | {% block sidebar %} 16 | {{ sidebar_template.render(false) }} 17 | {% endblock %} 18 | -------------------------------------------------------------------------------- /themes/next/scripts/tags/center-quote.js: -------------------------------------------------------------------------------- 1 | /* global hexo */ 2 | // Usage: {% centerquote %} Something {% endcenterquote %} 3 | // Alias: {% cq %} Something {% endcq %} 4 | 5 | function centerQuote (args, content) { 6 | return '
' + 7 | hexo.render.renderSync({text: content, engine: 'markdown'}) + 8 | '
'; 9 | } 10 | 11 | hexo.extend.tag.register('centerquote', centerQuote, {ends: true}); 12 | hexo.extend.tag.register('cq', centerQuote, {ends: true}); 13 | -------------------------------------------------------------------------------- /themes/next/source/lib/jquery/.bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jquery", 3 | "_cacheHeaders": { 4 | "ETag": "\"5492efef-14960\"", 5 | "Last-Modified": "Thu, 18 Dec 2014 15:17:03 GMT", 6 | "Content-Length": "84320", 7 | "Content-Type": "application/x-javascript" 8 | }, 9 | "_release": "e-tag:5492efef-", 10 | "main": "index.js", 11 | "_source": "http://code.jquery.com/jquery-2.1.3.min.js", 12 | "_target": "*", 13 | "_originalSource": "http://code.jquery.com/jquery-2.1.3.min.js", 14 | "_direct": true 15 | } -------------------------------------------------------------------------------- /themes/next/source/css/_common/components/sidebar/sidebar-feed-link.styl: -------------------------------------------------------------------------------- 1 | .feed-link { 2 | margin-top: 20px; 3 | 4 | a { 5 | display: inline-block; 6 | padding: 0 15px; 7 | color: rgb(252, 100, 35); 8 | border: 1px solid rgb(252, 100, 35); 9 | border-radius: 4px; 10 | 11 | i { 12 | color: rgb(252, 100, 35); 13 | font-size: 14px; 14 | } 15 | 16 | &:hover { 17 | color:white; 18 | background: rgb(252, 100, 35); 19 | 20 | i { color: white; } 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /themes/next/source/lib/font-awesome/bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "font-awesome", 3 | "description": "Font Awesome", 4 | "keywords": [], 5 | "homepage": "http://fontawesome.io", 6 | "dependencies": {}, 7 | "devDependencies": {}, 8 | "license": ["OFL-1.1", "MIT", "CC-BY-3.0"], 9 | "main": [ 10 | "less/font-awesome.less", 11 | "scss/font-awesome.scss" 12 | ], 13 | "ignore": [ 14 | "*/.*", 15 | "*.json", 16 | "src", 17 | "*.yml", 18 | "Gemfile", 19 | "Gemfile.lock", 20 | "*.md" 21 | ] 22 | } 23 | -------------------------------------------------------------------------------- /themes/next/layout/_third-party/analytics/google-analytics.swig: -------------------------------------------------------------------------------- 1 | {% if theme.google_analytics %} 2 | 10 | {% endif %} -------------------------------------------------------------------------------- /themes/next/layout/_third-party/seo/baidu-push.swig: -------------------------------------------------------------------------------- 1 | {% if theme.baidu_push %} 2 | 16 | {% endif %} 17 | -------------------------------------------------------------------------------- /themes/next/layout/_third-party/comments/youyan.swig: -------------------------------------------------------------------------------- 1 | {% if not (theme.duoshuo and theme.duoshuo.shortname) 2 | and not theme.duoshuo_shortname 3 | and not theme.disqus_shortname 4 | and not theme.hypercomments_id 5 | and not theme.gentie_productKey %} 6 | 7 | {% if theme.youyan_uid %} 8 | {% set uid = theme.youyan_uid %} 9 | 10 | {% if page.comments %} 11 | 12 | 13 | 14 | {% endif %} 15 | {% endif %} 16 | 17 | {% endif %} 18 | -------------------------------------------------------------------------------- /themes/next/source/css/_common/components/post/post-gallery.styl: -------------------------------------------------------------------------------- 1 | .post-gallery { 2 | display: table; 3 | table-layout: fixed; 4 | width: 100%; 5 | border-collapse: separate; 6 | } 7 | 8 | .post-gallery-row { display: table-row; } 9 | 10 | .post-gallery .post-gallery-img { 11 | display: table-cell; 12 | text-align: center; 13 | vertical-align: middle; 14 | border: none; 15 | } 16 | 17 | .post-gallery .post-gallery-img img { 18 | max-width: 100%; 19 | max-height: 100%; 20 | border: none; 21 | } 22 | 23 | .fancybox-close, .fancybox-close:hover { border: none; } 24 | -------------------------------------------------------------------------------- /themes/next/source/css/_common/components/back-to-top-sidebar.styl: -------------------------------------------------------------------------------- 1 | .back-to-top { 2 | display: none; 3 | margin: 15px -10px -20px; 4 | background: $body-bg-color; 5 | font-size: $b2t-font-size; 6 | opacity: $b2t-opacity; 7 | cursor: pointer; 8 | text-align: center; 9 | -webkit-transform: translateZ(0); 10 | transition-property: bottom; 11 | the-transition(); 12 | &:hover { opacity: 0.8; } 13 | 14 | +mobile() { 15 | display: none; 16 | } 17 | +tablet() { 18 | display: none; 19 | } 20 | 21 | &.back-to-top-on { 22 | display: block; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /themes/next/source/css/_schemes/Pisces/_brand.styl: -------------------------------------------------------------------------------- 1 | .site-brand-wrapper { 2 | position: relative; 3 | } 4 | 5 | .site-meta { 6 | padding: 20px 0; 7 | color: white; 8 | background: $black-deep; 9 | 10 | +tablet() { 11 | box-shadow: 0 0 16px rgba(0,0,0,0.5); 12 | } 13 | +mobile() { 14 | box-shadow: 0 0 16px rgba(0,0,0,0.5); 15 | } 16 | } 17 | 18 | .brand { 19 | padding: 0; 20 | background: none; 21 | 22 | &:hover { color: white; } 23 | } 24 | 25 | .site-subtitle { 26 | margin: 10px 10px 0; 27 | font-weight: initial; 28 | } 29 | 30 | .site-search form { display: none; } 31 | -------------------------------------------------------------------------------- /themes/next/layout/_partials/search/swiftype.swig: -------------------------------------------------------------------------------- 1 |
2 | 3 |
4 | 5 | 13 | -------------------------------------------------------------------------------- /themes/next/source/css/_common/components/pages/categories.styl: -------------------------------------------------------------------------------- 1 | .category-all-page { 2 | .category-all-title { text-align: center; } 3 | 4 | .category-all { margin-top: 20px; } 5 | 6 | .category-list { 7 | margin: 0; 8 | padding: 0; 9 | list-style: none; 10 | } 11 | 12 | .category-list-item { margin: 5px 10px; } 13 | 14 | .category-list-count { 15 | color: $grey; 16 | &:before { 17 | display: inline; 18 | content: " (" 19 | } 20 | &:after { 21 | display: inline; 22 | content: ") " 23 | } 24 | } 25 | 26 | .category-list-child { padding-left: 10px; } 27 | } 28 | -------------------------------------------------------------------------------- /themes/next/source/js/src/schemes/pisces.js: -------------------------------------------------------------------------------- 1 | $(document).ready(function () { 2 | var $headerInner = $('.header-inner'); 3 | var $sidebar = $('#sidebar'); 4 | var getSidebarTop = function(){ 5 | return $headerInner.height() + CONFIG.sidebar.offset; 6 | }; 7 | var setSidebarMarginTop = function(sidebarTop){ 8 | return $sidebar.css({ 'margin-top': sidebarTop }); 9 | }; 10 | var mql = window.matchMedia('(min-width: 991px)'); 11 | setSidebarMarginTop(getSidebarTop()).show(); 12 | mql.addListener(function(e){ 13 | if(e.matches){ 14 | setSidebarMarginTop(getSidebarTop()); 15 | } 16 | }); 17 | }); 18 | -------------------------------------------------------------------------------- /themes/next/source/css/_common/components/third-party/busuanzi-counter.styl: -------------------------------------------------------------------------------- 1 | if hexo-config("scheme") == Pisces 2 | .busuanzi-count { 3 | +tablet() { 4 | width: auto; 5 | } 6 | +mobile() { 7 | width: auto; 8 | } 9 | } 10 | 11 | .site-uv, 12 | .site-pv, 13 | .page-pv { 14 | display: inline-block; 15 | 16 | .busuanzi-value { 17 | margin: 0 5px; 18 | } 19 | } 20 | 21 | if hexo-config("busuanzi_count.site_pv") and hexo-config("busuanzi_count.site_uv") 22 | .site-uv 23 | { 24 | margin-right: 10px; 25 | 26 | &::after { 27 | content: "|"; 28 | padding-left: 10px; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /themes/next/source/css/_common/components/sidebar/sidebar-author-links.styl: -------------------------------------------------------------------------------- 1 | .links-of-author { margin-top: 20px; } 2 | 3 | .links-of-author a { 4 | display: inline-block; 5 | vertical-align: middle; 6 | margin-right: 10px; 7 | margin-bottom: 10px; 8 | border-bottom-color: $black-light; 9 | font-size: 13px; 10 | 11 | &:before { 12 | display: inline-block; 13 | vertical-align: middle; 14 | margin-right: 3px; 15 | content: " "; 16 | width: 4px; 17 | height: 4px; 18 | border-radius: 50%; 19 | background: rgb(random-color(0, 255) - 50%, random-color(0, 255) - 50%, random-color(0, 255) - 50%); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /themes/next/source/css/_common/components/header/site-nav.styl: -------------------------------------------------------------------------------- 1 | .site-nav-toggle { 2 | display: none; 3 | position: absolute; 4 | top: 10px; 5 | left: 10px; 6 | +mobile() { 7 | display: block; 8 | } 9 | 10 | button { 11 | margin-top: 2px; 12 | padding: 9px 10px; 13 | background: transparent; 14 | border: none; 15 | } 16 | } 17 | 18 | .site-nav { 19 | +mobile() { 20 | display: none; 21 | margin: 0 -10px; 22 | padding: 0 10px; 23 | clear: both; 24 | border-top: 1px solid $gray-lighter; 25 | } 26 | +tablet() { display: block !important; } 27 | +desktop() { display: block !important; } 28 | } 29 | -------------------------------------------------------------------------------- /themes/next/source/css/_common/components/pages/archive.styl: -------------------------------------------------------------------------------- 1 | .use-motion { 2 | .post { opacity: 0; } 3 | } 4 | 5 | .page-archive { 6 | 7 | .archive-page-counter { 8 | position: relative; 9 | top: 3px; 10 | left: 20px; 11 | 12 | +mobile() { 13 | top: 5px; 14 | } 15 | } 16 | 17 | .posts-collapse { 18 | 19 | .archive-move-on { 20 | position: absolute; 21 | top: 11px; 22 | left: 0; 23 | margin-left: -6px; 24 | width: 10px; 25 | height: 10px; 26 | opacity: 0.5; 27 | background: $black-light; 28 | border: 1px solid white; 29 | 30 | circle(); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /themes/next/source/lib/fastclick/.bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "fastclick", 3 | "main": "lib/fastclick.js", 4 | "ignore": [ 5 | "**/.*", 6 | "component.json", 7 | "package.json", 8 | "Makefile", 9 | "tests", 10 | "examples" 11 | ], 12 | "homepage": "https://github.com/ftlabs/fastclick", 13 | "version": "1.0.6", 14 | "_release": "1.0.6", 15 | "_resolution": { 16 | "type": "version", 17 | "tag": "v1.0.6", 18 | "commit": "2ac7258407619398005ca720596f0d36ce66a6c8" 19 | }, 20 | "_source": "git://github.com/ftlabs/fastclick.git", 21 | "_target": "~1.0.6", 22 | "_originalSource": "fastclick", 23 | "_direct": true 24 | } -------------------------------------------------------------------------------- /themes/next/source/lib/font-awesome/.npmignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | *.egg-info 3 | *.db 4 | *.db.old 5 | *.swp 6 | *.db-journal 7 | 8 | .coverage 9 | .DS_Store 10 | .installed.cfg 11 | _gh_pages/* 12 | 13 | .idea/* 14 | .svn/* 15 | src/website/static/* 16 | src/website/media/* 17 | 18 | bin 19 | cfcache 20 | develop-eggs 21 | dist 22 | downloads 23 | eggs 24 | parts 25 | tmp 26 | .sass-cache 27 | node_modules 28 | 29 | src/website/settingslocal.py 30 | stunnel.log 31 | 32 | .ruby-version 33 | 34 | # don't need these in the npm package. 35 | src/ 36 | _config.yml 37 | bower.json 38 | component.json 39 | composer.json 40 | CONTRIBUTING.md 41 | Gemfile 42 | Gemfile.lock 43 | -------------------------------------------------------------------------------- /source/_posts/git-找回删除的文件.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: git 找回删除的文件 3 | date: 2017-05-24 16:50:56 4 | tags: git 5 | --- 6 | 误删除的文件可以被恢复,前提是在此之前进行过 `git add` 或者 `git stash` 操作。否则你就需要找对应的IDE或编辑器(甚至文件系统)的备份了。 7 | 8 | 通过以下两步可以找回 `git add (stash)` 的文件: 9 | 10 | 11 | 12 | 第一步: 13 | 14 | ``` 15 | git fsck --lost-found 16 | ``` 17 | 18 | 此操作会获取所有 `git add(stash)` 操作生成的 id 。 19 | 20 | 第二步: 21 | 22 | ``` 23 | git show 24 | ``` 25 | 26 | 显示所有相关的文件到控制台。这样就找回了你所提交的文件。 27 | 28 | 从此过程中我们学习到:**时常 `add` 本地改动是一个好的习惯**。 29 | 30 | > [recover from added file](https://stackoverflow.com/questions/23728769/how-to-recover-files-added-to-git-but-overwritten-by-checkout) 31 | --- 32 | -------------------------------------------------------------------------------- /themes/next/layout/_third-party/comments/gentie.swig: -------------------------------------------------------------------------------- 1 | {% if not (theme.duoshuo and theme.duoshuo.shortname) and not theme.duoshuo_shortname and not theme.disqus_shortname and not theme.hypercomments_id %} 2 | 3 | {% if theme.gentie_productKey %} 4 | {% set gentie_productKey = theme.gentie_productKey %} 5 | 13 | 14 | {% endif %} 15 | 16 | {% endif %} 17 | -------------------------------------------------------------------------------- /themes/next/source/css/_schemes/Muse/_menu.styl: -------------------------------------------------------------------------------- 1 | .site-nav { 2 | +mobile() { 3 | position: absolute; 4 | left: 0; 5 | top: 52px; 6 | margin: 0; 7 | width: 100%; 8 | padding: 0; 9 | background: white; 10 | border-bottom: 1px solid $gray-lighter; 11 | z-index: 1; 12 | } 13 | } 14 | 15 | .menu { 16 | +mobile() { text-align: left; } 17 | } 18 | .menu .menu-item { 19 | +mobile() { 20 | display: block; 21 | margin: 0 10px; 22 | vertical-align: top; 23 | } 24 | 25 | br { 26 | +mobile() { display: none; } 27 | } 28 | 29 | a { 30 | +mobile() { padding: 5px 10px; } 31 | } 32 | .fa { margin-right: 0; } 33 | } 34 | -------------------------------------------------------------------------------- /themes/next/layout/_partials/search/localsearch.swig: -------------------------------------------------------------------------------- 1 | 17 | -------------------------------------------------------------------------------- /source/_posts/微软的8条人才评价标准.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 微软的8条人才评价标准 3 | date: 2017-03-02 01:45:59 4 | tags: 5 | - 随笔 6 | --- 7 | 8 | 13年-14年在中软工作的时候,做微软的Speech项目。与我们对接的工程院的两个工程师,都非常优秀。当时就在想,怎么才能进入微软呢?微软需要什么样的人才呢?在我入职到离前后,也有几个中软的同事,因为工作能力突出,中软的待遇又不可能满足要求,就被微软挖走了。心里有时候也有一个念头,为什么是他们? 9 | 10 | 前几天在微博上看到toombkepper转了一个微软的人才评价标准。条目如下: 11 | 12 | * 迅速掌握新知识的能力 13 | * 仅需片刻思考即可提出尖锐问题的能力 14 | * 可以再不同领域知识中找出它们之间的联系 15 | * 扫视一眼即可用通俗语言解释软件代码的能力 16 | * 关注眼前的问题,不论是否在工作中都应如此 17 | * 非常强的集中注意力的能力 18 | * 对自己过去的工作仍然记忆犹新 19 | * 注重实际的思想观念、善于表达、勇于面对挑战快速反应 20 | 21 | 对照了自己目前的状态,感触最深的是那条: 22 | 23 | > 关注眼前的问题,不论是否在工作中都应如此 24 | 25 | 什么是眼前的问题?已工作中的为例,项目中急需解决的是什么问题?有哪些是可以工具的地方?互联网知识太多了,不能被兴趣牵着鼻子走。解决问题,优雅的解决问题才是正确的道路。 26 | -------------------------------------------------------------------------------- /themes/next/layout/_third-party/analytics/facebook-sdk.swig: -------------------------------------------------------------------------------- 1 | {% if theme.facebook_sdk.enable %} 2 | 19 | {% endif %} 20 | -------------------------------------------------------------------------------- /themes/next/layout/index.swig: -------------------------------------------------------------------------------- 1 | {% extends '_layout.swig' %} 2 | {% import '_macro/post.swig' as post_template %} 3 | {% import '_macro/sidebar.swig' as sidebar_template %} 4 | 5 | {% block title %} {{ config.title }} {% endblock %} 6 | 7 | {% block page_class %} 8 | {% if is_home() %} page-home {% endif %} 9 | {% endblock %} 10 | 11 | {% block content %} 12 |
13 | {% for post in page.posts %} 14 | {{ post_template.render(post, true) }} 15 | {% endfor %} 16 |
17 | 18 | {% include '_partials/pagination.swig' %} 19 | {% endblock %} 20 | 21 | {% block sidebar %} 22 | {{ sidebar_template.render(false) }} 23 | {% endblock %} 24 | -------------------------------------------------------------------------------- /source/sharing/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: sharing 3 | date: 2017-04-05 11:16:10 4 | comments: false 5 | --- 6 | 7 | * 2017-04-05: [Doc in Yunshan](https://docs.google.com/presentation/d/1hnB3hTehxuo5jtJEeDRbr9l-GBjiCzQJtvdPYeQibxg/edit?usp=sharing) *by pengfei* 8 | 9 | * 2017-03-14: [Clean code JavaScript](https://docs.google.com/presentation/d/11kT0d8QGFpMyerfTE53iYkpgrTGgu9d9nmZZBnNAnuI/edit?usp=sharing) *by pengfei* 10 | 11 | * 2016-11-18: [Introduction to Vuex](https://docs.google.com/presentation/d/19Wf4t_wdB8UPLR2FCrsq7DGeRmVRogryn-pw9PyadiA/edit?usp=sharing) *by pengfei* 12 | 13 | * 2016-03-10: [Review of SPA](https://drive.google.com/file/d/0Bx5n8i1M4ovTcEs4UUoyNlZLckk/view?usp=sharing) *by pengfei* 14 | -------------------------------------------------------------------------------- /themes/next/source/lib/jquery_lazyload/bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jquery_lazyload", 3 | "version": "1.9.4", 4 | "homepage": "http://www.appelsiini.net/projects/lazyload", 5 | "authors": [ 6 | "Mika Tuupola " 7 | ], 8 | "description": "jQuery plugin for lazy loading images", 9 | "main": [ 10 | "jquery.lazyload.js", 11 | "jquery.scrollstop.js" 12 | ], 13 | "license": "MIT", 14 | "ignore": [ 15 | "**/.*", 16 | "**/*.min.js", 17 | "**/*.html", 18 | "**/*.textile", 19 | "Gruntfile.js", 20 | "lazyload.jquery.json", 21 | "package.json", 22 | "node_modules", 23 | "bower_components", 24 | "test", 25 | "img" 26 | ] 27 | } 28 | -------------------------------------------------------------------------------- /themes/next/layout/_third-party/comments/livere.swig: -------------------------------------------------------------------------------- 1 | {% if not (theme.duoshuo and theme.duoshuo.shortname) and not theme.duoshuo_shortname and not theme.disqus_shortname and not theme.hypercomments_id and not theme.gentie_productKey %} 2 | 3 | {% if theme.livere_uid %} 4 | 14 | {% endif %} 15 | 16 | {% endif %} 17 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "hexo-site", 3 | "version": "0.0.0", 4 | "private": true, 5 | "hexo": { 6 | "version": "4.0.0" 7 | }, 8 | "dependencies": { 9 | "hexo": "^4.0.0", 10 | "hexo-browsersync": "^0.3.0", 11 | "hexo-deployer-git": "^2.1.0", 12 | "hexo-generator-archive": "^1.0.0", 13 | "hexo-generator-category": "^1.0.0", 14 | "hexo-generator-index": "^1.0.0", 15 | "hexo-generator-tag": "^1.0.0", 16 | "hexo-renderer-ejs": "^1.0.0", 17 | "hexo-renderer-marked": "^2.0.0", 18 | "hexo-renderer-stylus": "^1.1.0", 19 | "hexo-server": "^1.0.0", 20 | "hexo-wordcount": "^6.0.1" 21 | }, 22 | "scripts": { 23 | "deploy": "hexo clean && hexo generate && hexo deploy" 24 | } 25 | } -------------------------------------------------------------------------------- /themes/next/layout/_third-party/search/algolia-search/dom.swig: -------------------------------------------------------------------------------- 1 | {% if theme.algolia_search.enable %} 2 | 20 | {% endif %} 21 | -------------------------------------------------------------------------------- /themes/next/source/css/_common/components/footer/footer.styl: -------------------------------------------------------------------------------- 1 | .footer { 2 | font-size: 14px; 3 | color: $grey-dark; 4 | 5 | img { border: none; } 6 | } 7 | 8 | .footer-inner { text-align: center; } 9 | 10 | .with-love { 11 | display: inline-block; 12 | margin: 0 5px; 13 | } 14 | 15 | .powered-by, 16 | .theme-info { display: inline-block; } 17 | 18 | .powered-by { 19 | margin-right: 10px; 20 | 21 | &::after { 22 | content: "|"; 23 | padding-left: 10px; 24 | } 25 | } 26 | 27 | .cc-license { 28 | margin-top: 10px; 29 | text-align: center; 30 | 31 | .cc-opacity { 32 | opacity: 0.7; 33 | border-bottom: none; 34 | 35 | &:hover { opacity: 0.9; } 36 | } 37 | 38 | img { display: inline-block; } 39 | } 40 | -------------------------------------------------------------------------------- /themes/next/source/css/_common/components/sidebar/sidebar-toggle.styl: -------------------------------------------------------------------------------- 1 | .sidebar-toggle { 2 | position: fixed; 3 | right: $b2t-position-right; 4 | bottom: 45px; 5 | width: 14px; 6 | height: 14px; 7 | padding: 5px; 8 | background: $black-deep; 9 | line-height: 0; 10 | z-index: $zindex-5; 11 | cursor: pointer; 12 | -webkit-transform: translateZ(0); 13 | 14 | +tablet() { 15 | display: none; 16 | } 17 | +mobile() { 18 | display: none; 19 | } 20 | } 21 | 22 | 23 | 24 | .sidebar-toggle-line { 25 | position: relative; 26 | display: inline-block; 27 | vertical-align: top; 28 | height: 2px; 29 | width: 100%; 30 | background: white; 31 | margin-top: 3px; 32 | 33 | &:first-child { margin-top: 0; } 34 | } 35 | -------------------------------------------------------------------------------- /themes/next/source/css/_common/components/sidebar/sidebar-author.styl: -------------------------------------------------------------------------------- 1 | .site-author-image { 2 | display: block; 3 | margin: 0 auto; 4 | padding: $site-author-image-padding; 5 | max-width: $site-author-image-width; 6 | height: $site-author-image-height; 7 | border: $site-author-image-border-width solid $site-author-image-border-color; 8 | } 9 | 10 | .site-author-name { 11 | margin: $site-author-name-margin; 12 | text-align: $site-author-name-align; 13 | color: $site-author-name-color; 14 | font-weight: $site-author-name-weight; 15 | } 16 | 17 | .site-description { 18 | margin-top: $site-description-margin-top; 19 | text-align: $site-description-align; 20 | font-size: $site-description-font-size; 21 | color: $site-description-color; 22 | } 23 | -------------------------------------------------------------------------------- /themes/next/source/css/_common/components/back-to-top.styl: -------------------------------------------------------------------------------- 1 | .back-to-top { 2 | box-sizing: border-box; 3 | position: fixed; 4 | bottom: $b2t-position-bottom; 5 | right: $b2t-position-right; 6 | z-index: $zindex-5; 7 | padding: 0 6px; 8 | width: hexo-config('sidebar.scrollpercent') ? initial : 24px; 9 | background: $b2t-bg-color; 10 | font-size: $b2t-font-size; 11 | opacity: $b2t-opacity; 12 | color: $b2t-color; 13 | cursor: pointer; 14 | text-align: center; 15 | -webkit-transform: translateZ(0); 16 | transition-property: bottom; 17 | the-transition(); 18 | 19 | +mobile() { 20 | display: none; 21 | } 22 | +tablet() { 23 | display: none; 24 | } 25 | 26 | &.back-to-top-on { 27 | bottom: $b2t-position-bottom-on; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /themes/next/source/css/_common/components/sidebar/site-state.styl: -------------------------------------------------------------------------------- 1 | .site-state { 2 | overflow: hidden; 3 | line-height: 1.4; 4 | white-space: nowrap; 5 | text-align: $site-state-align; 6 | } 7 | 8 | .site-state-item { 9 | display: inline-block; 10 | padding: 0 15px; 11 | border-left: 1px solid $site-state-item-border-color; 12 | 13 | &:first-child { border-left: none; } 14 | 15 | a { border-bottom: none; } 16 | } 17 | .site-state-item-count { 18 | display: block; 19 | text-align: center; 20 | color: $site-state-item-count-color; 21 | font-weight: $font-weight-bold; 22 | font-size: $site-state-item-count-font-size; 23 | } 24 | 25 | .site-state-item-name { 26 | font-size: $site-state-item-name-font-size; 27 | color: $site-state-item-name-color; 28 | } 29 | -------------------------------------------------------------------------------- /themes/next/layout/_macro/post-copyright.swig: -------------------------------------------------------------------------------- 1 | {% if theme.post_copyright.enable %} 2 | 16 | {% endif %} 17 | -------------------------------------------------------------------------------- /themes/next/source/css/_common/components/buttons.styl: -------------------------------------------------------------------------------- 1 | .btn { 2 | display: inline-block; 3 | padding: 0 20px; 4 | font-size: $btn-default-font-size; 5 | color: $btn-default-color; 6 | background: $btn-default-bg; 7 | border: $btn-default-border-width solid $btn-default-border-color; 8 | text-decoration: none; 9 | border-radius: $btn-default-radius; 10 | transition-property: background-color; 11 | the-transition(); 12 | 13 | &:hover { 14 | border-color: $btn-default-hover-border-color; 15 | color: $btn-default-hover-color; 16 | background: $btn-default-hover-bg; 17 | } 18 | } 19 | 20 | .btn-bar { 21 | display: block; 22 | width: 22px; 23 | height: 2px; 24 | background: $text-color; 25 | border-radius: 1px; 26 | 27 | &+.btn-bar { margin-top: 4px; } 28 | } 29 | -------------------------------------------------------------------------------- /themes/next/source/css/_common/components/header/menu.styl: -------------------------------------------------------------------------------- 1 | // Menu 2 | // -------------------------------------------------- 3 | .menu { 4 | margin-top: 20px; 5 | padding-left: 0; 6 | text-align: center; 7 | } 8 | 9 | .menu .menu-item { 10 | display: inline-block; 11 | margin: 0 10px; 12 | list-style: none; 13 | 14 | @media screen and (max-width: 767px) { 15 | margin-top: 10px; 16 | } 17 | 18 | a { 19 | display: block; 20 | font-size: 13px; 21 | line-height: inherit; 22 | border-bottom: 1px solid $menu-link-border; 23 | transition-property: border-color; 24 | the-transition(); 25 | 26 | &:hover { border-bottom-color: $menu-link-hover-border; } 27 | } 28 | 29 | .fa { margin-right: 5px; } 30 | } 31 | 32 | .use-motion .menu-item { opacity: 0; } 33 | -------------------------------------------------------------------------------- /themes/next/layout/_third-party/search/tinysou.swig: -------------------------------------------------------------------------------- 1 | {% if config.tinysou_Key %} 2 | 23 | {% endif %} -------------------------------------------------------------------------------- /themes/next/layout/tag.swig: -------------------------------------------------------------------------------- 1 | {% extends '_layout.swig' %} 2 | {% import '_macro/post-collapse.swig' as post_template %} 3 | {% import '_macro/sidebar.swig' as sidebar_template %} 4 | 5 | {% block title %} {{ __('title.tag') }}: {{ page.tag }} | {{ config.title }} {% endblock %} 6 | 7 | {% block content %} 8 | 9 |
10 |
11 |

12 | {{ page.tag }} 13 | {{ __('title.tag') }} 14 |

15 |
16 | 17 | {% for post in page.posts %} 18 | {{ post_template.render(post) }} 19 | {% endfor %} 20 |
21 | 22 | {% include '_partials/pagination.swig' %} 23 | {% endblock %} 24 | 25 | {% block sidebar %} 26 | {{ sidebar_template.render(false) }} 27 | {% endblock %} 28 | -------------------------------------------------------------------------------- /themes/next/source/css/_common/components/sidebar/sidebar-nav.styl: -------------------------------------------------------------------------------- 1 | // Sidebar Navigation 2 | 3 | .sidebar-nav { 4 | margin: 0 0 20px; 5 | padding-left: 0; 6 | } 7 | .sidebar-nav li { 8 | display: inline-block; 9 | cursor: pointer; 10 | border-bottom: 1px solid transparent; 11 | font-size: 14px; 12 | color: $sidebar-nav-color; 13 | 14 | &:hover { color: $sidebar-nav-hover-color; } 15 | } 16 | 17 | .page-post-detail .sidebar-nav-toc { padding: 0 5px; } 18 | 19 | .page-post-detail .sidebar-nav-overview { margin-left: 10px; } 20 | 21 | .sidebar-nav .sidebar-nav-active { 22 | color: $sidebar-highlight; 23 | border-bottom-color: $sidebar-highlight; 24 | 25 | &:hover { color: $sidebar-highlight; } 26 | } 27 | 28 | .sidebar-panel { display: none; } 29 | .sidebar-panel-active { display: block; } 30 | -------------------------------------------------------------------------------- /themes/next/layout/_partials/footer.swig: -------------------------------------------------------------------------------- 1 | 10 | 11 | {% if theme.copyright %} 12 |
13 | {{ __('footer.powered', 'Hexo') }} 14 |
15 | 16 |
17 | {{ __('footer.theme') }} - 18 | 19 | NexT.{{ theme.scheme }} 20 | 21 |
22 | {% endif %} 23 | -------------------------------------------------------------------------------- /themes/next/layout/_third-party/analytics/busuanzi-counter.swig: -------------------------------------------------------------------------------- 1 | {% if theme.busuanzi_count.enable %} 2 |
3 | 4 | 5 | {% if theme.busuanzi_count.site_uv %} 6 | 7 | {{ theme.busuanzi_count.site_uv_header }} 8 | 9 | {{ theme.busuanzi_count.site_uv_footer }} 10 | 11 | {% endif %} 12 | 13 | {% if theme.busuanzi_count.site_pv %} 14 | 15 | {{ theme.busuanzi_count.site_pv_header }} 16 | 17 | {{ theme.busuanzi_count.site_pv_footer }} 18 | 19 | {% endif %} 20 |
21 | {% endif %} 22 | -------------------------------------------------------------------------------- /themes/next/layout/category.swig: -------------------------------------------------------------------------------- 1 | {% extends '_layout.swig' %} 2 | {% import '_macro/post-collapse.swig' as post_template %} 3 | {% import '_macro/sidebar.swig' as sidebar_template %} 4 | 5 | {% block title %} {{ __('title.category') }}: {{ page.category }} | {{ config.title }} {% endblock %} 6 | 7 | {% block content %} 8 | 9 |
10 |
11 |

12 | {{ page.category }} 13 | {{ __('title.category') }} 14 |

15 |
16 | 17 | {% for post in page.posts %} 18 | {{ post_template.render(post) }} 19 | {% endfor %} 20 |
21 | 22 | {% include '_partials/pagination.swig' %} 23 | 24 | {% endblock %} 25 | 26 | {% block sidebar %} 27 | {{ sidebar_template.render(false) }} 28 | {% endblock %} 29 | -------------------------------------------------------------------------------- /themes/next/source/css/_common/components/tags/group-pictures.styl: -------------------------------------------------------------------------------- 1 | .post .post-body .group-picture { 2 | img { 3 | box-sizing: border-box; 4 | padding: 0 3px; 5 | border: none; 6 | } 7 | } 8 | 9 | .post .group-picture-row { 10 | overflow: hidden; 11 | margin-top: 6px; 12 | &:first-child { margin-top: 0; } 13 | } 14 | 15 | .post .group-picture-column { float: left; } 16 | 17 | .page-post-detail .post-body .group-picture-column { 18 | float: none; 19 | margin-top: 10px; 20 | width: auto !important; 21 | img { margin: 0 auto; } 22 | } 23 | 24 | .page-archive { 25 | .group-picture-container { overflow: hidden; } 26 | .group-picture-row { 27 | float: left; 28 | &:first-child { margin-top: 6px; } 29 | } 30 | 31 | .group-picture-column { 32 | max-width: 150px; 33 | max-height: 150px; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /themes/next/layout/_partials/share/duoshuo_share.swig: -------------------------------------------------------------------------------- 1 |
5 |
6 | 15 |
16 |
17 |
18 |
-------------------------------------------------------------------------------- /themes/next/layout/_third-party/mathjax.swig: -------------------------------------------------------------------------------- 1 | {% if theme.mathjax.enable %} 2 | {% if not theme.mathjax.per_page or (page.total or page.mathjax) %} 3 | 12 | 13 | 21 | 22 | {% endif %} 23 | {% endif %} 24 | -------------------------------------------------------------------------------- /themes/next/source/lib/velocity/bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "velocity", 3 | "version": "1.2.2", 4 | "homepage": "http://velocityjs.org", 5 | "authors": [ 6 | { "name" : "Julian Shapiro", 7 | "homepage" : "http://julian.com/" 8 | } 9 | ], 10 | "description": "Accelerated JavaScript animation.", 11 | "main": [ "./velocity.js", "./velocity.ui.js"], 12 | "keywords": [ 13 | "animation", 14 | "jquery", 15 | "animate", 16 | "lightweight", 17 | "smooth", 18 | "ui", 19 | "velocity.js", 20 | "velocityjs", 21 | "javascript" 22 | ], 23 | "license": "MIT", 24 | "ignore": [ 25 | "*.json", 26 | "!/bower.json", 27 | "LICENSE", 28 | "*.md" 29 | ], 30 | "dependencies": { 31 | "jquery": "*" 32 | }, 33 | "repository" : 34 | { 35 | "type" : "git", 36 | "url" : "http://github.com/julianshapiro/velocity.git" 37 | } 38 | } -------------------------------------------------------------------------------- /themes/next/source/lib/font-awesome/.bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "font-awesome", 3 | "description": "Font Awesome", 4 | "keywords": [], 5 | "homepage": "http://fontawesome.io", 6 | "dependencies": {}, 7 | "devDependencies": {}, 8 | "license": [ 9 | "OFL-1.1", 10 | "MIT", 11 | "CC-BY-3.0" 12 | ], 13 | "main": [ 14 | "less/font-awesome.less", 15 | "scss/font-awesome.scss" 16 | ], 17 | "ignore": [ 18 | "*/.*", 19 | "*.json", 20 | "src", 21 | "*.yml", 22 | "Gemfile", 23 | "Gemfile.lock", 24 | "*.md" 25 | ], 26 | "version": "4.7.0", 27 | "_release": "4.7.0", 28 | "_resolution": { 29 | "type": "version", 30 | "tag": "v4.7.0", 31 | "commit": "a3fe90fa5f6fac55d197f9cbd18e3f57dafb716c" 32 | }, 33 | "_source": "https://github.com/FortAwesome/Font-Awesome.git", 34 | "_target": "*", 35 | "_originalSource": "fontawesome" 36 | } -------------------------------------------------------------------------------- /themes/next/source/css/_common/components/post/post-title.styl: -------------------------------------------------------------------------------- 1 | .posts-expand .post-title { 2 | font-size: 26px; 3 | text-align: center; 4 | word-break: break-word; 5 | font-weight: $posts-expand-title-font-weight 6 | 7 | +mobile() { 8 | font-size: 22px; 9 | } 10 | } 11 | .posts-expand .post-title-link { 12 | display: inline-block; 13 | position: relative; 14 | color: $black-light; 15 | border-bottom: none; 16 | line-height: 1.2; 17 | vertical-align: top; 18 | 19 | &::before { 20 | content: ""; 21 | position: absolute; 22 | width: 100%; 23 | height: 2px; 24 | bottom: 0; 25 | left: 0; 26 | background-color: #000; 27 | visibility: hidden; 28 | transform: scaleX(0); 29 | the-transition(); 30 | } 31 | 32 | &:hover::before { 33 | visibility: visible; 34 | transform: scaleX(1); 35 | } 36 | 37 | .fa { font-size: 16px; } 38 | } 39 | -------------------------------------------------------------------------------- /themes/next/source/css/_schemes/Mist/_menu.styl: -------------------------------------------------------------------------------- 1 | // Menu 2 | // -------------------------------------------------- 3 | .site-nav-toggle { 4 | position: static; 5 | float: right; 6 | } 7 | 8 | 9 | .menu { 10 | float: right; 11 | margin: 8px 0 0 0; 12 | 13 | +mobile() { 14 | margin: 20px 0 0 0; 15 | padding: 0; 16 | } 17 | 18 | br { display: none; } 19 | 20 | .menu-item { 21 | margin: 0; 22 | +mobile() { display: block; } 23 | } 24 | 25 | .menu-item a { 26 | padding: 0 10px; 27 | background: none; 28 | border: none; 29 | border-radius: 2px; 30 | transition-property: background; 31 | 32 | +mobile() { 33 | text-align: left; 34 | } 35 | 36 | &:hover { background: #e1e1e1; } 37 | } 38 | 39 | a::before { 40 | display: none; 41 | 42 | +mobile() { display: block; } 43 | } 44 | 45 | +mobile() { float: none; } 46 | } 47 | -------------------------------------------------------------------------------- /themes/next/layout/_partials/share/jiathis.swig: -------------------------------------------------------------------------------- 1 | 2 |
3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /themes/next/source/css/_common/components/tags/blockquote-center.styl: -------------------------------------------------------------------------------- 1 | // Blockquote with all children centered. 2 | .blockquote-center { 3 | position: relative; 4 | margin: 40px 0; 5 | padding: 0; 6 | border-left: none; 7 | text-align: center; 8 | 9 | &::before, &::after { 10 | position: absolute; 11 | content: ' '; 12 | display: block; 13 | width: 100%; 14 | height: 24px; 15 | opacity: 0.2; 16 | background-repeat: no-repeat; 17 | background-position: 0 -6px; 18 | background-size: 22px 22px; 19 | } 20 | &::before { 21 | top: -20px; 22 | background-image: url($center-quote-left); 23 | border-top: 1px solid $grey-light; 24 | } 25 | &::after { 26 | bottom: -20px; 27 | background-image: url($center-quote-right); 28 | border-bottom: 1px solid $grey-light; 29 | background-position: 100% 8px; 30 | } 31 | 32 | p, div { text-align: center; } 33 | } 34 | -------------------------------------------------------------------------------- /themes/next/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "hexo-theme-next", 3 | "version": "5.1.0", 4 | "description": "Elegant theme for Hexo", 5 | "main": "index.js", 6 | "directories": { 7 | "test": "test" 8 | }, 9 | "scripts": { 10 | "test": "gulp" 11 | }, 12 | "repository": { 13 | "type": "git", 14 | "url": "git+https://github.com/iissnan/hexo-theme-next.git" 15 | }, 16 | "keywords": [ 17 | "NexT", 18 | "Hexo" 19 | ], 20 | "author": "iissnan ", 21 | "license": "MIT", 22 | "bugs": { 23 | "url": "https://github.com/iissnan/hexo-theme-next/issues" 24 | }, 25 | "homepage": "https://theme-next.iissnan.com", 26 | "devDependencies": { 27 | "coffee-script": "^1.10.0", 28 | "gulp": "^3.9.0", 29 | "gulp-jshint": "^1.12.0", 30 | "gulp-shell": "^0.6.1", 31 | "js-yaml": "^3.8.1", 32 | "jshint-stylish": "^2.1.0", 33 | "stylint": "^1.5.9" 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /themes/next/source/images/quote-r.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 8 | 12 | 13 | -------------------------------------------------------------------------------- /themes/next/source/css/_common/scaffolding/tables.styl: -------------------------------------------------------------------------------- 1 | table { 2 | margin: 20px 0; 3 | width: $table-width; 4 | border-collapse: collapse; 5 | border-spacing: 0; 6 | border: 1px solid $table-border-color; 7 | font-size: $table-font-size; 8 | table-layout: fixed; 9 | word-wrap: break-all; 10 | } 11 | table>tbody>tr { 12 | &:nth-of-type(odd) { background-color: $table-row-odd-bg-color; } 13 | &:hover { background-color: $table-row-hover-bg-color; } 14 | } 15 | 16 | caption, th, td { 17 | padding: $table-cell-padding; 18 | text-align: $table-content-alignment; 19 | vertical-align: $table-content-vertical; 20 | font-weight: normal; 21 | } 22 | 23 | th, td { 24 | border-bottom: 3px solid $table-cell-border-bottom-color; 25 | border-right: 1px solid $table-cell-border-right-color; 26 | } 27 | 28 | th { 29 | padding-bottom: 10px; 30 | font-weight: $table-th-font-weight; 31 | } 32 | 33 | td { border-bottom-width: 1px; } 34 | -------------------------------------------------------------------------------- /themes/next/source/images/quote-l.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 8 | 13 | 14 | -------------------------------------------------------------------------------- /source/_posts/command-dev-null-2-1-表示什么意思?.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: command > /dev/null 2>&1 表示什么意思? 3 | date: 2017-06-27 23:39:30 4 | tags: linux 5 | --- 6 | 7 | ``` 8 | command > /dev/null 2>&1 9 | ``` 10 | 11 | 要想理解这段代码,必须先理解 `文件描述符`,和 `输出重定向`。 12 | 13 | 14 | 15 | ## 文件描述符 16 | 17 | 每开启一个 linux(unix) 应用程序(daemon 除外),默认会打开三个输入输出流。即 18 | stdin (标准输入, 文件描述符 0), stdout(标准输出, 文件描述符1), 19 | stderr(标准错误, 文件描述符 2)。 20 | 21 | 上面的 2 、1 就是标准错误和标准输出。 22 | 23 | > 注意:默认不填表示标准输出。 24 | 25 | ### 输出重定向 26 | 27 | 在示例中, `>` 表示重定向。里面有两个重定向。 28 | 29 | > 注意:`>>` 表示追加重定向 30 | 31 | 1. `command > /dev/null`。 /dev/null 是一个黑洞,任何你想丢弃的东西都可以重定向 32 | 到这里。这个代码片段的意思是将 command 命令产生的标准输出丢弃掉。由上文我们可以 33 | 知道, 标准输出是可以不填的。 34 | 35 | 2. `2>&1`。 这里表示将标准错误(2)输出重定向到标准输出(1)的输出上。此处的 36 | `&` 表示跟指针的概念类似。由于标准输出(1)已经被重定向到 /dev/null,2 也被重定 37 | 向到了 /dev/null。 38 | 39 | 也就是说这里丢弃了所有的输出和错误,让程序安静的运行。 40 | 41 | 如果想让程序在后台运行,可以加个在末尾加一个 `&`: 42 | 43 | ``` 44 | command > /dev/null 2>$1 & 45 | ``` 46 | -------------------------------------------------------------------------------- /themes/next/layout/_third-party/analytics/vkontakte-api.swig: -------------------------------------------------------------------------------- 1 | {% if theme.vkontakte_api.enable %} 2 | 3 |
4 | 26 | 27 | {% endif %} 28 | -------------------------------------------------------------------------------- /themes/next/layout/_third-party/search/algolia-search/assets.swig: -------------------------------------------------------------------------------- 1 | {% if theme.algolia_search.enable %} 2 | 3 | {# S: Include Algolia instantsearch.js library #} 4 | {% set algolia_instant_css = url_for(theme.vendors._internal + '/algolia-instant-search/instantsearch.min.css') %} 5 | {% if theme.vendors.algolia_instant_css %} 6 | {% set algolia_instant_css = theme.vendors.algolia_instant_css %} 7 | {% endif %} 8 | 9 | 10 | {% set algolia_instant_js = url_for(theme.vendors._internal + '/algolia-instant-search/instantsearch.min.js') %} 11 | {% if theme.vendors.algolia_instant_js %} 12 | {% set algolia_instant_js = theme.vendors.algolia_instant_js %} 13 | {% endif %} 14 | 15 | {# E: Include Algolia instantsearch.js library #} 16 | 17 | 18 | {% endif %} 19 | -------------------------------------------------------------------------------- /themes/next/layout/_third-party/comments/disqus.swig: -------------------------------------------------------------------------------- 1 | {% if not (theme.duoshuo and theme.duoshuo.shortname) and not theme.duoshuo_shortname %} 2 | {% if theme.disqus.enable %} 3 | 4 | {% if theme.disqus.count %} 5 | 6 | {% endif %} 7 | 8 | {% if page.comments %} 9 | 20 | {% endif %} 21 | 22 | {% endif %} 23 | {% endif %} 24 | -------------------------------------------------------------------------------- /themes/next/scripts/tags/full-image.js: -------------------------------------------------------------------------------- 1 | /* global hexo */ 2 | // Usage: {% fullimage /path/to/image, alt, title %} 3 | // Alias: {% fi /path/to/image, alt, title %} 4 | 5 | function fullImage(args) { 6 | args = args.join(' ').split(','); 7 | var src = args[0]; 8 | var alt = args[1] || ''; 9 | var title = args[2] || ''; 10 | 11 | if (!src) { 12 | hexo.log.warn('Image src can NOT be empty'); 13 | } 14 | alt = alt.trim(); 15 | title = title.trim(); 16 | 17 | var image = [' 0 && image.push('alt="' + alt + '"'); 19 | title.length > 0 && image.push('title="' + title + '"'); 20 | image.push('/>'); 21 | 22 | return image.join(' '); 23 | } 24 | 25 | hexo.extend.tag.register('fullimage', fullImage); 26 | hexo.extend.tag.register('fi', fullImage); 27 | -------------------------------------------------------------------------------- /themes/next/source/lib/jquery_lazyload/.bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jquery_lazyload", 3 | "version": "1.9.7", 4 | "homepage": "http://www.appelsiini.net/projects/lazyload", 5 | "authors": [ 6 | "Mika Tuupola " 7 | ], 8 | "description": "jQuery plugin for lazy loading images", 9 | "main": [ 10 | "jquery.lazyload.js", 11 | "jquery.scrollstop.js" 12 | ], 13 | "license": "MIT", 14 | "ignore": [ 15 | "**/.*", 16 | "**/*.min.js", 17 | "**/*.html", 18 | "**/*.textile", 19 | "Gruntfile.js", 20 | "lazyload.jquery.json", 21 | "package.json", 22 | "node_modules", 23 | "bower_components", 24 | "test", 25 | "img" 26 | ], 27 | "_release": "1.9.7", 28 | "_resolution": { 29 | "type": "version", 30 | "tag": "1.9.7", 31 | "commit": "218e50eb4999fe59ac94b939a65c8c988d1d420b" 32 | }, 33 | "_source": "git://github.com/tuupola/jquery_lazyload.git", 34 | "_target": "~1.9.7", 35 | "_originalSource": "jquery.lazyload", 36 | "_direct": true 37 | } -------------------------------------------------------------------------------- /themes/next/scripts/tags/button.js: -------------------------------------------------------------------------------- 1 | /* global hexo */ 2 | // Usage: {% button /path/to/url/, text, icon [class], title %} 3 | // Alias: {% btn /path/to/url/, text, icon [class], title %} 4 | 5 | function postButton(args) { 6 | args = args.join(' ').split(','); 7 | var url = args[0]; 8 | var text = args[1] || ''; 9 | var icon = args[2] || ''; 10 | var title = args[3] || ''; 11 | 12 | if (!url) { 13 | hexo.log.warn('URL can NOT be empty'); 14 | } 15 | 16 | text = text.trim(); 17 | icon = icon.trim(); 18 | title = title.trim(); 19 | 20 | var result = [' 0 && result.push(' title="' + title + '"'); 22 | result.push('>'); 23 | icon.length > 0 && result.push(''); 24 | text.length > 0 && result.push(text); 25 | result.push(''); 26 | 27 | return result.join(''); 28 | } 29 | 30 | hexo.extend.tag.register('button', postButton); 31 | hexo.extend.tag.register('btn', postButton); 32 | -------------------------------------------------------------------------------- /themes/next/layout/_macro/reward.swig: -------------------------------------------------------------------------------- 1 | {% if theme.alipay or theme.wechatpay %} 2 |
3 |
{{ theme.reward_comment }}
4 | 7 | 21 |
22 | {% endif %} 23 | -------------------------------------------------------------------------------- /themes/next/source/lib/fancybox/source/helpers/jquery.fancybox-thumbs.css: -------------------------------------------------------------------------------- 1 | #fancybox-thumbs { 2 | position: fixed; 3 | left: 0; 4 | width: 100%; 5 | overflow: hidden; 6 | z-index: 8050; 7 | } 8 | 9 | #fancybox-thumbs.bottom { 10 | bottom: 2px; 11 | } 12 | 13 | #fancybox-thumbs.top { 14 | top: 2px; 15 | } 16 | 17 | #fancybox-thumbs ul { 18 | position: relative; 19 | list-style: none; 20 | margin: 0; 21 | padding: 0; 22 | } 23 | 24 | #fancybox-thumbs ul li { 25 | float: left; 26 | padding: 1px; 27 | opacity: 0.5; 28 | } 29 | 30 | #fancybox-thumbs ul li.active { 31 | opacity: 0.75; 32 | padding: 0; 33 | border: 1px solid #fff; 34 | } 35 | 36 | #fancybox-thumbs ul li:hover { 37 | opacity: 1; 38 | } 39 | 40 | #fancybox-thumbs ul li a { 41 | display: block; 42 | position: relative; 43 | overflow: hidden; 44 | border: 1px solid #222; 45 | background: #111; 46 | outline: none; 47 | } 48 | 49 | #fancybox-thumbs ul li img { 50 | display: block; 51 | position: relative; 52 | border: 0; 53 | padding: 0; 54 | max-width: none; 55 | } -------------------------------------------------------------------------------- /themes/next/source/css/_common/components/sidebar/sidebar.styl: -------------------------------------------------------------------------------- 1 | .sidebar { 2 | position: fixed; 3 | right: 0; 4 | top: 0; 5 | bottom: 0; 6 | 7 | width: 0; 8 | z-index: $zindex-4; 9 | box-shadow: inset 0 2px 6px black; 10 | background: $black-deep; 11 | -webkit-transform: translateZ(0); // http://stackoverflow.com/questions/17079857/position-fixed-broken-in-chrome-with-flash-behind 12 | 13 | a { 14 | color: $grey-dark; 15 | border-bottom-color: $black-light; 16 | &:hover { color: $gainsboro; } 17 | } 18 | 19 | +tablet() { 20 | display: none !important; 21 | } 22 | +mobile() { 23 | display: none !important; 24 | } 25 | } 26 | 27 | .sidebar-inner { 28 | position: relative; 29 | padding: 20px 10px; 30 | color: $grey-dark; 31 | text-align: center; 32 | } 33 | 34 | @import "sidebar-toggle"; 35 | @import "sidebar-author"; 36 | @import "site-state"; 37 | @import "sidebar-feed-link"; 38 | @import "sidebar-author-links"; 39 | @import "sidebar-blogroll.styl"; 40 | @import "sidebar-nav"; 41 | @import "sidebar-toc"; 42 | 43 | -------------------------------------------------------------------------------- /themes/next/source/css/_common/components/header/site-meta.styl: -------------------------------------------------------------------------------- 1 | .site-meta { 2 | margin: 0; 3 | text-align: $site-meta-text-align; 4 | 5 | +mobile() { text-align: center; } 6 | } 7 | 8 | .brand { 9 | position: relative; 10 | display: inline-block; 11 | padding: 0 40px; 12 | color: $brand-color; 13 | background: $brand-bg; 14 | border-bottom: none; 15 | &:hover { color: $brand-hover-color; } 16 | } 17 | 18 | .logo { 19 | display: inline-block; 20 | margin-right: 5px; 21 | line-height: 36px; 22 | vertical-align: top; 23 | } 24 | 25 | .site-title { 26 | display: inline-block; 27 | vertical-align: top; 28 | line-height: 36px; 29 | font-size: $logo-font-size; 30 | font-weight: normal; 31 | font-family: $font-family-logo; 32 | } 33 | 34 | .site-subtitle { 35 | margin-top: 10px; 36 | font-size: $subtitle-font-size; 37 | color: $subtitle-color; 38 | } 39 | 40 | .use-motion { 41 | .brand { opacity: 0; } 42 | 43 | .logo, .site-title, .site-subtitle { 44 | opacity: 0; 45 | position: relative; 46 | top: -10px; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /themes/next/source/css/_common/components/post/post-nav.styl: -------------------------------------------------------------------------------- 1 | .post-nav { 2 | display: table; 3 | margin-top: 15px; 4 | width: 100%; 5 | border-top: 1px solid $gainsboro; 6 | } 7 | 8 | .post-nav-divider { 9 | display: table-cell; 10 | width: 10%; 11 | } 12 | 13 | .post-nav-item { 14 | display: table-cell; 15 | padding: 10px 0 0 0; 16 | width: 45%; 17 | vertical-align: top; 18 | 19 | a { 20 | position: relative; 21 | display: block; 22 | line-height: 25px; 23 | font-size: 14px; 24 | color: $link-color; 25 | border-bottom: none; 26 | 27 | &:hover { 28 | color: $link-hover-color; 29 | border-bottom: none; 30 | } 31 | 32 | &:active { top: 2px; } 33 | } 34 | 35 | .fa { 36 | position: absolute; 37 | top: 8px; 38 | left: 0; 39 | font-size: 12px; 40 | } 41 | 42 | } 43 | 44 | .post-nav-next { 45 | a { padding-left: 15px; } 46 | } 47 | 48 | .post-nav-prev { 49 | text-align: right; 50 | 51 | a { padding-right: 15px; } 52 | 53 | .fa { 54 | right: 0; 55 | left: auto; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /themes/next/source/css/main.styl: -------------------------------------------------------------------------------- 1 | // CSS Style Guide: http://codeguide.co/#css 2 | 3 | 4 | 5 | $scheme = hexo-config('scheme') ? hexo-config('scheme') : 'Muse'; 6 | $variables = base $scheme custom; 7 | $mixins = base $scheme custom; 8 | 9 | 10 | 11 | // Variables Layer 12 | // -------------------------------------------------- 13 | for $variable in $variables 14 | @import "_variables/" + $variable 15 | 16 | 17 | // Mixins Layer 18 | // -------------------------------------------------- 19 | for $mixin in $mixins 20 | @import "_mixins/" + $mixin; 21 | 22 | 23 | 24 | // Common Layer 25 | // -------------------------------------------------- 26 | 27 | // Scaffolding 28 | @import "_common/scaffolding"; 29 | 30 | // Layout 31 | @import "_common/outline"; 32 | 33 | // Components 34 | @import "_common/components"; 35 | 36 | 37 | // Schemes Layer 38 | // -------------------------------------------------- 39 | @import "_schemes/" + $scheme; 40 | 41 | 42 | 43 | // Custom Layer 44 | // -------------------------------------------------- 45 | @import "_custom/custom"; 46 | -------------------------------------------------------------------------------- /themes/next/source/css/_mixins/base.styl: -------------------------------------------------------------------------------- 1 | the-transition() { 2 | transition-duration: 0.2s; 3 | transition-timing-function: ease-in-out; 4 | transition-delay: 0s; 5 | } 6 | 7 | mobile() { 8 | @media (max-width: 767px) { 9 | {block} 10 | } 11 | } 12 | 13 | tablet() { 14 | @media (min-width: 768px) and (max-width: 991px) { 15 | {block} 16 | } 17 | } 18 | 19 | desktop() { 20 | @media (min-width: 992px) { 21 | {block} 22 | } 23 | } 24 | 25 | desktop-large() { 26 | @media (min-width: 1600px) { 27 | {block} 28 | } 29 | } 30 | 31 | circle() { 32 | border-radius: 50%; 33 | } 34 | 35 | transform() { 36 | -webkit-transform: arguments 37 | -moz-transform: arguments 38 | -ms-transform: arguments 39 | -o-transform: arguments 40 | transform: arguments 41 | } 42 | 43 | 44 | random-color($min, $max) { 45 | return floor(math(0, 'random') * ($max - $min + 1) + $min); 46 | } 47 | 48 | // Clearfix. http://nicolasgallagher.com/micro-clearfix-hack/ 49 | clearfix() { 50 | &:before, 51 | &:after { 52 | content: " "; 53 | display: table; 54 | } 55 | &:after { clear: both; } 56 | } 57 | -------------------------------------------------------------------------------- /themes/next/layout/_third-party/analytics/application-insights.swig: -------------------------------------------------------------------------------- 1 | {% if theme.application_insights %} 2 | 11 | {% endif %} -------------------------------------------------------------------------------- /themes/next/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2014-2017 iissnan 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /themes/next/layout/post.swig: -------------------------------------------------------------------------------- 1 | {% extends '_layout.swig' %} 2 | {% import '_macro/post.swig' as post_template %} 3 | {% import '_macro/sidebar.swig' as sidebar_template %} 4 | 5 | 6 | {% block title %} {{ page.title }} | {{ config.title }} {% endblock %} 7 | 8 | {% block page_class %}page-post-detail{% endblock %} 9 | 10 | 11 | {% block content %} 12 | 13 |
14 | {{ post_template.render(page) }} 15 | 16 |
17 | {% if theme.jiathis %} 18 | {% include '_partials/share/jiathis.swig' %} 19 | {% elseif theme.baidushare %} 20 | {% include '_partials/share/baidushare.swig' %} 21 | {% elseif theme.add_this_id %} 22 | {% include '_partials/share/add-this.swig' %} 23 | {% elseif theme.duoshuo_shortname and theme.duoshuo_share %} 24 | {% include '_partials/share/duoshuo_share.swig' %} 25 | {% endif %} 26 |
27 |
28 | 29 | {% endblock %} 30 | 31 | {% block sidebar %} 32 | {{ sidebar_template.render(true) }} 33 | {% endblock %} 34 | 35 | 36 | {% block script_extra %} 37 | {% include '_scripts/pages/post-details.swig' %} 38 | {% endblock %} 39 | -------------------------------------------------------------------------------- /themes/next/source/lib/fastclick/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014 The Financial Times Ltd. 2 | 3 | Permission is hereby granted, free of charge, to any person 4 | obtaining a copy of this software and associated documentation 5 | files (the "Software"), to deal in the Software without 6 | restriction, including without limitation the rights to use, 7 | copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the 9 | Software is furnished to do so, subject to the following 10 | conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 17 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 19 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /themes/next/source/css/_common/components/post/post.styl: -------------------------------------------------------------------------------- 1 | .post-body { 2 | font-family: $font-family-posts; 3 | +mobile() { 4 | word-break: break-word; 5 | } 6 | } 7 | 8 | .post-body .fancybox img { 9 | display: block !important; 10 | margin: 0 auto; 11 | cursor: pointer; 12 | cursor: zoom-in; 13 | cursor: -webkit-zoom-in; 14 | } 15 | 16 | .post-body .image-caption { 17 | margin: 10px auto 15px; 18 | text-align: center; 19 | font-size: $font-size-base; 20 | color: $grey-dark; 21 | font-weight: bold; 22 | line-height: 1; 23 | } 24 | 25 | .post-body .figure .caption { 26 | @extend .post-body .image-caption; 27 | } 28 | 29 | .post-sticky-flag { 30 | display: inline-block; 31 | font-size: 16px; 32 | -ms-transform: rotate(30deg); 33 | transform: rotate(30deg); 34 | } 35 | 36 | @import "post-expand"; 37 | @import "post-collapse"; 38 | @import "post-type"; 39 | @import "post-title"; 40 | @import "post-meta"; 41 | @import "post-button"; 42 | @import "post-tags"; 43 | @import "post-nav"; 44 | @import "post-eof"; 45 | @import "post-gallery"; 46 | @import "post-reward" if hexo-config('alipay') or hexo-config('wechatpay'); 47 | @import "post-copyright.styl" if hexo-config('post_copyright.enable') 48 | -------------------------------------------------------------------------------- /themes/next/source/lib/velocity/.bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "velocity", 3 | "version": "1.2.2", 4 | "homepage": "http://velocityjs.org", 5 | "authors": [ 6 | { 7 | "name": "Julian Shapiro", 8 | "homepage": "http://julian.com/" 9 | } 10 | ], 11 | "description": "Accelerated JavaScript animation.", 12 | "main": [ 13 | "./velocity.js", 14 | "./velocity.ui.js" 15 | ], 16 | "keywords": [ 17 | "animation", 18 | "jquery", 19 | "animate", 20 | "lightweight", 21 | "smooth", 22 | "ui", 23 | "velocity.js", 24 | "velocityjs", 25 | "javascript" 26 | ], 27 | "license": "MIT", 28 | "ignore": [ 29 | "*.json", 30 | "!/bower.json", 31 | "LICENSE", 32 | "*.md" 33 | ], 34 | "dependencies": { 35 | "jquery": "*" 36 | }, 37 | "repository": { 38 | "type": "git", 39 | "url": "http://github.com/julianshapiro/velocity.git" 40 | }, 41 | "_release": "1.2.2", 42 | "_resolution": { 43 | "type": "version", 44 | "tag": "1.2.2", 45 | "commit": "6b227928631aab5694255df3c219736c4c02449d" 46 | }, 47 | "_source": "git://github.com/julianshapiro/velocity.git", 48 | "_target": "~1.2.1", 49 | "_originalSource": "velocity" 50 | } -------------------------------------------------------------------------------- /themes/next/layout/_third-party/comments/hypercomments.swig: -------------------------------------------------------------------------------- 1 | {% if not (theme.duoshuo and theme.duoshuo.shortname) and not theme.duoshuo_shortname and not theme.disqus_shortname %} 2 | 3 | {% if theme.hypercomments_id %} 4 | 5 | 24 | 25 | {% endif %} 26 | 27 | {% endif %} 28 | -------------------------------------------------------------------------------- /themes/next/source/css/_schemes/Mist/_header.styl: -------------------------------------------------------------------------------- 1 | // Header 2 | // -------------------------------------------------- 3 | .header { background: $whitesmoke; } 4 | .header-inner { 5 | padding: 25px 0 20px; 6 | clearfix(); 7 | 8 | +mobile() { 9 | width: auto; 10 | margin-bottom: 50px; 11 | padding: 10px; 12 | } 13 | } 14 | 15 | .site-meta { 16 | float: left; 17 | margin-left: -20px; 18 | line-height: normal; 19 | 20 | +mobile() { 21 | margin-left: 10px; 22 | } 23 | 24 | .brand { 25 | padding: 2px 1px; 26 | background: none; 27 | 28 | +mobile() { display: block; } 29 | } 30 | 31 | .logo { display: none; } 32 | 33 | .site-title { 34 | font-size: 22px; 35 | font-weight: bolder; 36 | 37 | +mobile() { line-height: 34px; } 38 | } 39 | } 40 | 41 | 42 | .logo-line-before, 43 | .logo-line-after { 44 | display: block; 45 | overflow: hidden; 46 | margin: 0 auto; 47 | width: 75%; 48 | 49 | +mobile() { display: none; } 50 | 51 | i { 52 | position: relative; 53 | display: block; 54 | height: 2px; 55 | background: $black-deep; 56 | +mobile() { height: 3px; } 57 | } 58 | } 59 | 60 | .use-motion { 61 | .logo-line-before i { left: -100%; } 62 | .logo-line-after i { right: -100%; } 63 | } 64 | -------------------------------------------------------------------------------- /themes/next/source/css/_schemes/Pisces/_menu.styl: -------------------------------------------------------------------------------- 1 | .site-nav { 2 | border-top: none; 3 | 4 | +tablet() { 5 | display: none !important; 6 | } 7 | } 8 | 9 | .site-nav-on { 10 | +tablet() { 11 | display: block !important; 12 | } 13 | } 14 | 15 | .menu .menu-item { 16 | display: block; 17 | margin: 0; 18 | 19 | a { 20 | position: relative; 21 | box-sizing: border-box; 22 | padding: 5px 20px; 23 | text-align: left; 24 | line-height: inherit; 25 | transition-property: background-color; 26 | the-transition(); 27 | 28 | &:hover { 29 | background: #f9f9f9; 30 | border-bottom-color: white; 31 | } 32 | } 33 | 34 | br { display: none; } 35 | } 36 | 37 | .menu-item-active a { 38 | @extend .menu .menu-item a:hover; 39 | 40 | &:after { 41 | content: " "; 42 | position: absolute; 43 | top: 50%; 44 | margin-top: -3px; 45 | right: 15px; 46 | width: 6px; 47 | height: 6px; 48 | border-radius: 50%; 49 | background-color: $grey; 50 | } 51 | } 52 | 53 | .btn-bar { 54 | background-color: white; 55 | } 56 | 57 | .site-nav-toggle { 58 | left: 20px; 59 | top: 50%; 60 | 61 | -webkit-transform: translateY(-50%); 62 | transform: translateY(-50%); 63 | 64 | +tablet() { 65 | display: block; 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /themes/next/source/css/_common/components/post/post-expand.styl: -------------------------------------------------------------------------------- 1 | // TODO: Refactor. 2 | 3 | .posts-expand { 4 | padding-top: 40px; 5 | } 6 | 7 | @media (max-width: 767px) { 8 | .posts-expand { 9 | margin: 0 20px; 10 | } 11 | 12 | .post-body { 13 | pre { 14 | padding: 10px; 15 | .gutter pre { 16 | padding-right: 10px; 17 | } 18 | } 19 | 20 | .highlight { 21 | margin-left: -40px; 22 | margin-right: -40px; 23 | padding: 0; 24 | .gutter pre { 25 | padding-right: 10px; 26 | } 27 | } 28 | } 29 | } 30 | 31 | .posts-expand .post-body { 32 | +desktop() { text-align: justify; } 33 | 34 | 35 | h2, h3, h4, h5, h6 { 36 | padding-top: 10px; 37 | 38 | .header-anchor{ 39 | float: right; 40 | margin-left: 10px; 41 | color: $grey-light; 42 | border-bottom-style: none; 43 | visibility: hidden; 44 | 45 | &:hover{ 46 | color: inherit; 47 | } 48 | } 49 | 50 | &:hover .header-anchor{ 51 | visibility: visible; 52 | } 53 | } 54 | 55 | ul li { list-style: circle; } 56 | 57 | img { 58 | box-sizing: border-box; 59 | margin: auto; 60 | padding: 3px; 61 | border: 1px solid $gray-lighter; 62 | } 63 | } 64 | 65 | .posts-expand .fancybox img { margin: 0 auto; } 66 | -------------------------------------------------------------------------------- /themes/next/source/css/_common/components/post/post-meta.styl: -------------------------------------------------------------------------------- 1 | .posts-expand .post-meta { 2 | margin: 3px 0 60px 0; 3 | color: $grey-dark; 4 | font-family: $font-family-posts; 5 | font-size: 12px; 6 | text-align: center; 7 | 8 | .post-category-list { 9 | display: inline-block; 10 | margin: 0; 11 | padding: 3px; 12 | } 13 | .post-category-list-link { color: $grey-dark; } 14 | 15 | .post-description { 16 | font-size: 14px; 17 | margin-top: 2px; 18 | } 19 | } 20 | 21 | .post-meta-divider { 22 | margin: 0 .5em; 23 | } 24 | 25 | .post-meta-item-icon { 26 | margin-right: 3px; 27 | +tablet() { 28 | display: inline-block; 29 | } 30 | +mobile() { 31 | display: inline-block; 32 | } 33 | } 34 | .post-meta-item-text { 35 | +tablet() { 36 | display: none; 37 | } 38 | +mobile() { 39 | display: none; 40 | } 41 | } 42 | 43 | .posts-expand .post-comments-count { 44 | +mobile() { display: none; } 45 | } 46 | .social-like { 47 | font-size: 14px; 48 | height: 20px; 49 | text-align: center; 50 | border-top: 1px solid #eee; 51 | padding-top: 9px; 52 | margin-top: 45px; 53 | display: flex; 54 | justify-content: center; 55 | } 56 | 57 | .vk_like { 58 | width: 85px; 59 | height: 21px; 60 | padding-top: 7px; 61 | align-self: center; 62 | } 63 | 64 | .fb_like { 65 | height: 30px; 66 | align-self: center; 67 | } 68 | -------------------------------------------------------------------------------- /source/_posts/使用hexo在github上搭建博客.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 使用Hexo在GitHub上搭建博客 3 | date: 2016-07-29 01:31:48 4 | tags: hexo 5 | --- 6 | 7 | 越来越多的人利用[GitHub Pages](https://pages.github.com/)创建静态网站。这样有很多好处,比如你不再需要维护自己的VPS,也不需要配置Nginx服务器,更不必担心域名何时续费等等。对于一个不需要那么多"动态"业务的博客来说,GitHub提供给我们的已经足够了。 8 | 9 | `GitHub`原生支持`Jekll`。`Jekyll`是一个用来生成静态网页的工具,跟`Hexo`类似。本文介绍如何使用`Hexo`在`GitHub`上搭建博客。 10 | 11 | 12 | 13 | ## 安装hexo 14 | 15 | ``` 16 | npm install hexo-cli -g 17 | ``` 18 | 19 | ## 创建本地环境 20 | 21 | 假设我们新建一个叫做blog的本地文件夹,在blog下安装依赖。安装完成后启动`hexo-server`。可以在本地看到一个类Hello world的页面。 22 | 23 | ``` 24 | hexo init blog 25 | cd blog 26 | npm install 27 | hexo server 28 | ``` 29 | 30 | ## 创建GitHub仓库 31 | 32 | `GitHub`中有一个特殊的仓库,叫`username.github.io`。Github Pages会默认使用这个仓库。如果在这个库里有一个index.html。那么访问[http://username.github.io](http://username.github.io)就会看到这个静态页面。 33 | 34 | 此步骤可以创建一个空的仓库:`username.github.io`。 35 | 36 | ## 本地生成静态文件 37 | 38 | 由上一步我们知道,我们需要一个index.html的静态文件。在本地我们可以由`hexo`生成。 39 | 40 | ``` 41 | hexo generate 42 | ``` 43 | 44 | 此过程会将hexo的主题包括css和js,以及你本地的博客文件编译成静态文件。 45 | 46 | ## 部署到GitHub 47 | 48 | 安装`hexo-deployer-git"。 49 | ``` 50 | npm install hexo-deployer-git --save 51 | ``` 52 | 修改_config.yml。将刚才创建的空得仓库信息填写到下面。messges可以删除。 53 | 54 | ``` 55 | deploy: 56 | type: git 57 | repo: 58 | branch: [branch] 59 | message: [message] 60 | ``` 61 | 62 | 然后`hexo deploy`。查看username.github.io,会看到和本地server一样的结果。 63 | -------------------------------------------------------------------------------- /themes/next/source/css/_common/outline/outline.styl: -------------------------------------------------------------------------------- 1 | // 2 | // Layout 3 | // Note: Must name this file "outline" instead of "layout" 4 | // Or Hexo will use it as template layout. 5 | // ================================================= 6 | 7 | 8 | html, body { height: 100%; } 9 | 10 | .container { 11 | position: relative; 12 | min-height: 100%; 13 | } 14 | 15 | 16 | // Header Section 17 | // -------------------------------------------------- 18 | .header-inner { 19 | margin: 0 auto; 20 | padding: 100px 0 70px; 21 | width: $content-desktop; 22 | 23 | +desktop-large() { 24 | .container & { width: $content-desktop-large; } 25 | } 26 | } 27 | 28 | // Main Section 29 | // -------------------------------------------------- 30 | .main { padding-bottom: $footer-height + $gap-between-main-and-footer; } 31 | .main-inner { 32 | margin: 0 auto; 33 | width: $content-desktop; 34 | 35 | +desktop-large() { 36 | .container & { width: $content-desktop-large; } 37 | } 38 | } 39 | 40 | 41 | // Footer Section 42 | // -------------------------------------------------- 43 | .footer { 44 | position: absolute; 45 | left: 0; 46 | bottom: 0; 47 | width: 100%; 48 | min-height: $footer-height; 49 | } 50 | .footer-inner { 51 | box-sizing: border-box; 52 | margin: 20px auto; 53 | width: $content-desktop; 54 | 55 | +desktop-large() { 56 | .container & { width: $content-desktop-large; } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /themes/next/source/css/_common/components/sidebar/sidebar-toc.styl: -------------------------------------------------------------------------------- 1 | 2 | .post-toc-empty { 3 | font-size: 14px; 4 | color: $grey-dim; 5 | } 6 | 7 | .post-toc-wrap { overflow: hidden; } 8 | 9 | .post-toc { overflow: auto; } 10 | 11 | .post-toc ol { 12 | margin: 0; 13 | padding: 0 2px 5px 10px; 14 | text-align: left; 15 | list-style: none; 16 | font-size: 14px; 17 | 18 | & > ol { padding-left: 0; } 19 | 20 | a { 21 | the-transition(); 22 | transition-property: all; 23 | color: $toc-link-color; 24 | border-bottom-color: $toc-link-border-color; 25 | 26 | &:hover { 27 | color: $toc-link-hover-color; 28 | border-bottom-color: $toc-link-hover-border-color; 29 | } 30 | } 31 | } 32 | 33 | .post-toc .nav-item { 34 | overflow: hidden; 35 | text-overflow: ellipsis; 36 | white-space: nowrap; 37 | line-height: 1.8; 38 | } 39 | 40 | .post-toc .nav .nav-child { display: none; } 41 | 42 | .post-toc .nav .active > .nav-child { display: block; } 43 | 44 | .post-toc .nav .active-current > .nav-child { 45 | display: block; 46 | & > .nav-item { display: block; } 47 | } 48 | 49 | .post-toc .nav .active > a { 50 | color: $toc-link-active-color; 51 | border-bottom-color: $toc-link-active-border-color; 52 | } 53 | 54 | .post-toc .nav .active-current > a { 55 | color: $toc-link-active-current-color; 56 | &:hover { 57 | color: $toc-link-active-current-border-color; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /themes/next/layout/_macro/post-collapse.swig: -------------------------------------------------------------------------------- 1 | {% macro render(post) %} 2 | 3 | 33 | 34 | {% endmacro %} 35 | -------------------------------------------------------------------------------- /themes/next/source/css/_common/components/pagination.styl: -------------------------------------------------------------------------------- 1 | .pagination { 2 | margin: 120px 0 40px; 3 | text-align: center; 4 | border-top: 1px solid $pagination-border; 5 | } 6 | 7 | .page-number-basic { 8 | display: inline-block; 9 | position: relative; 10 | top: -1px; 11 | margin: 0 10px; 12 | padding: 0 10px; 13 | line-height: 30px; 14 | 15 | +mobile() { margin: 0 5px; } 16 | } 17 | 18 | .pagination { 19 | .prev, .next, .page-number { 20 | @extend .page-number-basic; 21 | border-bottom: 0; 22 | border-top: 1px solid $pagination-link-border; 23 | transition-property: border-color; 24 | the-transition(); 25 | 26 | &:hover { border-top-color: $pagination-link-hover-border; } 27 | } 28 | 29 | .space { 30 | @extend .page-number-basic; 31 | padding: 0; 32 | margin: 0; 33 | } 34 | 35 | .prev { margin-left: 0; } 36 | .next { margin-right: 0; } 37 | 38 | .page-number.current { 39 | color: $pagination-active-color; 40 | background: $pagination-active-bg; 41 | border-top-color: $pagination-active-border; 42 | } 43 | } 44 | 45 | @media (max-width: 767px) 46 | .pagination { border-top: none; } 47 | 48 | .pagination { 49 | .prev, .next, .page-number { 50 | margin-bottom: 10px; 51 | border-top: 0; 52 | border-bottom: 1px solid $pagination-link-border; 53 | 54 | &:hover { border-bottom-color: $pagination-link-hover-border; } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /themes/next/source/js/src/bootstrap.js: -------------------------------------------------------------------------------- 1 | /* global NexT: true */ 2 | 3 | $(document).ready(function () { 4 | 5 | $(document).trigger('bootstrap:before'); 6 | 7 | NexT.utils.isMobile() && window.FastClick.attach(document.body); 8 | 9 | NexT.utils.lazyLoadPostsImages(); 10 | 11 | NexT.utils.registerESCKeyEvent(); 12 | 13 | NexT.utils.registerBackToTop(); 14 | 15 | $('.site-nav-toggle button').on('click', function () { 16 | var $siteNav = $('.site-nav'); 17 | var ON_CLASS_NAME = 'site-nav-on'; 18 | var isSiteNavOn = $siteNav.hasClass(ON_CLASS_NAME); 19 | var animateAction = isSiteNavOn ? 'slideUp' : 'slideDown'; 20 | var animateCallback = isSiteNavOn ? 'removeClass' : 'addClass'; 21 | 22 | $siteNav.stop()[animateAction]('fast', function () { 23 | $siteNav[animateCallback](ON_CLASS_NAME); 24 | }); 25 | }); 26 | 27 | 28 | CONFIG.fancybox && NexT.utils.wrapImageWithFancyBox(); 29 | NexT.utils.embeddedVideoTransformer(); 30 | NexT.utils.addActiveClassToMenuItem(); 31 | 32 | 33 | // Define Motion Sequence. 34 | NexT.motion.integrator 35 | .add(NexT.motion.middleWares.logo) 36 | .add(NexT.motion.middleWares.menu) 37 | .add(NexT.motion.middleWares.postList) 38 | .add(NexT.motion.middleWares.sidebar); 39 | 40 | $(document).trigger('motion:before'); 41 | 42 | // Bootstrap Motion. 43 | CONFIG.motion && NexT.motion.integrator.bootstrap(); 44 | 45 | $(document).trigger('bootstrap:after'); 46 | }); 47 | -------------------------------------------------------------------------------- /themes/next/layout/_scripts/vendors.swig: -------------------------------------------------------------------------------- 1 | {# Reset `window.Promise` when it was not a function. #} 2 | {# IE refers the element whose id is `Promise` as `window.Promise`, this causes Velocity throwing an exception #} 3 | 8 | 9 | {% set js_vendors = {} %} 10 | {% set js_vendors.jquery = 'jquery/index.js?v=2.1.3' %} 11 | {% set js_vendors.fastclick = 'fastclick/lib/fastclick.min.js?v=1.0.6' %} 12 | {% set js_vendors.lazyload = 'jquery_lazyload/jquery.lazyload.js?v=1.9.7' %} 13 | {% set js_vendors.velocity = 'velocity/velocity.min.js?v=1.2.1' %} 14 | {% set js_vendors.velocity_ui = 'velocity/velocity.ui.min.js?v=1.2.1' %} 15 | 16 | {% if theme.fancybox %} 17 | {% set js_vendors.fancybox = 'fancybox/source/jquery.fancybox.pack.js?v=2.1.5' %} 18 | {% endif %} 19 | {% if theme.canvas_nest %} 20 | {% set js_vendors.canvas_nest = 'canvas-nest/canvas-nest.min.js' %} 21 | {% endif %} 22 | 23 | {% if theme.three_waves %} 24 | {% set js_vendors.three = 'three/three.min.js' %} 25 | {% set js_vendors.three_waves = 'three/three-waves.min.js' %} 26 | {% endif %} 27 | 28 | {% for name, internal in js_vendors %} 29 | {% set internal_script = url_for(theme.vendors._internal) + '/' + internal %} 30 | 31 | {% endfor %} 32 | -------------------------------------------------------------------------------- /themes/next/source/css/_common/components/post/post-reward.styl: -------------------------------------------------------------------------------- 1 | #rewardButton { 2 | cursor: pointer; 3 | border: 0; 4 | outline: 0; 5 | border-radius: 100%; 6 | padding: 0; 7 | margin: 0; 8 | letter-spacing: normal; 9 | text-transform: none; 10 | text-indent: 0px; 11 | text-shadow: none; 12 | } 13 | #rewardButton span { 14 | display: inline-block; 15 | width: 80px; 16 | height: 35px; 17 | border-radius: 5px; 18 | color: #fff; 19 | font-weight: 400; 20 | font-style: normal; 21 | font-variant: normal; 22 | font-stretch: normal; 23 | font-size: 18px; 24 | font-family: "Microsoft Yahei"; 25 | background: #F44336; 26 | } 27 | #rewardButton span:hover{ 28 | background: #F7877F; 29 | } 30 | #QR{ 31 | padding-top:20px; 32 | } 33 | #QR a{ 34 | border:0; 35 | } 36 | #QR img{ 37 | width: 180px; 38 | max-width: 100%; 39 | display: inline-block; 40 | margin: 0.8em 2em 0 2em; 41 | } 42 | #wechat:hover p{ 43 | animation: roll 0.1s infinite linear; 44 | -webkit-animation: roll 0.1s infinite linear; 45 | -moz-animation: roll 0.1s infinite linear; 46 | } 47 | #alipay:hover p{ 48 | animation: roll 0.1s infinite linear; 49 | -webkit-animation: roll 0.1s infinite linear; 50 | -moz-animation: roll 0.1s infinite linear; 51 | } 52 | @keyframes roll { 53 | from { 54 | transform(rotateZ(30deg)); 55 | } 56 | to { 57 | transform(rotateZ(-30deg)); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /themes/next/source/css/_common/scaffolding/helpers.styl: -------------------------------------------------------------------------------- 1 | // 2 | // Helpers 3 | // ================================================= 4 | 5 | 6 | 7 | // Alignment 8 | .text-left { text-align: left; } 9 | .text-center { text-align: center; } 10 | .text-right { text-align: right; } 11 | .text-justify { text-align: justify; } 12 | .text-nowrap { white-space: nowrap; } 13 | 14 | 15 | // Transformation 16 | .text-lowercase { text-transform: lowercase; } 17 | .text-uppercase { text-transform: uppercase; } 18 | .text-capitalize { text-transform: capitalize; } 19 | 20 | 21 | // Center-align a block level element. 22 | .center-block { 23 | display: block; 24 | margin-left: auto; 25 | margin-right: auto; 26 | } 27 | 28 | 29 | // Clearfix. http://nicolasgallagher.com/micro-clearfix-hack/ 30 | .clearfix { 31 | clearfix(); 32 | } 33 | 34 | .pullquote { 35 | width: 45%; 36 | 37 | &.left { 38 | float: left; 39 | margin-left: 5px; 40 | margin-right: 10px; 41 | } 42 | 43 | &.right { 44 | float: right; 45 | margin-left: 10px; 46 | margin-right: 5px; 47 | } 48 | } 49 | 50 | .affix.affix.affix { position: fixed; } 51 | 52 | .translation { 53 | margin-top: -20px; 54 | font-size: 14px; 55 | color: $grey-dark; 56 | } 57 | 58 | // https://davidwalsh.name/detect-scrollbar-width 59 | .scrollbar-measure { 60 | width: 100px; 61 | height: 100px; 62 | overflow: scroll; 63 | position: absolute; 64 | top: -9999px; 65 | } 66 | 67 | .use-motion .motion-element { opacity: 0; } 68 | -------------------------------------------------------------------------------- /themes/next/layout/_third-party/comments/changyan.swig: -------------------------------------------------------------------------------- 1 | {% if theme.changyan.enable and theme.changyan.appid and theme.changyan.appkey %} 2 | {% if is_home() %} 3 | 4 | {% else %} 5 | 16 | 17 | {% endif %} 18 | {% endif %} 19 | -------------------------------------------------------------------------------- /source/_posts/JavaScript-中的函数柯里化-Currying.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: JavaScript 中的函数柯里化(Currying) 3 | date: 2017-06-23 01:47:32 4 | tags: JavaScript Funtional-Programming 5 | --- 6 | # JavaScript 中的函数柯里化(Crurring) 7 | 8 | 将一个多元的函数转换为嵌套一元函数的过程,我们称之为柯里化。函数柯里化通常与 9 | `闭包` 以及 `分步应用程序(partial application)` 混合在一起。把它们从场景中拆 10 | 分出来,我觉得会更容易理解一些。 11 | 12 | 13 | 14 | ## 元 15 | 16 | 按照参数的个数定义元的概念。如: 17 | 18 | ``` 19 | // 一元 20 | const identity = (x) => x 21 | 22 | // 两元 23 | 24 | const add = (x, y) => x +y 25 | 26 | // 多元 27 | 28 | const variadic = (x, ...rest) => ... 29 | ``` 30 | 31 | 由上面的定义我们知道,柯里化是指将多元参数转换为转换为一元函数的过程。为什么一 32 | 元函数这么重要呢?函数式语言 `ML` 以及 `Haskell` 所有函数必须只有一个参数,实现 33 | 多参的效果只能用 curry 技术。 34 | 35 | ## 柯里化 36 | 37 | 函数柯里化实际上是: 38 | 39 | ``` 40 | f: X × Y → R 41 | ``` 42 | 43 | 转换为: 44 | 45 | f': x -> (y -> R) 46 | 47 | 很容易将上面的表达式翻译为柯里化的 `add` 函数: 48 | 49 | ``` 50 | const add = x => y => x + y 51 | ``` 52 | 53 | 函数的调用方式由原来的 add(1,2) 变成了 add(1)(2)。注意每一次的参数拆解,都返回 54 | 了一个新的函数,可以连续的括号调用。 55 | 56 | ## 闭包与部分应用程序 57 | 58 | 对于已经 curry 的 add 函数,如果我们需要一个 +1 的功能,可以这样来做: 59 | 60 | ``` 61 | // curried add 62 | const add = x => y => x + y 63 | 64 | const increment = add(1) 65 | 66 | // 此时我们定义了一个 increment 函数,传了一个参数 1,相当于 67 | // 得到一个新函数 (y) => 1 + y, 继续使用这个新函数 68 | 69 | increment(2) // 3 70 | increment(3) // 4 71 | ``` 72 | 73 | 在定义 increment 函数时,我们定义了一个闭包。传入的参数 1 ,将会被以后调用的过 74 | 程利用。而 `increment = add(1)` 又是一个部分应用程序的例子。 75 | 76 | 所以 部分应用程序 和 curry 的区别是什么?部分应用程序利用了 curry 的技术,但是 77 | 又不去直接用括号调用到底,而是取一个中间变量。这样的好处是什么呢? 78 | 79 | 如果说,有一步需要一个很大的计算量,调用到底,每次都得计算。而部分用用程序却可 80 | 以,计算一次,以后通过闭包去拿这个值,性能会高一些。 81 | -------------------------------------------------------------------------------- /themes/next/source/css/_common/components/tags/note.styl: -------------------------------------------------------------------------------- 1 | // bs-callout 2 | // See: http://cpratt.co/twitter-bootstrap-callout-css-styles/ 3 | // =============================================== 4 | 5 | .note { 6 | padding: 20px; 7 | margin: 20px 0; 8 | border: 1px solid #eee; 9 | border-left-width: 5px; 10 | border-radius: 3px; 11 | } 12 | .note h2 13 | .note h3 14 | .note h4 15 | .note h5 16 | .note h6 { 17 | margin-top: 0; 18 | margin-bottom: 5px; 19 | } 20 | .note p:last-child { 21 | margin-bottom: 0; 22 | } 23 | .note code { 24 | border-radius: 3px; 25 | } 26 | .note+.note { 27 | margin-top: -5px; 28 | } 29 | .default { 30 | border-left-color: #777; 31 | } 32 | .default h2 33 | .default h3 34 | .default h4 35 | .default h5 36 | .default h6 { 37 | color: #777; 38 | } 39 | .primary { 40 | border-left-color: #428bca; 41 | } 42 | .primary h2 43 | .primary h3 44 | .primary h4 45 | .primary h5 46 | .primary h6 { 47 | color: #428bca; 48 | } 49 | .success { 50 | border-left-color: #5cb85c; 51 | } 52 | .success h2 53 | .success h3 54 | .success h4 55 | .success h5 56 | .success h6 { 57 | color: #5cb85c; 58 | } 59 | .danger { 60 | border-left-color: #d9534f; 61 | } 62 | .danger h2 63 | .danger h3 64 | .danger h4 65 | .danger h5 66 | .danger h6 { 67 | color: #d9534f; 68 | } 69 | .warning { 70 | border-left-color: #f0ad4e; 71 | } 72 | .warning h2 73 | .warning h3 74 | .warning h4 75 | .warning h5 76 | .warning h6 { 77 | color: #f0ad4e; 78 | } 79 | .info { 80 | border-left-color: #5bc0de; 81 | } 82 | .info h2 83 | .info h3 84 | .info h4 85 | .info h5 86 | .info h6 { 87 | color: #5bc0de; 88 | } 89 | -------------------------------------------------------------------------------- /themes/next/layout/page.swig: -------------------------------------------------------------------------------- 1 | {% extends '_layout.swig' %} 2 | {% import '_macro/sidebar.swig' as sidebar_template %} 3 | 4 | {% block title %} 5 | {% set page_title_suffix = ' | ' + config.title %} 6 | 7 | {% if page.type === "categories" and not page.title %} 8 | {{ __('title.category') + page_title_suffix }} 9 | {% elif page.type === "tags" and not page.title %} 10 | {{ __('title.tag') + page_title_suffix }} 11 | {% else %} 12 | {{ page.title + page_title_suffix }} 13 | {% endif %} 14 | {% endblock %} 15 | 16 | {% block content %} 17 | 18 |
19 | {% include '_partials/page-header.swig' %} 20 | {# tagcloud page support #} 21 | {% if page.type === "tags" %} 22 |
23 |
24 | {{ _p('counter.tag_cloud', site.tags.length) }} 25 |
26 |
27 | {{ tagcloud({min_font: 12, max_font: 30, amount: 200, color: true, start_color: '#ccc', end_color: '#111'}) }} 28 |
29 |
30 | {% elif page.type === 'categories' %} 31 |
32 |
33 | {{ _p('counter.categories', site.categories.length) }} 34 |
35 |
36 | {{ list_categories() }} 37 |
38 |
39 | {% else %} 40 | {{ page.content }} 41 | {% endif %} 42 |
43 | 44 | {% endblock %} 45 | 46 | {% block sidebar %} 47 | {{ sidebar_template.render(false) }} 48 | {% endblock %} 49 | -------------------------------------------------------------------------------- /source/_posts/too-many-open-files.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Too many open files in system 问题排查记录 3 | date: 2018-12-28 17:47:00 4 | tags: 5 | --- 6 | 7 | 同事新上线了一个日志 sdk。运行一段时间后导致线上服务器打开太多文件而拒绝服务。 8 | 9 | 原因很简单每一个日志实例化,都持有了一个写文件的流,写完没有关闭。 10 | 11 | 随着业务运行导致服务器崩溃。 12 | 13 | 14 | 15 | ## fd (file descriptor) 是什么? 16 | 17 | 我们先来介绍一下 fd,一个进程所有打开的文件可以通过 fd 查询。 18 | 19 | 举例来说,当一个程序(进程)要写文件时,会像操作系统申请权限。操作系统会授予一个标记(通常是数字)来指向所描述的文件。这个标记就是 fd。 20 | 21 | 在 centos 中,一个进程的所有打开的 fd 在 `/proc/进程id/fd` 下。 22 | 23 | ## 如何排查 24 | 25 | 比如一个 node 服务, 我们先找一下他的进程 id 26 | 27 | 28 | ``` 29 | ps aux | grep node 30 | 31 | ``` 32 | 33 | ![image](https://user-images.githubusercontent.com/3912408/50510523-04fc7600-0ac5-11e9-81a1-5b7f0bfae4b3.png) 34 | 35 | 第二列就是进程 id。有了进程 id 就可以查一下具体的 fd 36 | 37 | ``` 38 | sudo ls -l /proc/29027/fd 39 | ``` 40 | 41 | ![image](https://user-images.githubusercontent.com/3912408/50510359-59ebbc80-0ac4-11e9-8943-317478b2b71e.png) 42 | 43 | 当打开文件数量过多时,可以通过命令查看打开连接的总数: 44 | 45 | ``` 46 | sudo ls -l /proc/29027/fd | wc -l 47 | ``` 48 | 49 | ## 结论 50 | 51 | 从现象定位问题是比较简单的。上面写了一些排查还有测试过程。这里在描述一下解决方案: 52 | 53 | 在 nodejs 中,流是一个非常重要的概念。在日志这个场景中。我们打开一个流,日志直接往内部写就可以了。在进程退出或者日志路径切换过程中销毁并新建即可。而不需要每次都新建一个流。 54 | 55 | 所以用全局的流来写日志是一个不错的方案。即便是多进程,以及按等级分不同的流,它的复杂度也是 O(n)。高效并且可控。 56 | 57 | ``` 58 | 类似 appendFile 这种 buffer 形式写文件,每次写入都需要打开关闭,不适合来做日志。 59 | ``` 60 | 61 | ## 参考 62 | 63 | * [file descriptor](https://www.bottomupcs.com/file_descriptors.xhtml) 64 | * [fs.createWriteStream](https://nodejs.org/api/fs.html#fs_fs_createwritestream_path_options) 65 | 66 | 67 | ## ISSUE 68 | 有问题?来 [github](https://github.com/flyyang/blog/issues/12) 一起讨论。 -------------------------------------------------------------------------------- /themes/next/languages/zh-Hans.yml: -------------------------------------------------------------------------------- 1 | title: 2 | archive: 归档 3 | category: 分类 4 | tag: 标签 5 | schedule: 日程表 6 | 7 | author: 博主 8 | 9 | menu: 10 | home: 首页 11 | archives: 归档 12 | categories: 分类 13 | tags: 标签 14 | about: 关于 15 | search: 搜索 16 | schedule: 日程表 17 | sitemap: 站点地图 18 | commonweal: 公益404 19 | sharing: 分享 20 | contribute: 贡献 21 | 22 | sidebar: 23 | overview: 站点概览 24 | toc: 文章目录 25 | 26 | post: 27 | created: 创建于 28 | modified: 更新于 29 | sticky: 置顶 30 | posted: 发表于 31 | in: 分类于 32 | read_more: 阅读全文 33 | untitled: 未命名 34 | toc_empty: 此文章未包含目录 35 | visitors: 阅读次数 36 | wordcount: 字数统计 37 | min2read: 阅读时长 38 | copyright: 39 | author: 本文作者 40 | link: 本文链接 41 | license_title: 版权声明 42 | license_content: '本博客所有文章除特别声明外,均采用 43 | %s 许可协议。转载请注明出处!' 44 | 45 | page: 46 | totally: 共有 47 | tags: 标签 48 | 49 | footer: 50 | powered: "由 %s 强力驱动" 51 | theme: 主题 52 | 53 | counter: 54 | tag_cloud: 55 | zero: 暂无标签 56 | one: 目前共计 1 个标签 57 | other: "目前共计 %d 个标签" 58 | 59 | categories: 60 | zero: 暂无分类 61 | one: 目前共计 1 个分类 62 | other: "目前共计 %d 个分类" 63 | 64 | archive_posts: 65 | zero: 暂无日志。 66 | one: 目前共计 1 篇日志。 67 | other: "目前共计 %d 篇日志。" 68 | 69 | state: 70 | posts: 日志 71 | pages: 页面 72 | tags: 标签 73 | categories: 分类 74 | 75 | search: 76 | placeholder: 搜索... 77 | 78 | cheers: 79 | um: 嗯.. 80 | ok: OK 81 | nice: 好 82 | good: 很好 83 | great: 非常好 84 | excellent: 太棒了 85 | 86 | keep_on: 继续努力。 87 | 88 | symbol: 89 | comma: ', ' 90 | period: '。 ' 91 | colon: ':' 92 | -------------------------------------------------------------------------------- /themes/next/layout/_third-party/comments/duoshuo.swig: -------------------------------------------------------------------------------- 1 | {% if (theme.duoshuo and theme.duoshuo.shortname) or theme.duoshuo_shortname %} 2 | 3 | {% if theme.duoshuo %} 4 | {% set duoshuo_shortname = theme.duoshuo.shortname %} 5 | {% else %} 6 | {% set duoshuo_shortname = theme.duoshuo_shortname %} 7 | {% endif %} 8 | 9 | 21 | 22 | {% if theme.duoshuo_info.ua_enable %} 23 | {% if theme.duoshuo_info.admin_enable %} 24 | {% set ua_parser_internal = url_for(theme.vendors._internal) + '/ua-parser-js/dist/ua-parser.min.js?v=0.7.9' %} 25 | 26 | 27 | {% endif %} 28 | {% set ua_parser_internal = url_for(theme.vendors._internal) + '/ua-parser-js/dist/ua-parser.min.js?v=0.7.9' %} 29 | 30 | 31 | {% endif %} 32 | 33 | {% endif %} 34 | -------------------------------------------------------------------------------- /themes/next/source/css/_schemes/Mist/_posts-expanded.styl: -------------------------------------------------------------------------------- 1 | // Post Expanded 2 | // -------------------------------------------------- 3 | .posts-expand { 4 | padding-top: 0; 5 | 6 | .post-title, 7 | .post-meta { 8 | text-align: $site-meta-text-align; 9 | +mobile() { text-align: center; } 10 | } 11 | .post-eof { display: none; } 12 | 13 | .post { margin-top: 120px; } 14 | .post:first-child { margin-top: 0; } 15 | 16 | .post-meta { 17 | margin-top: 5px; 18 | margin-bottom: 20px; 19 | } 20 | 21 | .post-title { 22 | position: relative; 23 | font-size: $font-size-headings-base; 24 | font-weight: 400; 25 | +mobile() { font-size: $font-size-headings-smaller; } 26 | +desktop-large() { font-size: $font-size-headings-large; } 27 | } 28 | .post-title:hover:before { background: $black-deep; } 29 | 30 | .post-body img { margin: 0; } 31 | 32 | .post-tags { 33 | text-align: left; 34 | a { 35 | padding: 1px 5px; 36 | background: $whitesmoke; 37 | border-bottom: none; 38 | } 39 | a:hover { background: $grey-light; } 40 | } 41 | .post-nav { margin-top: 40px; } 42 | } 43 | 44 | .post-button { 45 | margin-top: 20px; 46 | text-align: left; 47 | 48 | a { 49 | margin: 0 8px 8px 0 !important; 50 | padding: 0; 51 | font-size: $font-size-base; 52 | color: $grey-dim; 53 | background: none; 54 | border: none; 55 | border-bottom: 2px solid $grey-dim; 56 | transition-property: border; 57 | 58 | +mobile() { font-size: $font-size-small; } 59 | +desktop-large() { font-size: $font-size-large; } 60 | 61 | 62 | &:hover { border-bottom-color: $black-deep; } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /themes/next/source/lib/canvas-nest/canvas-nest.min.js: -------------------------------------------------------------------------------- 1 | !function(){function o(w,v,i){return w.getAttribute(v)||i}function j(i){return document.getElementsByTagName(i)}function l(){var i=j("script"),w=i.length,v=i[w-1];return{l:w,z:o(v,"zIndex",-1),o:o(v,"opacity",0.5),c:o(v,"color","0,0,0"),n:o(v,"count",99)}}function k(){r=u.width=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,n=u.height=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight}function b(){e.clearRect(0,0,r,n);var w=[f].concat(t);var x,v,A,B,z,y;t.forEach(function(i){i.x+=i.xa,i.y+=i.ya,i.xa*=i.x>r||i.x<0?-1:1,i.ya*=i.y>n||i.y<0?-1:1,e.fillRect(i.x-0.5,i.y-0.5,1,1);for(v=0;v=x.max/2&&(i.x-=0.03*B,i.y-=0.03*z),A=(x.max-y)/x.max,e.beginPath(),e.lineWidth=A/2,e.strokeStyle="rgba("+s.c+","+(A+0.2)+")",e.moveTo(i.x,i.y),e.lineTo(x.x,x.y),e.stroke())}}w.splice(w.indexOf(i),1)}),m(b)}var u=document.createElement("canvas"),s=l(),c="c_n"+s.l,e=u.getContext("2d"),r,n,m=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(i){window.setTimeout(i,1000/45)},a=Math.random,f={x:null,y:null,max:20000};u.id=c;u.style.cssText="position:fixed;top:0;left:0;z-index:"+s.z+";opacity:"+s.o;j("body")[0].appendChild(u);k(),window.onresize=k;window.onmousemove=function(i){i=i||window.event,f.x=i.clientX,f.y=i.clientY},window.onmouseout=function(){f.x=null,f.y=null};for(var t=[],p=0;s.n>p;p++){var h=a()*r,g=a()*n,q=2*a()-1,d=2*a()-1;t.push({x:h,y:g,xa:q,ya:d,max:6000})}setTimeout(function(){b()},100)}(); -------------------------------------------------------------------------------- /themes/next/README.md: -------------------------------------------------------------------------------- 1 | # NexT 2 | 3 | > 精于心,简于形 4 | 5 | 在线预览 Preview | NexT 使用文档 | [English Documentation](README.en.md) 6 | 7 | [![Join the chat at https://gitter.im/iissnan/hexo-theme-next](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/iissnan/hexo-theme-next?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) 8 | 9 | ![NexT Schemes](http://iissnan.com/nexus/next/next-schemes.jpg) 10 | 11 | 12 | ## 浏览器支持 Browser support 13 | 14 | ![Browser support](http://iissnan.com/nexus/next/browser-support.png) 15 | 16 | 17 | ## 贡献 Contributing 18 | 19 | 接受各种形式的贡献,包括不限于提交问题与需求,修复代码。等待您的`Pull Request`。 20 | 21 | Any types of contribution are welcome. Thanks. 22 | 23 | ## 开发 Development 24 | 25 | NexT 主旨在于简洁优雅且易于使用,所以首先要尽量确保 NexT 的简洁易用性。 26 | 27 | NexT is built for easily use with elegant appearance. First things first, always keep things simple. 28 | 29 | ## [开发历史 Changelog](https://github.com/iissnan/hexo-theme-next/wiki/Changelog) 30 | 31 | [![hexo-image]][hexo-url] 32 | [![bower-image]][bower-url] 33 | [![jquery-image]][jquery-url] 34 | [![velocity-image]][velocity-url] 35 | 36 | [hexo-image]: http://img.shields.io/badge/Hexo-2.4+-2BAF2B.svg?style=flat-square 37 | [hexo-url]: http://hexo.io 38 | [bower-image]: http://img.shields.io/badge/Bower-*-2BAF2B.svg?style=flat-square 39 | [bower-url]: http://bower.io 40 | [jquery-image]: https://img.shields.io/badge/jquery-2.1-2BAF2B.svg?style=flat-square 41 | [jquery-url]: http://jquery.com/ 42 | [velocity-image]: https://img.shields.io/badge/Velocity-1.2-2BAF2B.svg?style=flat-square 43 | [velocity-url]: http://julian.com/research/velocity/ 44 | -------------------------------------------------------------------------------- /themes/next/layout/_partials/comments.swig: -------------------------------------------------------------------------------- 1 | {% if page.comments %} 2 |
3 | {% if (theme.duoshuo and theme.duoshuo.shortname) or theme.duoshuo_shortname %} 4 |
6 |
7 | {% elseif theme.facebook_sdk.enable and theme.facebook_comments_plugin.enable %} 8 |
13 |
14 | {% elseif theme.vkontakte_api.enable and theme.vkontakte_api.comments %} 15 |
16 | {% elseif theme.disqus.enable %} 17 |
18 | 22 |
23 | {% elseif theme.hypercomments_id %} 24 |
25 | {% elseif theme.gentie_productKey %} 26 |
27 | {% elseif theme.youyan_uid %} 28 |
29 | {% elseif theme.livere_uid %} 30 |
31 | {% elseif theme.changyan.appid and theme.changyan.appkey %} 32 |
33 | {% endif %} 34 |
35 | {% endif %} 36 | -------------------------------------------------------------------------------- /source/_posts/指定Python源文件编码-why-where-and-what.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: '指定Python源文件编码, why,where,what and who' 3 | date: 2017-05-09 11:17:07 4 | tags: Python 5 | --- 6 | 在看 Python 源代码的时候,经常会碰到如下注释: 7 | 8 | ``` bash 9 | #!/usr/bin/env python 10 | # -*- coding: utf-8 -*- 11 | ``` 12 | 13 | ``` 14 | # -*- coding: utf-8 -*- 15 | ``` 16 | 17 | 见名知意,大概可以猜测到本文件是utf-8编码,但是为什么呢? 18 | 19 | 20 | 21 | ## why 22 | 23 | Python 是一门解释性语言。在正式执行之前,需要经过Decoding -> Tokenizing -> Parsing -> AST -> Compiling这么多流程。 24 | 25 | 解释器如何在Decoding阶段就知道文件如何编码的呢?[PEP 263](https://www.python.org/dev/peps/pep-0263/) 提出了解决方案:在源文件中以上面的格式指定,解释器按照格式解析出对应的编码。 26 | 27 | 如果没有指定编码呢? 28 | 29 | Python 2.x 默认会按照 `ascii`读取。所以,如果在 2.x 源码中加入中文,会报编码错误。 30 | 31 | Python 3.x 则默认读取 `utf-8` 模式。 32 | 33 | ## where 34 | 35 | 源文件第 `1` 或者 `2` 行。 36 | 37 | ## what 38 | 39 | 指定的格式必须满足以下格式 40 | 41 | [PEP 263](https://www.python.org/dev/peps/pep-0263/): 42 | ``` 43 | ^[ \t\v]*#.*?coding[:=][ \t]*([-_.a-zA-Z0-9]+) 44 | ``` 45 | 或, [Python Language Specification](https://docs.python.org/3/reference/lexical_analysis.html#encoding-declarations): 46 | 47 | ``` 48 | coding[=:]\s*([-\w.]+) 49 | ``` 50 | 51 | 解释一下这个正则表达式: 52 | 所有的编码指定必须在一行内。 53 | 54 | 不必以 # 号开头,# 号前可以有0个或者多个空白符。# 到coding 可以是除换行符意外的任何字符。coding后可以是 `=` 或者 `:` , 再之后是可选的空白符,然后是编码(参考[Python encoding list](https://docs.python.org/2.4/lib/standard-encodings.html))。 55 | 56 | ## who 57 | 58 | 指定的格式给谁看的呢? 59 | 60 | 1. 主要是给解释器看的。 61 | 2. 有的编辑器也能理解某种格式的注释。 62 | 3. 给人看。 63 | 64 | 针对第2点: 65 | Emacs用户: 66 | 67 | ``` bash 68 | # -*- coding: utf-8 -*- 69 | ``` 70 | Vim 用户: 71 | 72 | ``` bash 73 | # vim:fileencoding= 74 | ``` 75 | 76 | > 参考: [correct-way-to-define-python-source-code-encoding](http://stackoverflow.com/questions/728891/correct-way-to-define-python-source-code-encoding`) 77 | -------------------------------------------------------------------------------- /themes/next/layout/_partials/head/external-fonts.swig: -------------------------------------------------------------------------------- 1 | {% if theme.font.enable %} 2 | 3 | {% set font_config = theme.font %} 4 | {% set font_families = '' %} 5 | {% set font_styles = ':300,300italic,400,400italic,700,700italic' %} 6 | {% set font_found = false %} 7 | 8 | {% if font_config.global.family and font_config.global.external %} 9 | {% set font_families += font_config.global.family + font_styles %} 10 | {% set font_found = true %} 11 | {% endif %} 12 | 13 | {% if font_config.headings.family and font_config.headings.external %} 14 | {% if font_found %} 15 | {% set font_families += '|' %} 16 | {% endif %} 17 | 18 | {% set font_families += font_config.headings.family + font_styles %} 19 | {% endif %} 20 | 21 | {% if font_config.posts.family and font_config.posts.external %} 22 | {% if font_found %} 23 | {% set font_families += '|' %} 24 | {% endif %} 25 | 26 | {% set font_families += font_config.posts.family + font_styles %} 27 | {% endif %} 28 | 29 | {% if font_config.logo.family and font_config.logo.external %} 30 | {% if font_found %} 31 | {% set font_families += '|' %} 32 | {% endif %} 33 | 34 | {% set font_families += font_config.logo.family + font_styles %} 35 | {% endif %} 36 | 37 | {% if font_config.codes.family and font_config.codes.external %} 38 | {% if font_found %} 39 | {% set font_families += '|' %} 40 | {% endif %} 41 | 42 | {% set font_families += font_config.codes.family + font_styles %} 43 | {% endif %} 44 | 45 | {% if font_families !== '' %} 46 | {% set font_families += '&subset=latin,latin-ext' %} 47 | {% set font_host = font_config.host | default('//fonts.googleapis.com') %} 48 | 49 | {% endif %} 50 | 51 | {% endif %} 52 | -------------------------------------------------------------------------------- /source/_posts/GNU-Readline-让命令行编辑倍速提升.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'GNU Readline, 让命令行编辑倍速提升' 3 | date: 2017-05-03 16:02:10 4 | tags: efficiency 5 | --- 6 | 7 | 你有没有遇到过这种场景?写了很长一串命令,运行时发现第一个字母写错了。然后一个字符一个字符的删除,改完再重新输入一遍。 8 | 9 | 没有必要!!!比如上面的问题,你仅仅需要`Control + a` 回到开头位置修正你的问题即可。这种在行内编辑文本的功能通常是由 GNU Readline提供的。 10 | 11 | 12 | 13 | ## GNU Readline是什么? 14 | 15 | GNU 的一个库,提供行内编辑,历史管理等功能。bash, mysql, zsh, python, node等的shell中都有类似的功能。 16 | 17 | ## 常用的 Shotcuts 18 | 19 | 虽然 GNU Readline 作为一个类库存在,但我们并不关注如何利用其接口实现功能。此处只关注如何使用。感谢 Readline,使我们在不同的 shell 中有一致的体验。 20 | 21 | 22 | 23 | ### Moving 24 | 25 | | Command | Description | 26 | | --- | --- | 27 | | Ctrl-a | 移至行首 | 28 | | Ctrl-e | 移至行尾 | 29 | | Ctrl-f | 向前移动一个字符 | 30 | | Ctrl-b | 向后移动一个字符 | 31 | | Alt-f | 向前移动一个单词。 | 32 | | Alt-b | 向后移动一个单词。 | 33 | | Ctrl-l | 清屏 | 34 | 35 | 36 | ### Editing 37 | 38 | | Command | Description | 39 | | --- | --- | 40 | | Ctrl-d | 删除光标下的字符 | 41 | | Ctrl-t | 交换字符位置 | 42 | | Alt-t | 交换单词位置 | 43 | | Alt-u | 将光标开始后的单词大写。 | 44 | | Alt-l | 与上相反 | 45 | | Alt-c | 大写当前单词(从光标处开始)。 | 46 | 47 | 48 | ### Cutting and Pasting 49 | 50 | | Command | Description | 51 | | --- | --- | 52 | | Ctrl-k | 剪切到行尾 | 53 | | Ctrl-u | 剪切到行首 | 54 | | Alt-d | 剪切到词尾 | 55 | | Ctrl-w | 剪切到词首 | 56 | | Alt-\ | 删除光标附近空白 | 57 | | Ctrl-y | 粘贴 | 58 | | Alt-y | 交换粘贴 | 59 | 60 | 61 | ### History 62 | 63 | | Command | Description | 64 | | --- | --- | 65 | | Ctl-p | 前一个命令 | 66 | | Ctl-n | 下一个命令 | 67 | | Alt-< | 第一个命令 | 68 | | Alt-> | 最后一个命令 | 69 | | Ctrl-r | 向后搜索 | 70 | | Ctrl-s | 向前搜索 | 71 | | Alt-p | 按字符串向前搜索 | 72 | | Alt-n | 按字符串向后搜索 | 73 | 74 | 75 | ### Misc 76 | 77 | | Command | Description | 78 | | --- | --- | 79 | | Alt-# | 注释当前行,并跳到下一行 | 80 | | Ctrl-] | 向后搜索字符 | 81 | | Ctrl-Alt-] | 向前搜索字符 | 82 | 83 | 84 | > 有些终端 Alt 需要用 Esc 来替换。如果想使用 alt, 以 Xshell 为例,可以在“File -> Properties -> Terminal -> Keyboard” 中 的 `Use Alt as Meta key` 勾选即可。 85 | -------------------------------------------------------------------------------- /_config.yml: -------------------------------------------------------------------------------- 1 | # Hexo Configuration 2 | ## Docs: https://hexo.io/docs/configuration.html 3 | ## Source: https://github.com/hexojs/hexo/ 4 | 5 | # Site 6 | title: flyyang's Blog 7 | subtitle: 8 | description: 9 | author: 10 | language: zh-Hans 11 | timezone: 12 | 13 | # URL 14 | ## If your site is put in a subdirectory, set url as 'http://yoursite.com/child' and root as '/child/' 15 | url: https://flyyang.me 16 | root: / 17 | permalink: :year/:month/:day/:title/ 18 | permalink_defaults: 19 | 20 | # Directory 21 | source_dir: source 22 | public_dir: public 23 | tag_dir: tags 24 | archive_dir: archives 25 | category_dir: categories 26 | code_dir: downloads/code 27 | i18n_dir: :lang 28 | skip_render: 29 | 30 | # Writing 31 | new_post_name: :title.md # File name of new posts 32 | default_layout: post 33 | titlecase: false # Transform title into titlecase 34 | external_link: true # Open external links in new tab 35 | filename_case: 0 36 | render_drafts: false 37 | post_asset_folder: false 38 | relative_link: false 39 | future: true 40 | highlight: 41 | enable: true 42 | line_number: true 43 | auto_detect: false 44 | tab_replace: 45 | 46 | # Category & Tag 47 | default_category: uncategorized 48 | category_map: 49 | tag_map: 50 | 51 | # Date / Time format 52 | ## Hexo uses Moment.js to parse and display date 53 | ## You can customize the date format as defined in 54 | ## http://momentjs.com/docs/#/displaying/format/ 55 | date_format: YYYY-MM-DD 56 | time_format: HH:mm:ss 57 | 58 | # Pagination 59 | ## Set per_page to 0 to disable pagination 60 | per_page: 5 61 | pagination_dir: page 62 | 63 | # Extensions 64 | ## Plugins: https://hexo.io/plugins/ 65 | ## Themes: https://hexo.io/themes/ 66 | theme: next 67 | 68 | # Deployment 69 | ## Docs: https://hexo.io/docs/deployment.html 70 | deploy: 71 | type: git 72 | repository: https://github.com/flyyang/flyyang.github.io 73 | branch: master 74 | -------------------------------------------------------------------------------- /themes/next/source/js/src/exturl.js: -------------------------------------------------------------------------------- 1 | /* global NexT: true */ 2 | 3 | $(document).ready(function () { 4 | 5 | // Create Base64 Object 6 | var Base64={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encode:function(e){var t="";var n,r,i,s,o,u,a;var f=0;e=Base64._utf8_encode(e);while(f>2;o=(n&3)<<4|r>>4;u=(r&15)<<2|i>>6;a=i&63;if(isNaN(r)){u=a=64}else if(isNaN(i)){a=64}t=t+this._keyStr.charAt(s)+this._keyStr.charAt(o)+this._keyStr.charAt(u)+this._keyStr.charAt(a)}return t},decode:function(e){var t="";var n,r,i;var s,o,u,a;var f=0;e=e.replace(/[^A-Za-z0-9+/=]/g,"");while(f>4;r=(o&15)<<4|u>>2;i=(u&3)<<6|a;t=t+String.fromCharCode(n);if(u!=64){t=t+String.fromCharCode(r)}if(a!=64){t=t+String.fromCharCode(i)}}t=Base64._utf8_decode(t);return t},_utf8_encode:function(e){e=e.replace(/rn/g,"n");var t="";for(var n=0;n127&&r<2048){t+=String.fromCharCode(r>>6|192);t+=String.fromCharCode(r&63|128)}else{t+=String.fromCharCode(r>>12|224);t+=String.fromCharCode(r>>6&63|128);t+=String.fromCharCode(r&63|128)}}return t},_utf8_decode:function(e){var t="";var n=0;var r=c1=c2=0;while(n191&&r<224){c2=e.charCodeAt(n+1);t+=String.fromCharCode((r&31)<<6|c2&63);n+=2}else{c2=e.charCodeAt(n+1);c3=e.charCodeAt(n+2);t+=String.fromCharCode((r&15)<<12|(c2&63)<<6|c3&63);n+=3}}return t}}; 7 | 8 | $('.exturl').on('click', function () { 9 | var $exturl = $(this).attr('data-url'); 10 | var $decurl = Base64.decode($exturl); 11 | window.open($decurl, '_blank'); 12 | return false; 13 | }); 14 | 15 | }); 16 | -------------------------------------------------------------------------------- /themes/next/languages/en.yml: -------------------------------------------------------------------------------- 1 | title: 2 | archive: Archive 3 | category: Category 4 | tag: Tag 5 | schedule: Schedule 6 | 7 | author: Author 8 | 9 | menu: 10 | home: Home 11 | archives: Archives 12 | categories: Categories 13 | tags: Tags 14 | about: About 15 | search: Search 16 | schedule: Schedule 17 | sitemap: Sitemap 18 | commonweal: Commonweal 404 19 | 20 | sidebar: 21 | overview: Overview 22 | toc: Table of Contents 23 | 24 | post: 25 | created: Post created 26 | modified: Post modified 27 | sticky: Sticky 28 | posted: Posted on 29 | in: In 30 | more: more 31 | read_more: Read more 32 | untitled: Untitled 33 | toc_empty: This post does not have a Table of Contents 34 | visitors: Visitors 35 | wordcount: Words count in article 36 | min2read: Reading time 37 | copyright: 38 | author: Post author 39 | link: Post link 40 | license_title: Copyright Notice 41 | license_content: 'All articles in this blog are licensed under 42 | %s unless stating additionally.' 43 | 44 | page: 45 | totally: Totally 46 | tags: tags 47 | 48 | footer: 49 | powered: "Powered by %s" 50 | theme: Theme 51 | 52 | counter: 53 | tag_cloud: 54 | zero: No tags 55 | one: 1 tag in total 56 | other: "%d tags in total" 57 | 58 | categories: 59 | zero: No categories 60 | one: 1 category in total 61 | other: "%d categories in total" 62 | 63 | archive_posts: 64 | zero: No posts. 65 | one: 1 post. 66 | other: "%d posts in total." 67 | 68 | state: 69 | posts: posts 70 | pages: pages 71 | tags: tags 72 | categories: categories 73 | 74 | search: 75 | placeholder: Searching... 76 | 77 | cheers: 78 | um: Um.. 79 | ok: OK 80 | nice: Nice 81 | good: Good 82 | great: Great 83 | excellent: Excellent 84 | 85 | keep_on: Keep on posting. 86 | 87 | symbol: 88 | comma: ', ' 89 | period: '. ' 90 | colon: ':' 91 | -------------------------------------------------------------------------------- /source/_posts/javascript中的microtask与task.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: JavaScript中的microtask与task 3 | date: 2017-03-07 01:48:35 4 | tags: 5 | - javascript 6 | - microtask 7 | - task 8 | - event loop 9 | --- 10 | 11 | [Philip Roberts](https://www.youtube.com/watch?v=8aGhZQkoFbQ)的一个演讲对 JavaScript 运行机制做了一个不错的介绍。其中讲到了task queue,但并没有覆盖关于microtask的问题,这里对microtask做下简单介绍。 12 | 13 | 14 | 15 | 先看一段代码: 16 | 17 | ``` javascript 18 | console.log('1') 19 | 20 | setTimeout(function(){ 21 | console.log('2') 22 | }, 0) 23 | 24 | Promise.resolve().then(function() { 25 | console.log('3') 26 | }) 27 | 28 | Promise.resolve().then(function() { 29 | console.log('4') 30 | }) 31 | 32 | console.log('5') 33 | ``` 34 | 该段代码打印什么结果?答案是: 1,5,3,4,2。 35 | 36 | 下面我们来分析一下这段代码。 37 | 38 | 由于 JavaScript 是单线程的,所以它只有一个 Call Stack,使得 JavaScript 在执行时有一个非常重要的特性:`run to complete`,只要运行就直到完成。另外,JavaScript 编译器并不会做太多的事情,比如异步请求、事件操作、`setTimeout`、`Promise`等,并不会自己直接等待处理, 39 | 而是交由其宿主代理。 40 | 41 | ![event loop](/public/images/javascript_event_loop.png) 42 | 43 | 参照上图和上面的解释,很容易得出。先输出1和5。 44 | 45 | setTimeOut和Promise哪个先输出呢,答案是Promise。Why? Promise 属于一个microtask。Eventloop在执行完堆栈,或者一个task后,会**优先**询问microtask queue,如果队列中有任务要执行,则执行,一直到队列为空,然后再执行下一个task(每一个microtask、task都遵循`run to complete规则)。 46 | 47 | 所以以上会优先输出3,4,然后是2。 48 | 49 | Why microtask? 有时候task太重了,每一个task结束后,都会重新渲染页面。microtask比task拥有更高的优先级,可以做一些比较有意思的事情。 50 | 51 | ## 常见的一些task分类 52 | 53 | macrotasks(task): setTimeout, setInterval, setImmediate, I/O, UI rendering 54 | microtasks: process.nextTick, Promises, Object.observe, MutationObserver 55 | 56 | ## 参考 57 | 58 | * http://stackoverflow.com/questions/25915634/difference-between-microtask-and-macrotask-within-an-event-loop-context 59 | * https://jakearchibald.com/2015/tasks-microtasks-queues-and-schedules/ 60 | * https://html.spec.whatwg.org/multipage/webappapis.html#event-loop-processing-model 61 | * https://www.zhihu.com/question/55364497 62 | * https://www.youtube.com/watch?v=8aGhZQkoFbQ 63 | -------------------------------------------------------------------------------- /themes/next/source/css/_schemes/Mist/index.styl: -------------------------------------------------------------------------------- 1 | // 2 | // Mist scheme 3 | // ================================================= 4 | 5 | @import "_base"; 6 | @import "outline/outline"; 7 | @import "_header"; 8 | @import "_logo"; 9 | @import "_menu"; 10 | @import "_search.styl"; 11 | @import "_posts-expanded"; 12 | @import "sidebar/sidebar-blogroll"; 13 | 14 | 15 | // Components 16 | // -------------------------------------------------- 17 | .btn { 18 | padding: 0 10px; 19 | border-width: 2px; 20 | border-radius: 0; 21 | } 22 | 23 | .headband { display: none; } 24 | 25 | 26 | // Search 27 | // -------------------------------------------------- 28 | .site-search { 29 | position: relative; 30 | float: right; 31 | margin-top: 5px; 32 | padding-top: 3px; 33 | 34 | +mobile() { 35 | float: none; 36 | padding: 0 10px; 37 | } 38 | } 39 | 40 | 41 | // Page - Container 42 | // -------------------------------------------------- 43 | .container .main-inner { 44 | +mobile() { width: auto; } 45 | } 46 | 47 | 48 | // Page - Post details 49 | // -------------------------------------------------- 50 | .page-post-detail { 51 | .post-title, 52 | .post-meta { text-align: center; } 53 | 54 | .post-title:before { display: none; } 55 | 56 | .post-meta { margin-bottom: 60px; } 57 | } 58 | 59 | 60 | // Pagination 61 | // -------------------------------------------------- 62 | .pagination { 63 | margin: 120px 0 0; 64 | text-align: left; 65 | 66 | +mobile() { 67 | margin: 80px 10px 0; 68 | text-align: center; 69 | } 70 | } 71 | 72 | // Footer 73 | // -------------------------------------------------- 74 | .footer { 75 | margin-top: 80px; 76 | padding: 10px 0; 77 | background: $whitesmoke; 78 | color: $grey-dim; 79 | } 80 | .footer-inner { 81 | margin: 0 auto; 82 | text-align: left; 83 | 84 | +mobile() { 85 | width: auto; 86 | text-align: center; 87 | } 88 | } 89 | 90 | // Helpers 91 | // -------------------------------------------------- 92 | -------------------------------------------------------------------------------- /themes/next/source/lib/jquery_lazyload/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to Lazy Load 2 | 3 | ## Only one feature or change per pull request 4 | 5 | Make pull requests only one feature or change at the time. For example you have fixed a bug. You also have optimized some code. Optimization is not related to a bug. These should be submitted as separate pull requests. This way I can easily choose what to include. It is also easier to understand the code changes. Commit messages should be descriptive and full sentences. 6 | 7 | Do not commit minified versions. Do not touch the version number. Make the pull requests against [1.9.x branch](https://github.com/tuupola/jquery_lazyload/commits/1.9.x). 8 | 9 | ## Write meaningful commit messages 10 | 11 | Proper commit message is full sentence. It starts with capital letter but does not end with period. Headlines do not end with period. The GitHub default `Update filename.js` is not enough. When needed include also longer explanation what the commit does. 12 | 13 | ``` 14 | Capitalized, short (50 chars or less) summary 15 | 16 | More detailed explanatory text, if necessary. Wrap it to about 72 17 | characters or so. In some contexts, the first line is treated as the 18 | subject of an email and the rest of the text as the body. The blank 19 | line separating the summary from the body is critical (unless you omit 20 | the body entirely); tools like rebase can get confused if you run the 21 | two together. 22 | ``` 23 | 24 | When in doubt see Tim Pope's blogpost [A Note About Git Commit Messages](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html) 25 | 26 | ## Follow the existing coding standards 27 | 28 | When contributing to open source project it is polite to follow the original authors coding standars. They might be different than yours. It is not a holy war. Just follow then original. 29 | 30 | ```javascript 31 | var snake_case = "something"; 32 | 33 | function camelCase(options) { 34 | } 35 | 36 | if (true !== false) { 37 | console.log("here be dragons"); 38 | } 39 | ``` 40 | -------------------------------------------------------------------------------- /themes/next/source/lib/jquery_lazyload/README.md: -------------------------------------------------------------------------------- 1 | # Lazy Load Plugin for jQuery 2 | 3 | Lazy Load delays loading of images in long web pages. Images outside of viewport wont be loaded before user scrolls to them. This is opposite of image preloading. 4 | 5 | Using Lazy Load on long web pages containing many large images makes the page load faster. Browser will be in ready state after loading visible images. In some cases it can also help to reduce server load. 6 | 7 | Lazy Load is inspired by [YUI ImageLoader](http://developer.yahoo.com/yui/imageloader/) Utility by Matt Mlinac. 8 | 9 | ## How to Use? 10 | 11 | Lazy Load depends on jQuery. Include them both in end of your HTML code: 12 | 13 | ```html 14 | 15 | 16 | ``` 17 | 18 | You must alter your HTML code. URL of the real image must be put into data-original attribute. It is good idea to give Lazy Loaded image a specific class. This way you can easily control which images plugin is binded to. Note that you should have width and height attributes in your image tag. 19 | 20 | ```html 21 | 22 | ``` 23 | 24 | then in your code do: 25 | 26 | ```js 27 | $("img.lazy").lazyload(); 28 | ``` 29 | 30 | This causes all images of class lazy to be lazy loaded. 31 | 32 | More information on [Lazy Load](http://www.appelsiini.net/projects/lazyload) project page. 33 | 34 | ## Install 35 | 36 | You can install with [bower](http://bower.io/) or [npm](https://www.npmjs.com/). 37 | 38 | 39 | ```sh 40 | $ bower install jquery.lazyload 41 | $ npm install jquery-lazyload 42 | ``` 43 | 44 | 45 | # License 46 | 47 | All code licensed under the [MIT License](http://www.opensource.org/licenses/mit-license.php). All images licensed under [Creative Commons Attribution 3.0 Unported License](http://creativecommons.org/licenses/by/3.0/deed.en_US). In other words you are basically free to do whatever you want. Just don't remove my name from the source. 48 | 49 | -------------------------------------------------------------------------------- /themes/next/layout/archive.swig: -------------------------------------------------------------------------------- 1 | {% extends '_layout.swig' %} 2 | {% import '_macro/post-collapse.swig' as post_template %} 3 | {% import '_macro/sidebar.swig' as sidebar_template %} 4 | 5 | {% block title %} {{ __('title.archive') }} | {{ config.title }} {% endblock %} 6 | 7 | {% block page_class %} page-archive {% endblock %} 8 | 9 | {% block content %} 10 | 11 |
12 | 13 | 14 | 15 | {% set cheers %} 16 | {% set posts_length = site.posts.length %} 17 | {% if posts_length > 210 %} {% set cheers = 'excellent' %} 18 | {% elif posts_length > 130 %} {% set cheers = 'great' %} 19 | {% elif posts_length > 80 %} {% set cheers = 'good' %} 20 | {% elif posts_length > 50 %} {% set cheers = 'nice' %} 21 | {% elif posts_length > 30 %} {% set cheers = 'ok' %} 22 | {% else %} 23 | {% set cheers = 'um' %} 24 | {% endif %} 25 | {{ __('cheers.' + cheers) }}! {{ _p("counter.archive_posts", site.posts.length) }} {{ __('keep_on') }} 26 | 27 | 28 | {% for post in page.posts %} 29 | 30 | {# Show year #} 31 | {% set year %} 32 | {% set post.year = date(post.date, 'YYYY') %} 33 | 34 | {% if post.year !== year %} 35 | {% set year = post.year %} 36 |
37 |

{{ year }}

38 |
39 | {% endif %} 40 | {# endshow #} 41 | 42 | {{ post_template.render(post) }} 43 | 44 | {% endfor %} 45 | 46 |
47 | 48 | {% include '_partials/pagination.swig' %} 49 | 50 | {% endblock %} 51 | 52 | {% block sidebar %} 53 | {{ sidebar_template.render(false) }} 54 | {% endblock %} 55 | 56 | 57 | {% block script_extra %} 58 | {% if theme.use_motion %} 59 | 62 | {% endif %} 63 | {% endblock %} 64 | -------------------------------------------------------------------------------- /themes/next/layout/_partials/share/baidushare.swig: -------------------------------------------------------------------------------- 1 | {% if theme.baidushare.type === "button" %} 2 |
3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 33 | {% elseif theme.baidushare.type === "slide" %} 34 | 54 | {% endif %} 55 | 58 | -------------------------------------------------------------------------------- /themes/next/source/css/_common/scaffolding/base.styl: -------------------------------------------------------------------------------- 1 | 2 | ::selection { 3 | background: $selection-bg; 4 | color: $selection-color; 5 | } 6 | 7 | body { 8 | position: relative; // Required by scrollspy 9 | font-family: $font-family-base; 10 | font-size: $font-size-base; 11 | line-height: $line-height-base; 12 | color: $text-color; 13 | background: $body-bg-color; 14 | 15 | +mobile() { padding-right: 0 !important; } 16 | +tablet() { padding-right: 0 !important; } 17 | +desktop-large() { font-size: $font-size-large; } 18 | } 19 | 20 | h1, h2, h3, h4, h5, h6 { 21 | margin: 0; 22 | padding: 0; 23 | font-weight: bold; 24 | line-height: 1.5; 25 | font-family: $font-family-headings; 26 | } 27 | 28 | h2, h3, h4, h5, h6 { margin: 20px 0 15px; } 29 | 30 | for headline in (1..6) { 31 | h{headline} { 32 | font-size: $font-size-headings-base - $font-size-headings-step * headline; 33 | } 34 | 35 | +mobile() { 36 | h{headline} { 37 | font-size: $font-size-headings-base - $font-size-headings-step * headline - 4px; 38 | } 39 | } 40 | } 41 | 42 | p { margin: 0 0 25px 0; } 43 | 44 | a { 45 | color: $link-color; 46 | text-decoration: none; 47 | border-bottom: 1px solid $grey-dark; 48 | word-wrap: break-word; 49 | 50 | &:hover { 51 | color: $link-hover-color; 52 | border-bottom-color: $link-decoration-hover-color; 53 | } 54 | } 55 | 56 | blockquote { 57 | margin: 0; 58 | padding: 0; 59 | } 60 | 61 | img { 62 | display: block; 63 | margin: auto; 64 | max-width: 100%; 65 | height: auto; 66 | } 67 | 68 | 69 | hr { 70 | margin: 40px 0; 71 | height: 3px; 72 | border: none; 73 | background-color: $gray-lighter; 74 | background-image: repeating-linear-gradient( 75 | -45deg, 76 | white, 77 | white 4px, 78 | transparent 4px, 79 | transparent 8px 80 | ); 81 | } 82 | 83 | blockquote { 84 | padding: 0 15px; 85 | color: $grey-dim; 86 | border-left: 4px solid $gray-lighter; 87 | 88 | cite::before { 89 | content: "-"; 90 | padding: 0 5px; 91 | } 92 | } 93 | 94 | dt { font-weight: $font-weight-bolder; } 95 | 96 | dd { 97 | margin: 0; 98 | padding: 0; 99 | } 100 | 101 | 102 | -------------------------------------------------------------------------------- /themes/next/source/css/_schemes/Pisces/_sidebar.styl: -------------------------------------------------------------------------------- 1 | .use-motion .sidebar .motion-element { opacity: 1; } 2 | 3 | .sidebar { 4 | display: none; 5 | right: auto; 6 | bottom: auto; 7 | 8 | // Do NOT delete this line 9 | // or Affix (position: fixed) will not work in Google Chrome. 10 | -webkit-transform: none; 11 | } 12 | 13 | 14 | .sidebar-inner { 15 | box-sizing: border-box; 16 | width: 240px; 17 | color: $text-color; 18 | background: white; 19 | box-shadow: $box-shadow; 20 | border-radius: $border-radius; 21 | 22 | &.affix { 23 | position: fixed; 24 | top: $sidebar-offset-float; 25 | } 26 | } 27 | 28 | .site-overview { 29 | margin: 0 2px; 30 | text-align: left; 31 | } 32 | 33 | .site-author { 34 | clearfix(); 35 | } 36 | 37 | .sidebar a { 38 | color: $black-light; 39 | 40 | &:hover { color: $black-deep; } 41 | } 42 | 43 | .links-of-author-item { 44 | a:before { display: none; } 45 | a { 46 | border-bottom: none; 47 | text-decoration: underline; 48 | } 49 | } 50 | 51 | .feed-link { 52 | border-top: 1px dotted $grey-light; 53 | border-bottom: 1px dotted $grey-light; 54 | text-align: center; 55 | } 56 | 57 | .feed-link a { 58 | display: block; 59 | color: $orange; 60 | border: none; 61 | 62 | &:hover { 63 | background: none; 64 | color: darken($orange, 20%); 65 | 66 | i { color: darken($orange, 20%); } 67 | } 68 | } 69 | 70 | .links-of-author { 71 | clearfix(); 72 | } 73 | .links-of-author-item { 74 | sidebar-inline-links-item(); 75 | 76 | a { 77 | display: block; 78 | text-decoration: none; 79 | 80 | &:hover { 81 | border-radius: 4px; 82 | background: $gainsboro; 83 | } 84 | } 85 | 86 | .fa { 87 | margin-right: 2px; 88 | font-size: 16px; 89 | } 90 | .fa-globe { font-size: 15px; } 91 | } 92 | 93 | 94 | .links-of-blogroll { 95 | margin-top: 20px; 96 | padding: 3px 0 0; 97 | border-top: 1px dotted $grey-light; 98 | } 99 | .links-of-blogroll-title { margin-top: 0; } 100 | .links-of-blogroll-item { padding: 0; } 101 | .links-of-blogroll-inline { 102 | clearfix(); 103 | 104 | .links-of-blogroll-item { 105 | sidebar-inline-links-item(); 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /source/_posts/strategy-pattern.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 简明 js 设计模式 —— 策略模式 3 | date: 2019-03-24 23:06:48 4 | tags: 设计模式 5 | --- 6 | ## 场景 7 | 8 | 假如要写一个文件解析器。针对不同的文件类型调用不同的方法。如果用一个函数来表达,可能会写出如下代码: 9 | 10 | ```js 11 | function fileParser(fileType) { 12 | if (fileType === 'js') jsParser(); 13 | if (fileType === 'txt') txtParser(); 14 | // .... 15 | } 16 | ``` 17 | 每增加一种类型,我们需要修改我们的 fileParser 函数,增加一个条件判断。这样不够优雅。 18 | 19 | 20 | ## 实现 21 | 22 | nodejs 的 require 函数也会遇到上面的情况,它需要针对三种不同的类型 —— js、json、node 分别做处理。我们来看看它是如何[实现](https://github.com/nodejs/node/blob/master/lib/internal/modules/cjs/loader.js)的: 23 | 24 | ```js 25 | // Native extension for .js 26 | Module._extensions['.js'] = function(module, filename) { 27 | var content = fs.readFileSync(filename, 'utf8'); 28 | module._compile(stripBOM(content), filename); 29 | }; 30 | 31 | 32 | // Native extension for .json 33 | Module._extensions['.json'] = function(module, filename) { 34 | const content = fs.readFileSync(filename, 'utf8'); 35 | 36 | if (manifest) { 37 | const moduleURL = pathToFileURL(filename); 38 | manifest.assertIntegrity(moduleURL, content); 39 | } 40 | 41 | try { 42 | module.exports = JSON.parse(stripBOM(content)); 43 | } catch (err) { 44 | err.message = filename + ': ' + err.message; 45 | throw err; 46 | } 47 | }; 48 | 49 | 50 | // Native extension for .node 51 | Module._extensions['.node'] = function(module, filename) { 52 | if (manifest) { 53 | const content = fs.readFileSync(filename); 54 | const moduleURL = pathToFileURL(filename); 55 | manifest.assertIntegrity(moduleURL, content); 56 | } 57 | // Be aware this doesn't use `content` 58 | return process.dlopen(module, path.toNamespacedPath(filename)); 59 | }; 60 | ``` 61 | 这些函数在 `Module.prototype.load` 过程中调用。 62 | 63 | ```js 64 | Module.prototype.load = function(filename) { 65 | 66 | Module._extensions[extension](this, filename); 67 | // ... 68 | } 69 | ``` 70 | 71 | 我们看到这个过程没有了条件判断的流程。而且对多类型支持也非常方便,只需要扩展类型方法即可,不需要修改所谓的 fileParser 方法(符合 open / close 原则)。 72 | 73 | 策略模式便是在运行时选择算法,并且消除了判断流程的一种模式。 74 | 75 | ## 参考 76 | 77 | * [https://en.wikipedia.org/wiki/Behavioral_pattern](https://en.wikipedia.org/wiki/Behavioral_pattern) 78 | * [https://en.wikipedia.org/wiki/Strategy_pattern](https://en.wikipedia.org/wiki/Strategy_pattern) 79 | 80 | ## ISSUE 81 | 82 | 有问题?来 [Github](https://github.com/flyyang/blog/issues/20) 一起讨论。 -------------------------------------------------------------------------------- /themes/next/source/css/_common/components/third-party/localsearch.styl: -------------------------------------------------------------------------------- 1 | .local-search-pop-overlay 2 | position: fixed 3 | width: 100% 4 | height: 100% 5 | top: 0 6 | left: 0 7 | z-index: 2080 8 | background-color: rgba(0, 0, 0, 0.3) 9 | 10 | .local-search-popup 11 | display: none 12 | position: fixed 13 | top: 10% 14 | left: 50% 15 | margin-left: -350px 16 | width: 700px 17 | height: 80% 18 | padding: 0 19 | background: #fff 20 | color: #333 21 | z-index: 9999 22 | border-radius: 5px 23 | +mobile() 24 | padding: 0 25 | top: 0 26 | left: 0 27 | margin: 0 28 | width: 100% 29 | height: 100% 30 | border-radius: 0 31 | 32 | ul.search-result-list 33 | padding: 0 34 | margin: 0 5px 35 | 36 | p.search-result 37 | border-bottom: 1px dashed #ccc 38 | padding: 5px 0 39 | 40 | a.search-result-title 41 | font-weight: bold 42 | font-size: 16px 43 | 44 | .search-keyword 45 | border-bottom: 1px dashed #f00 46 | font-size: 14px 47 | font-weight: bold 48 | color: #f00 49 | 50 | .local-search-header 51 | padding: 5px 52 | height: 36px 53 | background: #f5f5f5 54 | border-top-left-radius: 5px 55 | border-top-right-radius: 5px 56 | 57 | #local-search-result 58 | overflow: auto 59 | position: relative 60 | padding: 5px 25px 61 | height: calc(100% - 55px) 62 | 63 | .local-search-input-wrapper 64 | display: inline-block 65 | width: calc(100% - 60px) 66 | height: 36px 67 | line-height: 36px 68 | padding: 0 5px 69 | 70 | .local-search-input-wrapper input 71 | padding: 8px 0 72 | height: 20px 73 | display: block 74 | width: 100% 75 | outline: none 76 | border: none 77 | background: transparent 78 | vertical-align: middle 79 | 80 | .search-icon, .popup-btn-close 81 | display: inline-block 82 | font-size: 18px 83 | color: #999 84 | height: 36px 85 | width: 18px 86 | 87 | .search-icon 88 | float: left 89 | 90 | .popup-btn-close 91 | border-left: 1px solid #eee 92 | float: right 93 | cursor: pointer 94 | padding-left: 10px 95 | 96 | #no-result 97 | position: absolute 98 | left: 50% 99 | top: 50% 100 | -webkit-transform: translate(-50%, -50%) 101 | transform: translate(-50%, -50%) 102 | color: #ccc 103 | -------------------------------------------------------------------------------- /themes/next/source/lib/jquery_lazyload/jquery.scrollstop.js: -------------------------------------------------------------------------------- 1 | /* http://james.padolsey.com/javascript/special-scroll-events-for-jquery/ */ 2 | 3 | (function(){ 4 | 5 | var special = jQuery.event.special, 6 | uid1 = "D" + (+new Date()), 7 | uid2 = "D" + (+new Date() + 1); 8 | 9 | special.scrollstart = { 10 | setup: function() { 11 | 12 | var timer, 13 | handler = function(evt) { 14 | 15 | var _self = this, 16 | _args = arguments; 17 | 18 | if (timer) { 19 | clearTimeout(timer); 20 | } else { 21 | evt.type = "scrollstart"; 22 | jQuery.event.dispatch.apply(_self, _args); 23 | } 24 | 25 | timer = setTimeout( function(){ 26 | timer = null; 27 | }, special.scrollstop.latency); 28 | 29 | }; 30 | 31 | jQuery(this).bind("scroll", handler).data(uid1, handler); 32 | 33 | }, 34 | teardown: function(){ 35 | jQuery(this).unbind( "scroll", jQuery(this).data(uid1) ); 36 | } 37 | }; 38 | 39 | special.scrollstop = { 40 | latency: 300, 41 | setup: function() { 42 | 43 | var timer, 44 | handler = function(evt) { 45 | 46 | var _self = this, 47 | _args = arguments; 48 | 49 | if (timer) { 50 | clearTimeout(timer); 51 | } 52 | 53 | timer = setTimeout( function(){ 54 | 55 | timer = null; 56 | evt.type = "scrollstop"; 57 | jQuery.event.dispatch.apply(_self, _args); 58 | 59 | 60 | }, special.scrollstop.latency); 61 | 62 | }; 63 | 64 | jQuery(this).bind("scroll", handler).data(uid2, handler); 65 | 66 | }, 67 | teardown: function() { 68 | jQuery(this).unbind( "scroll", jQuery(this).data(uid2) ); 69 | } 70 | }; 71 | 72 | })(); -------------------------------------------------------------------------------- /themes/next/source/css/_common/components/post/post-collapse.styl: -------------------------------------------------------------------------------- 1 | // TODO: Refactor. 2 | 3 | @media (max-width: 767px) { 4 | .posts-collapse { 5 | margin: 0 20px; 6 | 7 | .post-title, .post-meta { 8 | display: block; 9 | width: auto; 10 | text-align: left; 11 | } 12 | } 13 | } 14 | 15 | .posts-collapse { 16 | position: relative; 17 | z-index: $zindex-1; 18 | 19 | &::after { 20 | content: " "; 21 | position: absolute; 22 | top: 20px; 23 | left: 0; 24 | margin-left: -2px; 25 | width: 4px; 26 | height: 100%; 27 | background: $whitesmoke; 28 | z-index: $zindex-bottom; 29 | } 30 | 31 | margin-left: $posts-collapse-left; 32 | +mobile() { margin: 0 20px; } 33 | 34 | .collection-title { 35 | position: relative; 36 | margin: 60px 0; 37 | 38 | h2 { margin-left: 20px; } 39 | 40 | small { color: $grey; } 41 | 42 | &::before { 43 | content: " "; 44 | position: absolute; 45 | left: 0; 46 | top: 50%; 47 | margin-left: -4px; 48 | margin-top: -4px; 49 | width: 8px; 50 | height: 8px; 51 | background: $grey; 52 | circle(); 53 | } 54 | } 55 | 56 | .post { margin: 30px 0; } 57 | 58 | .post-header { 59 | position: relative; 60 | the-transition(); 61 | transition-property: border; 62 | border-bottom: 1px dashed $grey-light; 63 | 64 | &::before { 65 | content: " "; 66 | position: absolute; 67 | left: 0; 68 | top: 12px; 69 | width: 6px; 70 | height: 6px; 71 | margin-left: -4px; 72 | background: $grey; 73 | circle(); 74 | border: 1px solid white; 75 | the-transition(); 76 | transition-property: background; 77 | } 78 | } 79 | 80 | .post-header:hover { 81 | border-bottom-color: $grey-dim; 82 | 83 | &::before { background: $black-deep; } 84 | } 85 | 86 | .post-meta { 87 | position: absolute; 88 | font-size: 12px; 89 | left: 20px; 90 | top: 5px; 91 | } 92 | 93 | .post-comments-count { display: none; } 94 | 95 | .post-title { 96 | margin-left: 60px; 97 | font-size: 16px; 98 | font-weight: normal; 99 | line-height: inherit; 100 | 101 | &::after { 102 | margin-left: 3px; 103 | opacity: 0.6; 104 | } 105 | 106 | a { 107 | color: $grey-dim; 108 | border-bottom: none; 109 | } 110 | } 111 | } 112 | -------------------------------------------------------------------------------- /themes/next/source/css/_schemes/Pisces/_layout.styl: -------------------------------------------------------------------------------- 1 | .header { 2 | position: relative; 3 | margin: 0 auto; 4 | width: $main-desktop; 5 | 6 | +tablet() { 7 | width: auto; 8 | } 9 | +mobile() { 10 | width: auto; 11 | } 12 | } 13 | 14 | .header-inner { 15 | position: absolute; 16 | top: 0; 17 | overflow: hidden; 18 | padding: 0; 19 | width: 240px; 20 | background: white; 21 | box-shadow: $box-shadow-inner; 22 | border-radius: $border-radius-inner; 23 | 24 | +desktop-large() { 25 | .container & { width: 240px; } 26 | } 27 | +tablet() { 28 | position: relative; 29 | width: auto; 30 | border-radius: initial; 31 | } 32 | +mobile() { 33 | position: relative; 34 | width: auto; 35 | border-radius: initial; 36 | } 37 | } 38 | 39 | .main { 40 | clearfix(); 41 | +tablet() { 42 | padding-bottom: 100px; 43 | } 44 | +mobile() { 45 | padding-bottom: 100px; 46 | } 47 | } 48 | 49 | .container .main-inner { 50 | width: $main-desktop; 51 | 52 | +tablet() { 53 | width: auto; 54 | } 55 | +mobile() { 56 | width: auto; 57 | } 58 | } 59 | 60 | .content-wrap { 61 | float: right; 62 | box-sizing: border-box; 63 | padding: $content-desktop-padding; 64 | width: $content-desktop; 65 | background: white; 66 | min-height: 700px; 67 | box-shadow: $box-shadow-inner; 68 | border-radius: $border-radius-inner; 69 | 70 | +tablet() { 71 | width: 100%; 72 | padding: 20px; 73 | border-radius: initial; 74 | } 75 | +mobile() { 76 | width: 100%; 77 | padding: 20px; 78 | min-height: auto; 79 | border-radius: initial; 80 | } 81 | } 82 | 83 | .sidebar { 84 | position: static; 85 | float: left; 86 | margin-top: 300px; 87 | width: $sidebar-desktop; 88 | background: $body-bg-color; 89 | box-shadow: none; 90 | 91 | +tablet() { 92 | display: none; 93 | } 94 | +mobile() { 95 | display: none; 96 | } 97 | } 98 | 99 | .sidebar-toggle { display: none; } 100 | 101 | 102 | .footer-inner { 103 | width: $main-desktop; 104 | padding-left: 260px; 105 | 106 | +tablet() { 107 | width: auto; 108 | padding-left: 0 !important; 109 | padding-right: 0 !important; 110 | } 111 | +mobile() { 112 | width: auto; 113 | padding-left: 0 !important; 114 | padding-right: 0 !important; 115 | } 116 | } 117 | 118 | 119 | 120 | .sidebar-position-right { 121 | .header-inner { right: 0; } 122 | .content-wrap { float: left; } 123 | .sidebar { float: right; } 124 | 125 | .footer-inner { 126 | padding-left: 0; 127 | padding-right: 260px; 128 | } 129 | } 130 | 131 | -------------------------------------------------------------------------------- /themes/next/source/css/_common/components/pages/schedule.styl: -------------------------------------------------------------------------------- 1 | @keyframes dot-flash { 2 | from {opacity: 1; transform:scale(1.1);} 3 | to {opacity: 0; transform:scale(1);} 4 | } 5 | 6 | #schedule { 7 | ul#event-list { 8 | padding-left: 30px 9 | hr { 10 | margin: 20px 0 45px 0!important 11 | background: #222 12 | &:after { 13 | display: inline-block 14 | content: 'NOW' 15 | background: #222 16 | color: #FFF 17 | font-weight:bold 18 | text-align: right 19 | padding: 0 5px 20 | } 21 | } 22 | li.event { 23 | margin: 20px 0px 24 | background: #F9F9F9 25 | padding-left: 10px 26 | min-height: 40px 27 | h2.event-summary { 28 | margin: 0 29 | padding-bottom: 3px 30 | &:before { 31 | display: inline-block 32 | font-family: FontAwesome 33 | font-size: 8px 34 | content: '\f111' 35 | vertical-align: middle 36 | margin-right: 25px 37 | color: #bbb 38 | } 39 | } 40 | span.event-relative-time { 41 | display: inline-block 42 | font-size: 12px 43 | font-weight: 400 44 | padding-left: 12px 45 | color: #bbb 46 | } 47 | span.event-details { 48 | display: block 49 | color: #bbb 50 | margin-left: 56px 51 | padding-top: 3px 52 | padding-bottom: 6px 53 | text-indent: -24px 54 | line-height: 18px 55 | &:before { 56 | text-indent: 0 57 | display: inline-block 58 | width: 14px 59 | font-family: FontAwesome 60 | text-align: center 61 | margin-right: 9px 62 | color: #bbb 63 | } 64 | &.event-location:before { 65 | content: '\f041' 66 | } 67 | &.event-duration:before { 68 | content: '\f017' 69 | } 70 | } 71 | } 72 | li.event-past { 73 | background: #FCFCFC 74 | & > * { 75 | opacity: .6 76 | } 77 | h2.event-summary { 78 | color: #bbb 79 | &:before { 80 | color: #DFDFDF 81 | } 82 | } 83 | } 84 | li.event-now { 85 | background: #222 86 | color: #FFF 87 | padding: 15px 0 15px 10px 88 | h2.event-summary { 89 | &:before { 90 | transform: scale(1.2) 91 | color: #FFF 92 | animation: dot-flash 1s alternate infinite ease-in-out; 93 | } 94 | } 95 | * { 96 | color: #FFF!important 97 | } 98 | } 99 | } 100 | } 101 | 102 | -------------------------------------------------------------------------------- /themes/next/source/css/_variables/Pisces.styl: -------------------------------------------------------------------------------- 1 | // Scaffolding 2 | // Settings for some of the most global styles. 3 | // -------------------------------------------------- 4 | $body-bg-color = #f5f7f9 5 | 6 | 7 | // Borders 8 | // -------------------------------------------------- 9 | $box-shadow-inner = initial; 10 | $box-shadow = initial; 11 | 12 | $border-radius-inner = initial; 13 | $border-radius = initial; 14 | 15 | 16 | // Header 17 | // -------------------------------------------------- 18 | $subtitle-color = $gray-lighter 19 | 20 | // Sidebar 21 | // -------------------------------------------------- 22 | $sidebar-offset-float = unit(hexo-config('sidebar.offset_float'), px) if hexo-config('sidebar.offset_float') is a 'unit' 23 | 24 | $sidebar-nav-hover-color = $orange 25 | $sidebar-highlight = $orange 26 | 27 | $site-author-image-width = 120px 28 | $site-author-image-border-width = 1px 29 | $site-author-image-border-color = $gainsboro 30 | 31 | $site-author-name-margin = 0 32 | $site-author-name-color = $black-deep 33 | $site-author-name-align = center 34 | $site-author-name-weight = $font-weight-bold 35 | 36 | $site-description-font-size = 13px 37 | $site-description-color = $grey-dark 38 | $site-description-margin-top = 0 39 | $site-description-align = center 40 | 41 | $site-state-item-count-font-size = 16px 42 | $site-state-item-name-font-size = 13px 43 | $site-state-item-name-color = $grey-dark 44 | $site-state-item-border-color = $gainsboro 45 | 46 | $toc-link-color = $grey-dim 47 | $toc-link-border-color = $grey-light 48 | $toc-link-hover-color = black 49 | $toc-link-hover-border-color = black 50 | $toc-link-active-color = $sidebar-highlight 51 | $toc-link-active-border-color = $sidebar-highlight 52 | $toc-link-active-current-color = $sidebar-highlight 53 | $toc-link-active-current-border-color = $sidebar-highlight 54 | 55 | 56 | // Components 57 | // -------------------------------------------------- 58 | 59 | // Button 60 | $read-more-color = $text-color 61 | $read-more-bg-color = white 62 | $read-more-border-radius = 2px 63 | $btn-default-border-color = $text-color 64 | $btn-default-hover-color = white 65 | $btn-default-hover-bg = $black-deep 66 | 67 | // Full Image Tag 68 | $full-image-width = 118% 69 | $full-image-margin-horizontal = -9% 70 | $full-image-margin-vertical = 0 71 | 72 | // Back to top 73 | $b2t-opacity = .6 74 | $b2t-position-bottom = -100px 75 | $b2t-position-bottom-on = 30px 76 | -------------------------------------------------------------------------------- /themes/next/layout/_partials/header.swig: -------------------------------------------------------------------------------- 1 |
2 |
3 | {% if theme.custom_logo.image and theme.scheme === 'Muse' %} 4 |
5 | 6 | {{ config.title }} 8 | 9 |
10 | {% endif %} 11 | 12 | 19 | {% if theme.seo %} 20 |

{{ config.subtitle }}

21 | {% else %} 22 |

{{ config.subtitle }}

23 | {% endif %} 24 |
25 | 26 | 33 |
34 | 35 | 75 | 76 | {% include '../_custom/header.swig' %} 77 | -------------------------------------------------------------------------------- /themes/next/source/css/_common/components/third-party/algolia-search.styl: -------------------------------------------------------------------------------- 1 | .algolia-pop-overlay 2 | position: fixed 3 | width: 100% 4 | height: 100% 5 | top: 0 6 | left: 0 7 | z-index: 2080 8 | background-color: rgba(0, 0, 0, 0.3) 9 | 10 | .algolia-popup 11 | overflow: hidden 12 | padding: 0 13 | display: none 14 | position: fixed 15 | top: 10% 16 | left: 50% 17 | width: 700px 18 | height: 80% 19 | margin-left: -350px 20 | background: #fff 21 | color: #333 22 | z-index: 9999 23 | border-radius: 5px 24 | +mobile() 25 | padding: 0 26 | top: 0 27 | left: 0 28 | margin: 0 29 | width: 100% 30 | height: 100% 31 | border-radius: 0 32 | 33 | .popup-btn-close 34 | position: absolute 35 | right: 14px 36 | color: #4EBD79 37 | font-size: 14px 38 | font-weight: bold 39 | text-transform: uppercase 40 | cursor: pointer 41 | padding-left: 15px 42 | border-left: 1px solid #eee 43 | top: 10px 44 | .fa 45 | color: $grey-dark 46 | font-size: 18px 47 | &:hover .fa 48 | color: $black-deep 49 | 50 | .algolia-search 51 | padding: 10px 15px 5px 52 | max-height: 50px 53 | border-bottom: 1px solid #ccc 54 | background: $whitesmoke 55 | border-top-left-radius: 5px 56 | border-top-right-radius: 5px 57 | 58 | .algolia-search-input-icon 59 | display: inline-block 60 | width: 20px 61 | .fa 62 | font-size: 18px 63 | 64 | .algolia-search-input 65 | display: inline-block 66 | width: calc(90% - 20px) 67 | input 68 | padding: 5px 0 69 | width: 100% 70 | outline: none 71 | border: none 72 | background: transparent 73 | 74 | .algolia-powered 75 | float: right 76 | img 77 | display: inline-block 78 | height: 18px 79 | vertical-align: middle 80 | 81 | .algolia-results 82 | position: relative 83 | overflow: auto 84 | padding: 10px 30px 85 | height: calc(100% - 50px) 86 | 87 | hr 88 | margin: 10px 0 89 | 90 | .highlight 91 | font-style: normal 92 | margin: 0 93 | padding: 0 2px 94 | font-size: inherit 95 | color: red 96 | 97 | .algolia-hits 98 | margin-top: 20px 99 | 100 | .algolia-hit-item 101 | margin: 15px 0 102 | 103 | .algolia-hit-item-link 104 | display: block 105 | border-bottom: 1px dashed #ccc 106 | the-transition() 107 | 108 | .algolia-pagination 109 | .pagination 110 | margin-top: 40px 111 | border-top: none 112 | padding: 0 113 | .pagination-item 114 | display: inline-block 115 | .page-number 116 | border-top: none 117 | &:hover 118 | border-bottom: 1px solid $black-deep 119 | 120 | .current .page-number 121 | @extend .pagination .page-number.current 122 | 123 | .disabled-item 124 | visibility: hidden 125 | 126 | -------------------------------------------------------------------------------- /themes/next/source/lib/fancybox/source/helpers/jquery.fancybox-buttons.css: -------------------------------------------------------------------------------- 1 | #fancybox-buttons { 2 | position: fixed; 3 | left: 0; 4 | width: 100%; 5 | z-index: 8050; 6 | } 7 | 8 | #fancybox-buttons.top { 9 | top: 10px; 10 | } 11 | 12 | #fancybox-buttons.bottom { 13 | bottom: 10px; 14 | } 15 | 16 | #fancybox-buttons ul { 17 | display: block; 18 | width: 166px; 19 | height: 30px; 20 | margin: 0 auto; 21 | padding: 0; 22 | list-style: none; 23 | border: 1px solid #111; 24 | border-radius: 3px; 25 | -webkit-box-shadow: inset 0 0 0 1px rgba(255,255,255,.05); 26 | -moz-box-shadow: inset 0 0 0 1px rgba(255,255,255,.05); 27 | box-shadow: inset 0 0 0 1px rgba(255,255,255,.05); 28 | background: rgb(50,50,50); 29 | background: -moz-linear-gradient(top, rgb(68,68,68) 0%, rgb(52,52,52) 50%, rgb(41,41,41) 50%, rgb(51,51,51) 100%); 30 | background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgb(68,68,68)), color-stop(50%,rgb(52,52,52)), color-stop(50%,rgb(41,41,41)), color-stop(100%,rgb(51,51,51))); 31 | background: -webkit-linear-gradient(top, rgb(68,68,68) 0%,rgb(52,52,52) 50%,rgb(41,41,41) 50%,rgb(51,51,51) 100%); 32 | background: -o-linear-gradient(top, rgb(68,68,68) 0%,rgb(52,52,52) 50%,rgb(41,41,41) 50%,rgb(51,51,51) 100%); 33 | background: -ms-linear-gradient(top, rgb(68,68,68) 0%,rgb(52,52,52) 50%,rgb(41,41,41) 50%,rgb(51,51,51) 100%); 34 | background: linear-gradient(top, rgb(68,68,68) 0%,rgb(52,52,52) 50%,rgb(41,41,41) 50%,rgb(51,51,51) 100%); 35 | filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#444444', endColorstr='#222222',GradientType=0 ); 36 | } 37 | 38 | #fancybox-buttons ul li { 39 | float: left; 40 | margin: 0; 41 | padding: 0; 42 | } 43 | 44 | #fancybox-buttons a { 45 | display: block; 46 | width: 30px; 47 | height: 30px; 48 | text-indent: -9999px; 49 | background-color: transparent; 50 | background-image: url('fancybox_buttons.png'); 51 | background-repeat: no-repeat; 52 | outline: none; 53 | opacity: 0.8; 54 | } 55 | 56 | #fancybox-buttons a:hover { 57 | opacity: 1; 58 | } 59 | 60 | #fancybox-buttons a.btnPrev { 61 | background-position: 5px 0; 62 | } 63 | 64 | #fancybox-buttons a.btnNext { 65 | background-position: -33px 0; 66 | border-right: 1px solid #3e3e3e; 67 | } 68 | 69 | #fancybox-buttons a.btnPlay { 70 | background-position: 0 -30px; 71 | } 72 | 73 | #fancybox-buttons a.btnPlayOn { 74 | background-position: -30px -30px; 75 | } 76 | 77 | #fancybox-buttons a.btnToggle { 78 | background-position: 3px -60px; 79 | border-left: 1px solid #111; 80 | border-right: 1px solid #3e3e3e; 81 | width: 35px 82 | } 83 | 84 | #fancybox-buttons a.btnToggleOn { 85 | background-position: -27px -60px; 86 | } 87 | 88 | #fancybox-buttons a.btnClose { 89 | border-left: 1px solid #111; 90 | width: 35px; 91 | background-position: -56px 0px; 92 | } 93 | 94 | #fancybox-buttons a.btnDisabled { 95 | opacity : 0.4; 96 | cursor: default; 97 | } -------------------------------------------------------------------------------- /themes/next/layout/_layout.swig: -------------------------------------------------------------------------------- 1 | 2 | 3 | {% set html_class = 'theme-next ' + theme.scheme %} 4 | {% if theme.use_motion %} 5 | {% set html_class = html_class + ' use-motion' %} 6 | {% endif %} 7 | 8 | 9 | 10 | {% include '_partials/head.swig' %} 11 | {% block title %}{% endblock %} 12 | 13 | 14 | 15 | 16 | {% include '_third-party/analytics/index.swig' %} 17 | 18 | {% set container_class = "container " %} 19 | {% if theme.sidebar.position %} 20 | {% set container_class = container_class + 'sidebar-position-' + theme.sidebar.position %} 21 | {% endif %} 22 | 23 |
24 |
25 | 26 | 29 | 30 |
31 |
32 |
33 |
34 | {% block content %}{% endblock %} 35 |
36 | {% include '_third-party/duoshuo-hot-articles.swig' %} 37 | {% include '_partials/comments.swig' %} 38 |
39 | {% if theme.sidebar.display !== 'remove' %} 40 | {% block sidebar %}{% endblock %} 41 | {% endif %} 42 |
43 |
44 | 45 |
46 | 51 |
52 | 53 | {% if not theme.sidebar.b2t %} 54 |
55 | 56 | {% if theme.sidebar.scrollpercent %} 57 | 0% 58 | {% endif %} 59 |
60 | {% endif %} 61 | 62 |
63 | 64 | {% include '_scripts/vendors.swig' %} 65 | {% include '_scripts/commons.swig' %} 66 | 67 | {% set scheme_script = '_scripts/schemes/' + theme.scheme | lower + '.swig' %} 68 | {% include scheme_script %} 69 | 70 | {% block script_extra %}{% endblock %} 71 | 72 | {% include '_scripts/boostrap.swig' %} 73 | 74 | {% include '_third-party/comments/index.swig' %} 75 | {% include '_third-party/search/index.swig' %} 76 | {% include '_third-party/analytics/lean-analytics.swig' %} 77 | {% include '_third-party/seo/baidu-push.swig' %} 78 | {% include '_third-party/mathjax.swig' %} 79 | {% include '_third-party/exturl.swig' %} 80 | 81 | 82 | -------------------------------------------------------------------------------- /themes/next/scripts/tags/exturl.js: -------------------------------------------------------------------------------- 1 | /* global hexo */ 2 | // Usage: {% exturl text url "title" %} 3 | // Alias: {% extlink text url "title" %} 4 | 5 | 'use strict'; 6 | 7 | /*jshint camelcase: false */ 8 | var util = require('hexo-util'); 9 | /*jshint camelcase: true */ 10 | var htmlTag = util.htmlTag; 11 | 12 | var rUrl = /((([A-Za-z]{3,9}:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+|(?:www.|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[.\!\/\\w]*))?)/; 13 | 14 | // Create Base64 Object 15 | var Base64={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encode:function(e){var t="";var n,r,i,s,o,u,a;var f=0;e=Base64._utf8_encode(e);while(f>2;o=(n&3)<<4|r>>4;u=(r&15)<<2|i>>6;a=i&63;if(isNaN(r)){u=a=64}else if(isNaN(i)){a=64}t=t+this._keyStr.charAt(s)+this._keyStr.charAt(o)+this._keyStr.charAt(u)+this._keyStr.charAt(a)}return t},decode:function(e){var t="";var n,r,i;var s,o,u,a;var f=0;e=e.replace(/[^A-Za-z0-9+/=]/g,"");while(f>4;r=(o&15)<<4|u>>2;i=(u&3)<<6|a;t=t+String.fromCharCode(n);if(u!=64){t=t+String.fromCharCode(r)}if(a!=64){t=t+String.fromCharCode(i)}}t=Base64._utf8_decode(t);return t},_utf8_encode:function(e){e=e.replace(/rn/g,"n");var t="";for(var n=0;n127&&r<2048){t+=String.fromCharCode(r>>6|192);t+=String.fromCharCode(r&63|128)}else{t+=String.fromCharCode(r>>12|224);t+=String.fromCharCode(r>>6&63|128);t+=String.fromCharCode(r&63|128)}}return t},_utf8_decode:function(e){var t="";var n=0;var r=c1=c2=0;while(n191&&r<224){c2=e.charCodeAt(n+1);t+=String.fromCharCode((r&31)<<6|c2&63);n+=2}else{c2=e.charCodeAt(n+1);c3=e.charCodeAt(n+2);t+=String.fromCharCode((r&15)<<12|(c2&63)<<6|c3&63);n+=3}}return t}}; 16 | 17 | function extURL(args, content) { 18 | var exturl = 'exturl'; 19 | var url = ''; 20 | var text = ['']; 21 | var title = ''; 22 | var item = ''; 23 | var i = 0; 24 | var len = args.length; 25 | 26 | // Find link URL and text 27 | for (; i < len; i++) { 28 | item = args[i]; 29 | 30 | if (rUrl.test(item)) { 31 | url = Base64.encode(item); 32 | break; 33 | } else { 34 | text.push(item); 35 | } 36 | } 37 | 38 | // Delete link URL and text from arguments 39 | args = args.slice(i + 1); 40 | 41 | // Check if the link should be open in a new window 42 | // and collect the last text as the link title 43 | if (args.length) { 44 | var shift = args[0]; 45 | title = args.join(' '); 46 | } 47 | 48 | var attrs = { 49 | class: exturl, 50 | 'data-url': url, 51 | title: title 52 | }; 53 | 54 | //console.log(url); 55 | return htmlTag('span', attrs, text.join(' ')); 56 | } 57 | 58 | hexo.extend.tag.register('exturl', extURL, {ends: false}); 59 | hexo.extend.tag.register('extlink', extURL, {ends: false}); 60 | -------------------------------------------------------------------------------- /source/_posts/vue-new-instance.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 深入浅出 Vue 实例化 3 | date: 2019-02-21 18:02:25 4 | tags: vue 5 | --- 6 | 7 | 由[深入浅出 Vue 构建流程](https://github.com/flyyang/blog/issues/16)可知,当我们使用: 8 | 9 | ```js 10 | import Vue from 'Vue' 11 | ``` 12 | 13 | 时,默认查找的文件是 `dist/vue.runtime.esm.js`。而构建出这个文件的入口文件是:`src/platforms/web/entry-runtime.js`。 14 | 15 | runtime 版本是不包含 compiler 的,也就是没有编译 Vue 模板的过程。通常编译的工作交给 vue-loader,也就是 webpack 来代劳。但是从分析源码的角度来看,我们还是有必要要了解一下编译过程。所以我们从带 compiler 的入口开始: 16 | 17 | ```js 18 | // 源码分析从此开始 19 | src/platforms/web/entry-runtime-with-compiler.js 20 | ``` 21 | 22 | 23 | 24 | ### Vue 是一个构造函数 25 | 在 Vue 里,一个简单的 Hello World 程序如下: 26 | 27 | ```html 28 |
29 | {{ message }} 30 |
31 | ``` 32 | ```js 33 | var app = new Vue({ 34 | el: '#app', 35 | data: { 36 | message: 'Hello Vue!' 37 | } 38 | }) 39 | ``` 40 | 41 | 我们可以注意到一个通常的 Vue 应用程序,是通过 new Vue 开始的。我们来看看 Vue 到底是什么。 42 | 43 | ![image](https://user-images.githubusercontent.com/3912408/53155852-eadca100-35f8-11e9-95b7-db3b43c4e4e1.png) 44 | 45 | 由上图的调用流程可知 Vue 的构造函数位于 `src/core/instance/index.js`: 46 | 47 | ```js 48 | import { initMixin } from './init' 49 | import { stateMixin } from './state' 50 | import { renderMixin } from './render' 51 | import { eventsMixin } from './events' 52 | import { lifecycleMixin } from './lifecycle' 53 | import { warn } from '../util/index' 54 | 55 | function Vue (options) { 56 | if (process.env.NODE_ENV !== 'production' && 57 | !(this instanceof Vue) 58 | ) { 59 | warn('Vue is a constructor and should be called with the `new` keyword') 60 | } 61 | this._init(options) 62 | } 63 | 64 | initMixin(Vue) 65 | stateMixin(Vue) 66 | eventsMixin(Vue) 67 | lifecycleMixin(Vue) 68 | renderMixin(Vue) 69 | 70 | export default Vue 71 | ``` 72 | 73 | 我们绕了这么一大圈(如下图),终于找到了Vue 的原型。这样写有什么好处呢? 74 | 75 | 76 | ![image](https://user-images.githubusercontent.com/3912408/53155787-c385d400-35f8-11e9-98e7-123d66c65651.png) 77 | 78 | 这样写最大的好处是功能拆分,**可以按功能模块来划分,逐步扩展 Vue 的功能**。 79 | 80 | 比如在 `core/index.js` 中,我们扩展了 Global API, 在 `instance/index.js` 中 对 Vue做了很多 mixin。 81 | 82 | ### 静态属性,实例属性,和原型属性 83 | 84 | Vue 的源码生成的整个过程中,有一个非常重要的点是,将各种工具函数,实例方法等挂载在 Vue 中。 85 | 86 | 挂载的形式主要有三种 87 | 88 | 1. 静态方法挂载。适用于通用功能,不需要实例化就能使用。 89 | 90 | 比如 Vue.use 用来初始化插件,Vue.config 用来配置 Vue 的特性。基本上可以对应 api 文档中的 [Global API](https://vuejs.org/v2/api/#Global-API). 91 | 92 | ```js 93 | // src/core/gloal-api/use.js 94 | 95 | Vue.use = function (plugin: Function | Object) { 96 | // 97 | return this 98 | } 99 | ``` 100 | 101 | 2. 原型属性挂载。需要实例化的通用功能。 102 | 103 | 比如 $on, $off, $nextTick, $watch, $set, $delete 等。通用功能放在原型是一个时间换空间的做法。 104 | 105 | 项目越大,业务越负杂,内存越节省,而原型查找的效率损失可以忽略不计。 106 | 107 | 3. 实例属性。需要实例化才能使用。 108 | 109 | 如 vm.$slots等。Vue 在实现过程中还使用了很多内部属性,在整个编码过程中使用。 110 | 111 | ![image](https://user-images.githubusercontent.com/3912408/53159966-e5378900-3601-11e9-846e-c70c20a5910c.png) 112 | 113 | 114 | 第二种和第三种挂载形式对应于文档[实例属性方法等章节](https://vuejs.org/v2/api/#Instance-Properties)。 115 | 116 | 以上。 117 | 118 | ## ISSUE 119 | 120 | 有问题?来 [Github](https://github.com/flyyang/blog/issues/17) 一起讨论。 -------------------------------------------------------------------------------- /source/_posts/nodejs-如何保证安装-node-modules-的一致性?.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: nodejs 如何保证安装 node_modules 的一致性? 3 | date: 2017-12-25 12:17:38 4 | tags: 5 | --- 6 | ## package.json 的困境 7 | 8 | package.json 不能够保证每次安装的依赖的唯一性。 举例来说: 9 | 10 | A 模块: 11 | ``` 12 | { 13 | "name": "A", 14 | "version": "0.1.0", 15 | "dependencies": { 16 | "B": "<0.1.0" 17 | } 18 | } 19 | ``` 20 | 依赖版本号小于 0.1.0 的 B 模块。 21 | ``` 22 | { 23 | "name": "B", 24 | "version": "0.0.1", 25 | "dependencies": { 26 | "C": "<0.1.0" 27 | } 28 | } 29 | ``` 30 | 31 | 32 | 33 | 我们在开发的时候 B 模块时 0.0.1。下一次执行 npm install 的 B 模块发布了 0.0.2 版本。此时安装到的版本时 B 的 0.02 版。出现了不一致情况。 34 | 35 | npm 推荐 [sermer](https://semver.org/) 的规则来管理自己的版本发布: 36 | ``` 37 | - MAJOR version when you make incompatible API changes, 38 | - MINOR version when you add functionality in a backwards-compatible manner, and 39 | - PATCH version when you make backwards-compatible bug fixes. 40 | ``` 41 | sermer 的目的是让代码升级到最新的 bug fix。但是,通常一个项目依赖成百上千个模块,你并不能确定哪一个模块会出问题。 42 | 43 | **[一定要选择靠谱的开源模块](https://zhuanlan.zhihu.com/p/22934066)** 并不能解决你的忧虑。 44 | 45 | 相信别人,还是相信自己?从可控性角度来说,当然是相信自己。**我们需要的是一个 single of truth 的依赖树。** 46 | 47 | ## yarn.lock 48 | 49 | npm 的 对待此问题的行动迟缓 (君不见 nodejs、io-js), facebook 开发出了 yarn 来解决npm 的 lock 和 cache 等问题。 50 | 51 | ![image](https://user-images.githubusercontent.com/3912408/34292451-f25806a2-e73b-11e7-96f2-1192e96e7398.png) 52 | 53 | 版本锁定 与 install 等操作同步,保证了 node_modules 的一致性。实现了我们想要的 single of truth 的依赖树。 54 | 55 | ## package-lock.json 56 | 57 | 有竞争就有改进的动力。 npm 5 发布,默认支持 package-lock.json。 58 | 59 | ``` 60 | package-lock.json is automatically generated for any operations where npm modifies either the node_modules tree, or package.json. It describes the exact tree that was generated, such that subsequent installs are able to generate identical trees, regardless of intermediate dependency updates. 61 | ``` 62 | 一个简单的例子: 63 | 64 | ``` 65 | { 66 | "name": "mobi-pandaren-front-web", 67 | "version": "0.0.0", 68 | "lockfileVersion": 1, 69 | "requires": true, 70 | "dependencies": { 71 | "align-text": { 72 | "version": "0.1.4", 73 | "resolved": "http://npm.pandatv.com/align-text/-/align-text-0.1.4.tgz", 74 | "integrity": "sha1-DNkKVhCT810KmSVsIrcGlDP60Rc=", 75 | "requires": { 76 | "kind-of": "3.2.2", 77 | "longest": "1.0.1", 78 | "repeat-string": "1.6.1" 79 | } 80 | }, 81 | "amdefine": { 82 | "version": "1.0.1", 83 | "resolved": "http://npm.pandatv.com/amdefine/-/amdefine-1.0.1.tgz", 84 | "integrity": "sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU=" 85 | }, 86 | "asap": { 87 | "version": "2.0.6", 88 | "resolved": "http://npm.pandatv.com/asap/-/asap-2.0.6.tgz", 89 | "integrity": "sha1-5QNHYR1+aQlDIIu9r+vLwvuGbUY=" 90 | }, 91 | ... 92 | ``` 93 | package-lock 描述了所有相关依赖的具体版本,并且会随着 npm install 变化而变化。弥补了 package.json 的不足。 94 | 95 | ## npm-shrinkwrap.json 96 | 97 | npm-shrinkwrap.json 和 package-lock.json 内容是相同的。不同之处在于: 98 | 99 | 1. npm-shrinkwrap.json 优先级较高。install 时会优先采用。 100 | 2. 可发布到 registry。使用场景仅在:模块通常以 daemon 形式后台运行,或者依赖在dev中。其他请用package-lock.json。 101 | 102 | ## 结论 103 | 104 | 要使得避免“我这里是好的”这种情况。npm 5 是不错的选择。低版本推荐用 yarn 替代。 105 | -------------------------------------------------------------------------------- /themes/next/test/intern.js: -------------------------------------------------------------------------------- 1 | // Learn more about configuring this file at . 2 | // These default settings work OK for most people. The options that *must* be changed below are the 3 | // packages, suites, excludeInstrumentation, and (if you want functional tests) functionalSuites. 4 | define({ 5 | // The port on which the instrumenting proxy will listen 6 | proxyPort: 9000, 7 | 8 | // A fully qualified URL to the Intern proxy 9 | proxyUrl: 'http://localhost:9000/', 10 | 11 | // Default desired capabilities for all environments. Individual capabilities can be overridden by any of the 12 | // specified browser environments in the `environments` array below as well. See 13 | // https://code.google.com/p/selenium/wiki/DesiredCapabilities for standard Selenium capabilities and 14 | // https://saucelabs.com/docs/additional-config#desired-capabilities for Sauce Labs capabilities. 15 | // Note that the `build` capability will be filled in with the current commit ID from the Travis CI environment 16 | // automatically 17 | capabilities: { 18 | 'selenium-version': '2.41.0' 19 | }, 20 | 21 | // Browsers to run integration testing against. Note that version numbers must be strings if used with Sauce 22 | // OnDemand. Options that will be permutated are browserName, version, platform, and platformVersion; any other 23 | // capabilities options specified for an environment will be copied as-is 24 | environments: [ 25 | { browserName: 'internet explorer', version: '11', platform: 'Windows 8.1' }, 26 | { browserName: 'internet explorer', version: '10', platform: 'Windows 8' }, 27 | { browserName: 'internet explorer', version: '9', platform: 'Windows 7' }, 28 | { browserName: 'firefox', version: '28', platform: [ 'OS X 10.9', 'Windows 7', 'Linux' ] }, 29 | { browserName: 'chrome', version: '34', platform: [ 'OS X 10.9', 'Windows 7', 'Linux' ] }, 30 | { browserName: 'safari', version: '6', platform: 'OS X 10.8' }, 31 | { browserName: 'safari', version: '7', platform: 'OS X 10.9' } 32 | ], 33 | 34 | // Maximum number of simultaneous integration tests that should be executed on the remote WebDriver service 35 | maxConcurrency: 3, 36 | 37 | // Name of the tunnel class to use for WebDriver tests 38 | tunnel: 'SauceLabsTunnel', 39 | 40 | // The desired AMD loader to use when running unit tests (client.html/client.js). Omit to use the default Dojo 41 | // loader 42 | useLoader: { 43 | 'host-node': 'dojo/dojo', 44 | 'host-browser': 'node_modules/dojo/dojo.js' 45 | }, 46 | 47 | // Configuration options for the module loader; any AMD configuration options supported by the specified AMD loader 48 | // can be used here 49 | loader: { 50 | // Packages that should be registered with the loader in each testing environment 51 | packages: [ { name: 'next', location: '.' } ] 52 | }, 53 | 54 | // Non-functional test suite(s) to run in each browser 55 | suites: [ 56 | /* 'myPackage/tests/foo', 'myPackage/tests/bar' */ 57 | 'tests/helpers' 58 | ], 59 | 60 | // Functional test suite(s) to run in each browser once non-functional tests are completed 61 | functionalSuites: [ /* 'myPackage/tests/functional' */ ], 62 | 63 | // A regular expression matching URLs to files that should not be included in code coverage analysis 64 | excludeInstrumentation: /^(?:tests|node_modules)\// 65 | }); 66 | -------------------------------------------------------------------------------- /themes/next/source/css/_common/components/highlight/theme.styl: -------------------------------------------------------------------------------- 1 | $highlight_theme = hexo-config("highlight_theme") 2 | 3 | 4 | if $highlight_theme == "normal" 5 | $highlight-background = #f7f7f7 6 | $highlight-current-line = #efefef 7 | $highlight-selection = #d6d6d6 8 | $highlight-foreground = #4d4d4c 9 | $highlight-comment = #8e908c 10 | $highlight-red = #c82829 11 | $highlight-orange = #f5871f 12 | $highlight-yellow = #eab700 13 | $highlight-green = #718c00 14 | $highlight-aqua = #3e999f 15 | $highlight-blue = #4271ae 16 | $highlight-purple = #8959a8 17 | $highlight-gutter = { 18 | color: #869194, 19 | bg-color: #eff2f3 20 | } 21 | 22 | if $highlight_theme == "night" 23 | $highlight-background = #1d1f21 24 | $highlight-current-line = #282a2e 25 | $highlight-selection = #373b41 26 | $highlight-foreground = #c5c8c6 27 | $highlight-comment = #969896 28 | $highlight-red = #cc6666 29 | $highlight-orange = #de935f 30 | $highlight-yellow = #f0c674 31 | $highlight-green = #b5bd68 32 | $highlight-aqua = #8abeb7 33 | $highlight-blue = #81a2be 34 | $highlight-purple = #b294bb 35 | $highlight-gutter = { 36 | color: lighten($highlight-background, 50%), 37 | bg-color: darken($highlight-background, 100%) 38 | } 39 | 40 | if $highlight_theme == "night eighties" 41 | $highlight-background = #2d2d2d 42 | $highlight-current-line = #393939 43 | $highlight-selection = #515151 44 | $highlight-foreground = #cccccc 45 | $highlight-comment = #999999 46 | $highlight-red = #f2777a 47 | $highlight-orange = #f99157 48 | $highlight-yellow = #ffcc66 49 | $highlight-green = #99cc99 50 | $highlight-aqua = #66cccc 51 | $highlight-blue = #6699cc 52 | $highlight-purple = #cc99cc 53 | $highlight-gutter = { 54 | color: $highlight-comment, 55 | bg-color: darken($highlight-background, 40%) 56 | } 57 | 58 | if $highlight_theme == "night blue" 59 | $highlight-background = #002451 60 | $highlight-current-line = #00346e 61 | $highlight-selection = #003f8e 62 | $highlight-foreground = #ffffff 63 | $highlight-comment = #7285b7 64 | $highlight-red = #ff9da4 65 | $highlight-orange = #ffc58f 66 | $highlight-yellow = #ffeead 67 | $highlight-green = #d1f1a9 68 | $highlight-aqua = #99ffff 69 | $highlight-blue = #bbdaff 70 | $highlight-purple = #ebbbff 71 | $highlight-gutter = { 72 | color: $highlight-comment, 73 | bg-color: darken($highlight-background, 60%) 74 | } 75 | 76 | if $highlight_theme == "night bright" 77 | $highlight-background = #000000 78 | $highlight-current-line = #2a2a2a 79 | $highlight-selection = #424242 80 | $highlight-foreground = #eaeaea 81 | $highlight-comment = #969896 82 | $highlight-red = #d54e53 83 | $highlight-orange = #e78c45 84 | $highlight-yellow = #e7c547 85 | $highlight-green = #b9ca4a 86 | $highlight-aqua = #70c0b1 87 | $highlight-blue = #7aa6da 88 | $highlight-purple = #c397d8 89 | $highlight-gutter = { 90 | color: lighten($highlight-background, 40%), 91 | bg-color: lighten($highlight-background, 16%) 92 | } 93 | --------------------------------------------------------------------------------