├── .github ├── FUNDING.yml └── workflows │ └── docker-publish.yml ├── .gitignore ├── CNAME ├── Dockerfile ├── README.md ├── _config.yml ├── gulpfile.js ├── package.json ├── scaffolds ├── draft.md ├── page.md ├── photo.md └── post.md ├── source ├── 404 │ ├── 404.jpg │ └── index.html ├── _posts │ ├── FormData.md │ ├── Git-push-HTTP-request-failed-403-fatal问题解决.md │ ├── Intermediate-Algorithm-Scripting-2.md │ ├── Intermediate-Algorithm-Scripting.md │ ├── ant-design的select组件onSelect事件简析.md │ ├── aria2-transmission.md │ ├── awk-calc.md │ ├── aws-mongo-protect.md │ ├── beginning.md │ ├── beian.md │ ├── carousel.md │ ├── charles.md │ ├── chrome-extension-learning.md │ ├── css-learning.md │ ├── csv-encoding-bom.md │ ├── drunk-post-of-programmer.md │ ├── error-commit.md │ ├── filewatchers.md │ ├── find-xargs-cp.md │ ├── freecodecamp-Basic-Algorithm-Scripting.md │ ├── gfw-squid-stunnel.md.old │ ├── git-learning-1.md │ ├── git-learning-2.md │ ├── git-learning-3.md │ ├── gitcafe-dns.md │ ├── gitpages-warning.md │ ├── gulp-learning.md │ ├── gulp-minify-blog.md │ ├── hello-world.md │ ├── hexo-visit-analytics-md.md │ ├── html5-camera.md │ ├── https.md │ ├── idea-jvm.md │ ├── idea-remote-debug.md │ ├── inner-class-deserialize.md │ ├── interview-questions.md.bak │ ├── invite.html │ ├── iptables.md │ ├── jenkins-autobuild.md │ ├── js-big-number.md │ ├── js-device.md │ ├── js-encode.md │ ├── js-for-in.md │ ├── js-lib-share.md │ ├── js-lib-share2.md │ ├── js-lib-share3.md │ ├── js-max-number.md │ ├── kclr.md │ ├── kcxl-2.md │ ├── kcxl-3.md │ ├── kcxl.md │ ├── lazy-load.md │ ├── linux-install-mysql.md │ ├── local-weather.md │ ├── markdown-learning.md │ ├── maven-repo.md │ ├── message-restore.md │ ├── mongodb-back-restore.md │ ├── mongoose-update-all.md │ ├── myreading-2015.md │ ├── myreading-2016.md │ ├── myreading-2017.md │ ├── myreading-2018.md │ ├── myreading-2019.md │ ├── myreading-2020.md │ ├── myreading-2021.md │ ├── myreading-2022.md │ ├── mysql-case-when.md │ ├── mysql-in-find_in_set.md │ ├── node-authority.md │ ├── node-crypto.md │ ├── node-ssh-shell.md │ ├── raspberry-autoplay.md │ ├── raspberry-init.md │ ├── sendEmail.md │ ├── shell-run-mysql.md │ ├── summary17.md │ ├── summary18.md │ ├── translate_github_acquire.md │ ├── volatile.md │ ├── wedding.html │ ├── write-comment.md │ ├── write-comment2.md │ ├── write-comment3.md │ ├── write-comment4.md │ ├── write-springmvc-in-hand.md │ ├── write-tomcat-in-hand.md │ ├── written-crawler.md │ ├── xz-decompress.md │ ├── zhihu-node.md │ └── zhihu-writing.md ├── about │ └── index.md ├── capture_demo.html ├── categories │ └── index.md ├── donate.html ├── favicon.ico ├── issue │ └── index.md ├── jd_root.txt ├── js │ ├── custom.js │ └── mouseEffect.js ├── privacy.html ├── search │ └── index.html ├── tags │ └── index.md ├── weixin.png └── 结婚照.html ├── start.sh └── themes └── nextNew ├── .bowerrc ├── .editorconfig ├── .gitignore ├── .hound.yml ├── .javascript_ignore ├── .jshintrc ├── README.en.md ├── README.md ├── _config.yml ├── bower.json ├── languages ├── de.yml ├── default.yml ├── en.yml ├── fr-FR.yml ├── pt.yml ├── ru.yml ├── zh-Hans.yml ├── zh-hk.yml └── zh-tw.yml ├── layout ├── _layout.swig ├── _macro │ ├── post-collapse.swig │ ├── post.swig │ └── sidebar.swig ├── _partials │ ├── comments.swig │ ├── duoshuo-hot-articles.swig │ ├── footer.swig │ ├── head.swig │ ├── header.swig │ ├── old-browsers.swig │ ├── pagination.swig │ ├── search.swig │ ├── search │ │ ├── baidu.swig │ │ ├── swiftype.swig │ │ └── tinysou.swig │ └── share │ │ ├── baidu_share.swig │ │ ├── duoshuo_share.swig │ │ ├── jiathis.swig │ │ └── share_js.swig ├── _scripts │ ├── ads │ │ ├── ads.js │ │ ├── az_recommend_books.swig │ │ ├── bottom-az-ads.swig │ │ ├── bottom-jd-ads.swig │ │ ├── googleads.swig │ │ └── jd_recommend_books.swig │ ├── analytics.swig │ ├── analytics │ │ ├── baidu-analytics.swig │ │ ├── facebook-sdk.swig │ │ ├── google-analytics.swig │ │ ├── visit.swig │ │ └── zhanzhang-analytics.swig │ ├── baidushare.swig │ ├── bootstrap.scrollspy.swig │ ├── comments │ │ ├── changyan.swig │ │ ├── comment.swig │ │ ├── disqus.swig │ │ └── duoshuo.swig │ ├── fancy-box.swig │ ├── helpers.swig │ ├── mathjax.swig │ ├── motion.swig │ ├── pages │ │ ├── post-ads.swig │ │ └── post-details.swig │ └── tinysou.swig ├── archive.swig ├── category.swig ├── index.swig ├── page.swig ├── post.swig └── tag.swig ├── scripts ├── filters │ └── sticky.js ├── merge-configs.js └── tags │ ├── center-quote.js │ ├── full-image.js │ └── group-pictures.js ├── source ├── CNAME ├── css │ ├── _common │ │ ├── _component │ │ │ ├── back-to-top.styl │ │ │ ├── blockquote-center.styl │ │ │ ├── buttons.styl │ │ │ ├── comments.styl │ │ │ ├── duoshuo.styl │ │ │ ├── gallery.styl │ │ │ ├── group-pictures.styl │ │ │ ├── jiathis.styl │ │ │ ├── pagination.styl │ │ │ ├── posts-collapse.styl │ │ │ ├── posts-expand.styl │ │ │ ├── posts-type.styl │ │ │ ├── posts.styl │ │ │ └── tag-cloud.styl │ │ ├── _core │ │ │ ├── base.styl │ │ │ ├── helpers.styl │ │ │ ├── normalize.styl │ │ │ ├── scaffolding.styl │ │ │ └── tables.styl │ │ ├── _fonts │ │ │ ├── icon-default.styl │ │ │ ├── icon-feather.styl │ │ │ ├── icon-fifty-shades.styl │ │ │ ├── icon-font.styl │ │ │ └── icon-linecons.styl │ │ ├── _page │ │ │ ├── archive.styl │ │ │ ├── categories.styl │ │ │ ├── home.styl │ │ │ └── post-detail.styl │ │ ├── _section │ │ │ ├── body.styl │ │ │ ├── footer.styl │ │ │ ├── header.styl │ │ │ ├── layout.styl │ │ │ ├── media.styl │ │ │ └── sidebar.styl │ │ └── _vendor │ │ │ └── highlight │ │ │ ├── highlight.styl │ │ │ └── theme.styl │ ├── _custom │ │ ├── comment.styl │ │ └── custom.styl │ ├── _mixins │ │ ├── Mist.styl │ │ ├── base.styl │ │ ├── custom.styl │ │ └── default.styl │ ├── _schemes │ │ ├── Mist │ │ │ ├── _base.styl │ │ │ ├── _header.styl │ │ │ ├── _logo.styl │ │ │ ├── _menu.styl │ │ │ ├── _posts-expanded.styl │ │ │ └── index.styl │ │ └── default │ │ │ ├── _logo.styl │ │ │ ├── _menu.styl │ │ │ ├── _search.styl │ │ │ └── index.styl │ ├── _variables │ │ ├── Mist.styl │ │ ├── base.styl │ │ ├── custom.styl │ │ └── default.styl │ ├── main.styl │ ├── search.css │ └── share.min.css ├── fonts │ ├── .gitkeep │ ├── iconfont.eot │ ├── iconfont.svg │ ├── iconfont.ttf │ └── iconfont.woff ├── images │ ├── beian.png │ ├── cc-by-nc-nd.svg │ ├── cc-by-nc-sa.svg │ ├── cc-by-nc.svg │ ├── cc-by-nd.svg │ ├── cc-by-sa.svg │ ├── cc-by.svg │ ├── cc-zero.svg │ ├── default_avatar.jpg │ ├── loading.gif │ ├── logo.png │ ├── placeholder.gif │ ├── quote-l.svg │ ├── quote-r.svg │ ├── search.png │ ├── searchicon.png │ └── zfb.png ├── js │ ├── bootstrap.js │ ├── bootstrap.scrollspy.js │ ├── fancy-box.js │ ├── helpers.js │ ├── hook-duoshuo.js │ ├── jiathis.js │ ├── motion.js │ ├── search.js │ ├── social-share.min.js │ └── ua-parser.min.js ├── robots.txt └── vendors │ ├── bootstrap │ ├── css │ │ ├── bootstrap-theme.min.css │ │ └── bootstrap.min.css │ ├── fonts │ │ ├── glyphicons-halflings-regular.eot │ │ ├── glyphicons-halflings-regular.svg │ │ ├── glyphicons-halflings-regular.ttf │ │ ├── glyphicons-halflings-regular.woff │ │ └── glyphicons-halflings-regular.woff2 │ └── js │ │ └── bootstrap.min.js │ ├── fancybox │ └── source │ │ ├── blank.gif │ │ ├── fancybox_loading.gif │ │ ├── fancybox_loading@2x.gif │ │ ├── fancybox_overlay.png │ │ ├── fancybox_sprite.png │ │ ├── fancybox_sprite@2x.png │ │ ├── helpers │ │ ├── fancybox_buttons.png │ │ ├── jquery.fancybox-buttons.css │ │ ├── jquery.fancybox-buttons.js │ │ ├── jquery.fancybox-media.js │ │ ├── jquery.fancybox-thumbs.css │ │ └── jquery.fancybox-thumbs.js │ │ ├── jquery.fancybox.css │ │ ├── jquery.fancybox.js │ │ └── jquery.fancybox.pack.js │ ├── fastclick │ ├── .bower.json │ ├── LICENSE │ ├── README.md │ ├── bower.json │ └── lib │ │ ├── fastclick.js │ │ └── fastclick.min.js │ ├── firebase │ └── firebase.js │ ├── font-awesome │ ├── .bower.json │ ├── .gitignore │ ├── .npmignore │ ├── HELP-US-OUT.txt │ ├── bower.json │ ├── css │ │ ├── font-awesome.css │ │ ├── font-awesome.css.map │ │ └── font-awesome.min.css │ └── fonts │ │ ├── FontAwesome.otf │ │ ├── fontawesome-webfont.eot │ │ ├── fontawesome-webfont.svg │ │ ├── fontawesome-webfont.ttf │ │ ├── fontawesome-webfont.woff │ │ └── fontawesome-webfont.woff2 │ ├── jquery │ ├── .bower.json │ └── index.js │ ├── jquery_lazyload │ ├── .bower.json │ ├── CONTRIBUTING.md │ ├── README.md │ ├── bower.json │ ├── jquery.lazyload.js │ └── jquery.scrollstop.js │ ├── notie │ └── notie.min.css │ └── velocity │ ├── .bower.json │ ├── bower.json │ ├── velocity.js │ ├── velocity.min.js │ ├── velocity.ui.js │ └── velocity.ui.min.js └── test ├── .jshintrc ├── helpers.js └── intern.js /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] 4 | patreon: # Replace with a single Patreon username 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: # Replace with a single Ko-fi username 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | otechie: # Replace with a single Otechie username 12 | custom: https://favlink.cn/img/zf.jpg 13 | -------------------------------------------------------------------------------- /.github/workflows/docker-publish.yml: -------------------------------------------------------------------------------- 1 | name: ci 2 | 3 | on: 4 | push: 5 | branches: 6 | - 'master' 7 | 8 | jobs: 9 | docker: 10 | runs-on: ubuntu-latest 11 | steps: 12 | - 13 | name: Set up QEMU 14 | uses: docker/setup-qemu-action@v1 15 | - 16 | name: Set up Docker Buildx 17 | uses: docker/setup-buildx-action@v1 18 | - 19 | name: Login to DockerHub 20 | uses: docker/login-action@v1 21 | with: 22 | username: ${{ secrets.DOCKERHUB_USERNAME }} 23 | password: ${{ secrets.DOCKERHUB_TOKEN }} 24 | - 25 | name: Build and push 26 | id: docker_build 27 | uses: docker/build-push-action@v2 28 | with: 29 | push: true 30 | tags: njhxzhangjh/blog:latest 31 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | public 3 | *.log 4 | *.json 5 | .deploy_git 6 | git.sh 7 | nohup.out 8 | -------------------------------------------------------------------------------- /CNAME: -------------------------------------------------------------------------------- 1 | zhangjh.me 2 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:10.24.1 2 | 3 | WORKDIR /hello-blog 4 | COPY ./ /hello-blog 5 | 6 | ## comment 7 | RUN npm i 8 | EXPOSE 4000 9 | 10 | CMD ["npm", "run", "start"] 11 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # hello-blog 2 | 博客的源码仓库,写文章,更新等操作在此进行 3 | 4 | hexo g生成public目录后,更新到线上 5 | 6 | 使用gulp对静态代码进行压缩,一键式部署脚本自动完成hexo编译、gulp压缩以及git上传操作。 7 | 由于github国内访问速度的问题,国内ip访问引流至gitcafe,国外ip访问引流至github。详情见参见`start.sh`外包脚本。 8 | 9 | 博客地址:[点击访问我的博客](http://zhangjh.me) 10 | 11 | 12 | [![GPL Licence](https://badges.frapsoft.com/os/gpl/gpl.svg?v=103)](https://opensource.org/licenses/GPL-3.0/) [![Open Source Love](https://badges.frapsoft.com/os/v1/open-source.svg?v=103)](https://github.com/ellerbrock/open-source-badge/) [![Edit By zhangjh](https://img.shields.io/badge/EditBy-Zhangjh-brightgreen.svg?maxAge=2592000)](https://github.com/zhangjh/hello-blog) 13 | -------------------------------------------------------------------------------- /gulpfile.js: -------------------------------------------------------------------------------- 1 | var gulp = require('gulp'); 2 | var babel = require('gulp-babel'); 3 | var plugins = require('gulp-load-plugins')(); 4 | 5 | gulp.task("clean",function() { 6 | return gulp.src("./public/*") 7 | .pipe(plugins.clean()); 8 | }); 9 | 10 | gulp.task("css",function(){ 11 | var stream = gulp.src(["public/**/*.css","!public/**/*.min.css"]) 12 | .pipe(plugins.minifyCss({compatibility: 'ie8'})) 13 | .pipe(gulp.dest("./public/")); 14 | return stream; 15 | }); 16 | 17 | gulp.task("js",function(){ 18 | var stream = gulp.src(["public/**/*.js","!public/**/*.min.js"]) 19 | .pipe(babel({presets: ['env']})) 20 | .pipe(plugins.uglify()) 21 | .pipe(gulp.dest("./public/")); 22 | return stream; 23 | }); 24 | 25 | gulp.task("html",function(){ 26 | var stream = gulp.src("public/**/*.html") 27 | .pipe(plugins.minifyHtml()) 28 | //.pipe(plugins.rename({suffix: ".gulp"})) 29 | .pipe(gulp.dest("./public/")); 30 | return stream; 31 | }); 32 | 33 | gulp.task("mv",["html","css","js"],function() { 34 | var stream = gulp.src("./dst/*") 35 | .pipe(gulp.dest("./public/")); 36 | /*.pipe(plugins.shell([ 37 | "cp -r ./dst/* ./public/" 38 | ])); 39 | */ 40 | return stream; 41 | }); 42 | 43 | gulp.task("watch",function() { 44 | gulp.watch("public/*",["optimise"]); 45 | }); 46 | 47 | gulp.task("default",["html","css","js"],function(){ 48 | console.log("gulp task ok!"); 49 | }); 50 | 51 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "hexo-site", 3 | "version": "2.8.3", 4 | "node": { 5 | "version": "v10.24.1" 6 | }, 7 | "private": true, 8 | "hexo": { 9 | "version": "3.9.0" 10 | }, 11 | "scripts": { 12 | "clean": "hexo clean", 13 | "generate": "hexo g", 14 | "gulp": "gulp", 15 | "start": "hexo s" 16 | }, 17 | "dependencies": { 18 | "gulp": "~3.9.1", 19 | "gulp-babel": "^7.0.1", 20 | "gulp-clean": "~0.3.1", 21 | "gulp-load-plugins": "~1.2.0", 22 | "gulp-minify-css": "~1.2.3", 23 | "gulp-minify-html": "~1.0.4", 24 | "gulp-rename": "~1.2.2", 25 | "gulp-shell": "^0.5.2", 26 | "gulp-uglify": "~1.5.2", 27 | "hexo": "^3.4.0", 28 | "hexo-cli": "^1.0.4", 29 | "hexo-deployer-git": "^0.3.1", 30 | "hexo-generator-archive": "^0.1.2", 31 | "hexo-generator-category": "^0.1.2", 32 | "hexo-generator-feed": "^1.2.2", 33 | "hexo-generator-index": "^0.1.2", 34 | "hexo-generator-sitemap": "^1.0.1", 35 | "hexo-generator-tag": "^0.1.1", 36 | "hexo-renderer-ejs": "^0.1.0", 37 | "hexo-renderer-marked": "^0.2.4", 38 | "hexo-renderer-stylus": "^0.3.3", 39 | "hexo-server": "^0.1.2" 40 | }, 41 | "devDependencies": { 42 | "babel-cli": "^6.26.0", 43 | "babel-core": "^6.26.0", 44 | "babel-preset-env": "^1.6.1" 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /scaffolds/draft.md: -------------------------------------------------------------------------------- 1 | title: {{ title }} 2 | tags: 3 | --- 4 | -------------------------------------------------------------------------------- /scaffolds/page.md: -------------------------------------------------------------------------------- 1 | title: {{ title }} 2 | date: {{ date }} 3 | show: true 4 | --- 5 | -------------------------------------------------------------------------------- /scaffolds/photo.md: -------------------------------------------------------------------------------- 1 | title: {{ title }} 2 | date: {{ date }} 3 | tags: 4 | categories: 图片廊 5 | show: true 6 | photos: 7 | - 8 | --- 9 | -------------------------------------------------------------------------------- /scaffolds/post.md: -------------------------------------------------------------------------------- 1 | title: {{ title }} 2 | date: {{ date }} 3 | tags: 4 | categories: 5 | show: true 6 | --- 7 | -------------------------------------------------------------------------------- /source/404/404.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhangjh/hello-blog/a0fffc86c231ed109203492e8cfdd5098db58e66/source/404/404.jpg -------------------------------------------------------------------------------- /source/404/index.html: -------------------------------------------------------------------------------- 1 | title: 公益404 2 | --- 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /source/_posts/Git-push-HTTP-request-failed-403-fatal问题解决.md: -------------------------------------------------------------------------------- 1 | title: Git push HTTP request failed 403 fatal问题解决 2 | date: 2015-06-30 11:26:40 3 | tags: git 4 | categories: 技术人生 5 | show: true 6 | --- 7 | 我在搭建这个博客的时候,在更新了文件后使用git push到远程仓库时报错,报错信息如下: 8 | 9 | `error: The requested URL returned error: 403 while accessing https://github.com/zhangjh/myblog.git/info/refs` 10 | 11 | `fatal: HTTP request failed` 12 | 13 | 百度了一下,有很多类似的问题,解决方法较多的一种是: 14 | 15 | 16 | 17 | 将.git/config文件的[remote "origin"]部分的repo地址修改为username@githubxxx,即: 18 | 原:`url=https://github.com/zhangjh/myblog.git/` 19 | 修改为:`url=https://zhangjh@github.com/zhangjh/myblog.git` 20 | 21 | 我试了下,确实是可以的,在push的时候弹出输入密码的提示,输入自己的github密码即可。 22 | 23 | 可是如此修改之后岂不是每次push的时候都要输入密码了?这么反人类怎么可以。。 24 | 25 | 于是继续搜寻更好的解决办法,在github的[官方HELP页面](https://help.github.com/articles/https-cloning-errors/)上找到了这个问题的根本解决之道: 26 | 27 | 官方的说明是,出现这个问题, 28 | - 首先看自己的git版本是不是太旧了(为此我专门升级了git结果不奏效); 29 | - 其次确保仓库地址没有写错,大小写是有区分滴(我是直接复制黏贴的也不是这个问题); 30 | - xxxtoken的问题直接忽略(因为我看不明白); 31 | - 最后官方给出了一个解决方案:使用SSH代替HTTPS。 32 | 33 | 我尝试了行之有效,将.git/config文件的[remote "origin"]部分的repo地址修改为ssh协议 34 | 35 | `url=ssh://git@github.com/zhangjh/myblog.git/` 36 | 37 | 当然官方建议还是使用HTTPS协议,有时候你的服务器死活就是不行的时候,官方建议就另说啦。 38 | -------------------------------------------------------------------------------- /source/_posts/ant-design的select组件onSelect事件简析.md: -------------------------------------------------------------------------------- 1 | title: ant-design的select组件onSelect事件简析 2 | show: true 3 | date: 2017-01-01 17:53:45 4 | tags: [react,ant-design,select,onSelect] 5 | categories: 技术人生 6 | --- 7 | 8 | ## 背景 9 | 最近刚入react的坑,前端的布局和控件设计用的是阿里的开源框架:[ant-design](http://ant.design)。ant-design不失为一款好用的设计框架,与bootstrap类似,比bootstrap好看,只是必须结合react使用。跟阿里其他的开源工具类似地,存在一个共同的通病,亦或者可以说是所有国有开源软件的通病:文档写的不够细致。 10 | ant-design也是这样,在官方文档中经常有一些说的不够的地方,让使用者看的莫名所以。最典型的要数针对控件的API的事件参数的说明了,在这上面已经踩了很多的坑。有的是不知道参数传入的意义,有的是参数传递的使用方法说的不够具体等。本篇就一个具体的问题:Select选择器的onSelect事件记录一下踩坑的经历。 11 | 12 | ## 问题 13 | 我在开发中用到了如下代码片段: 14 | ``` 15 | const options = options.map(d => { 16 | return ; 17 | }); 18 | 21 | ``` 22 | 其中key属性是按照react的官方要求,遍历数组元素生成控件时要添加一个唯一的key属性供react的diff算法渲染。 23 | 渲染没有问题,在下拉选择的时候onSelect获取的参数值总是跟预期的不一致,在上例中,onSelect接收的总是key的值,然而官方文档里说:被选中时调用,参数为选中项的value值。 24 | 25 | ## 探索 26 | 文档除了那一句话外就没多说了,既然文档写的语焉不详,那么只好写测试自己琢磨了。 27 | 28 | 1. 测试代码1 29 | 30 | ``` 31 | import { Select } from 'antd'; 32 | const Option = Select.Option; 33 | 34 | 35 | ReactDOM.render( 36 | 46 | , mountNode); 47 | ``` 48 | 运行后发现确实是选择111时弹出1,选择222时弹出2,获取的是key。。。 49 | 50 | 2. 测试代码2 51 | 52 | ``` 53 | import { Select } from 'antd'; 54 | const Option = Select.Option; 55 | 56 | 57 | ReactDOM.render( 58 | 68 | , mountNode); 69 | ``` 70 | 怀疑官网说的value不是option的value值而是value属性,于是将key属性换成value。结果果然是选择111时弹出1,选择222的时候弹出2了。 71 | 72 | 验证了猜想,文档里说的onSelect的参数是被选中项的value属性而不是值,并且可恶的地方在于,没有设置value属性的时候竟然会返回key属性。。。要么说明下,要么按照文档的如实返回,返回key属性这不是挖坑了吗! 73 | -------------------------------------------------------------------------------- /source/_posts/awk-calc.md: -------------------------------------------------------------------------------- 1 | title: 使用awk BEGIN、END统计文件求和 2 | show: true 3 | date: 2015-12-14 11:04:43 4 | tags: [awk,awk求和,awk BEGIN,awk END] 5 | categories: 技术人生 6 | --- 7 | #### 背景 8 | 我在处理一个自动化报告时,需要统计其中成功的用例个数和失败的用例个数,报告文件的格式类似: 9 | >...... 10 | FAIL 2 tests executed in 5.622s, 1 passed, 1 failed, 0 dubious, 0 skipped. 11 | ...... 12 | PASS 55 tests executed in 54.976s, 55 passed, 0 failed, 0 dubious, 0 skipped. 13 | ...... 14 | PASS 15 tests executed in 20.642s, 15 passed, 0 failed, 0 dubious, 0 skipped. 15 | 16 | #### 使用awk统计 17 | 在Linux下进行文本处理,没什么比sed/AWK更强大了。于是乎直接想到了用awk将报告中的"PASS","FAIL"数目统计一下即可。 18 | 代码示例如下: 19 | 20 | 21 | ```js 22 | PASS数目: 23 | grep -o ".*tests executed in" reportName | awk 'BEGIN{sum=0}{if($1 ~ /PASS/)sum+=$2}END{print sum}' 24 | 25 | FAIL数目: 26 | grep -o ".*tests executed in" reportName | awk 'BEGIN{sum=0}{if($1 ~ /FAIL/)sum+=$2}END{print sum}' 27 | ``` 28 | 29 | 首先从报告文件中,取出匹配的最终运行概述信息,然后再用awk统计对应的条目。 30 | 此处用到了awk的BEGIN和END,顺便记录一下BEGIN和END的用法。 31 | 32 | #### BEGIN和END 33 | BEGIN和END顾名思义,在awk中,BEGIN只在开始处理之前运行一次,END只在结束处理之后运行一次,其余正常的文本行处理过程不运行。 34 | 非常适合用在做一些前置操作时使用,通常求和类初始化值、设定分隔符等经常会用。 35 | 36 | 语法: 37 | ```js 38 | awk '[BEGIN]{..}{..}[END{..}]' file 39 | ``` 40 | 形式均为'{}'样,其中BEGIN和END语句块均可省略。 41 | 42 | examples: 43 | 以统计数字文本(文本内容每行均为数字)为例 44 | ```js 45 | //1. 求和 46 | awk 'BEGIN{sum=0}{sum+=$1}END{print sum}' file 47 | 48 | //2. 求均值 49 | awk 'BEGIN{sum=0}{sum+=$1}END{print sum/NR}' file 50 | NR为总记录数 51 | 52 | //3. 求最大值 53 | awk 'BEGIN{max=0}{if($1 > max)max = $1}END{print max}' 54 | 55 | ``` 56 | 57 | 配合grep、正则表达式以及条件表达式等使用,效果更佳。 58 | -------------------------------------------------------------------------------- /source/_posts/beginning.md: -------------------------------------------------------------------------------- 1 | title: 开篇 2 | date: 2015-06-26 22:39:00 3 | tags: [开篇,心情] 4 | categories: 心情杂感 5 | show: true 6 | --- 7 | 每在一个网站安家,第一篇"Hello world"必然是《开篇》,这回有点不太一样,这回是在自己的网站上了。 8 | 9 | # 絮叨 10 | 这个博客是使用[Hexo技术](https://hexo.io/)搭建的,因此第一篇日志也保留了自动生成的"Hello world",算是一种鸣谢,也可以作为自己日后继续折腾Hexo时的一个查看document的便捷入口。 11 | 12 | 刚开始时只是纯粹的想练习下nodejs建站的水平,自从来了阿里后,接触到了nodejs的东西,就被nodejs迷的不行了,工作中使用nodejs搭建了平台,于是也想到要不自己也搞一个属于自己的网站练练手吧。怎奈工作繁忙下班只想呼呼,念头刚生的时候就调研了阿里云、BAE等虚拟主机,当阿里云短信提醒我订购的虚拟主机即将到期时我在服务器上的node环境还没有安装好。。。 13 | 想了想,要完全自己写一个可用的网站,数据库不可少吧,评论留言不可少吧,现如今移动互联时代移动端响应式不可少吧。。。这么一来,交了一年的服务器钱网站估计还没写出来呢。。于是放弃了那个自以为是的想法,学习nodejs还是工作的时候折腾好了。一个偶然的机会(在github上看到octopress,一个类似WordPress的博客系统),了解到Hexo是一个基于nodejs的博客系统,比octopress还要简单易用,正好又是nodejs的,于是决定选择Hexo来搭建一个属于我自己的博客网站。 14 | 15 | # 关于动机 16 | 记得在研二的时候自己在115模板的基础上折腾了一个网址导航网站,那个时候多半是觉得"有一个属于自己的网站是件很牛逼的事情",现在想想不免嘴角微翘:在现在这个互联网时代,有个网站算个什么事儿啊。 17 | 这么些年来尝试过在很多网站上写过东西,人人网的日志、CSDN的技术博客、写过一些情感纠结的野生百度贴吧、记述观感的豆瓣影评、小众而优雅的Lofter、新浪微博的长微博,甚至微信的段子,无一例外,这些都没能很长久的坚持下去。一部分原因是因为自己的懒惰,一部分也由社交网络的人气转移导致,再一个很大的一点,这些网站在商业化的过程中充斥了越来越多的广告,而社交网络里,那些充斥我信息流的美景、美食、美女们中间我突然穿插那么一段文字,看起来让人觉得很二逼很装逼。在满屏的转载里我找不到在这些网站的归属感,那么干脆搞个自己的网站吧。为自己的网站丰富内容,应该还是会坚持下去吧。 18 | # 关于域名 19 | 为什么会取一个一串数字的域名?[5941740](http://www.5941740.cn)这串数字来源于我对中国互联网审查制度的痛恨。 20 | 5941740谐音是"我就是要气死你",大家都知道如果在中国要搞个网站是必须要备案的,以前在上学时搞的那个导航网站,为了不备案(主要是没钱买空间),采用了国外的免费虚拟空间,然后在网站的底部赤裸裸的调戏工信部:"本网站空间来自国外,无需备案请勿跨省追捕。"这个博客网站本来是准备部署在阿里云主机上,我已经做好了屈服的准备,备案手续已经办的差不多了,结果没想到的是最后的步骤还要去xx特定地方去做信息采集,照相什么。。我为了折腾一下自己的小玩具用得着费这么大劲吗?我身份证、家庭地址什么的都告诉你了,还有什么不放心的呢?官老爷们你们牛,我还是乖乖不备案用免费空间去吧。得,其实是"我被您气死了呢"~ 21 | # 关于博客 22 | 关于这个博客,我希望它能督促我持续不断的记录下去。在长时间混迹社交网络之后,现在的我想个超过140字的句子总是显得很费力,有的时候满腹千言无从下笔,我想你们也是,想曾经我也是写过中篇长文的呢,呵呵。 23 | 好记性不如烂笔头,希望在长时间的积累后,能找到点思考以及行文的能力,也将日常工作中值得记录的内容记录在案,方便查找以及温故知新。 24 | 写博客跟写日记一样,明明是只写给自己,但写的时候仿佛又是期待别人来看。真是矛盾的呢。。 25 | 我的计划,大概会分几个类目,一个是技术人生,专门记录日常工作中的一些与技术相关的内容,一个是读书笔记,相当于取代豆瓣的功能,简短记录每年所看的书目,一个是心情杂感,随便扯点有的没的,毕竟我感性那是自己都害怕,一个是文青空间,有可能不会存在的类目,以目前的文笔来看,基本写不出个什么狗屎来了,还一个就是图片墙,用来专门晒图,还一个就是文摘采撷,摘录一些觉得有用的内容。 26 | 以上是为记。 27 | -------------------------------------------------------------------------------- /source/_posts/beian.md: -------------------------------------------------------------------------------- 1 | title: 备案那点小事 2 | show: true 3 | date: 2016-01-08 15:43:07 4 | tags: 备案 5 | categories: 心情杂感 6 | --- 7 | 时隔9天,小破站关站9天之后重开,官老爷的一条备案通过短信终于宣告我这小站终于迎来了合法身份,再也不是一个法外黑户。也宣告我那份小小的倔强与骄傲终究向现实妥协。 8 | 9 | 我本可以继续选择不备案,但是在现实情况下,不备案意味着很多不便: 10 | 1. 免费的cdn加速基本都需要备案first 11 | 2. 万网的域名解析显性URL或者隐型URL跳转需要备案first 12 | 3. 加入国内的广告联盟需要备案first 13 | 4. 甚至不备案cn域名都不能解析 14 | 5. ...... 15 | 16 | 为了能用上上述功能,最终还是决定备案。我曾YY过,备案过后,一旦我发表点什么发动言论,那把悬在头顶的"达摩克里斯之剑"就会掉下来,公安开始上门抓人。。。哈哈,备案在我看来更多的是"防君子不防小人",阻拦的都是没什么做恶之心的人,真想做恶的人管你刀山火海上天入地。就像GFW,想翻墙的人想尽办法也会翻,不想翻的没有墙也不会去看。无非多了一个恶心人的东西。什么时候针对"麻烦事儿"不是一味去堵,而是去设法疏导就好了,我仅一介布衣,键盘侠一名,吐吐槽差不多是我能做的为数不多的事了。 17 | 18 | 19 | 20 | 在开始准备备案之前做了一些准备工作,因为预期到要关站一段时间,如果网站不可访问,那么必定会被百度、谷歌K站。好在域名解析里提供了搜索引擎专线,可以针对搜索引擎做专门的解析。于是我取巧了一下: 21 | 1. 修改了网站,提供了两个版本,一个版本给人看(网站正在备案维护...),一个版本给搜索引擎看(正常的内容) 22 | 2. 修改域名解析,默认解析到备案维护版本,搜索引擎解析到正常版本 23 | 24 | 31号那天傍晚时候,阿里云客服电话我说准备提交备案信息,需要关站。那时候我已经回家准备结婚了。。于是速度手机上了下网,把准备好的解析打开生效,手机测试了几下访问的是备案版本了。之后就是漫长的等待,原本以为元旦三天就可以搞定了,结果一直到今天才审核通过。 25 | 26 | 关于域名,5941740本来是"我就是要气死你"的谐音,寓意坚持不备案,甚至有一点点"挑衅"的调皮意味。如今倔强落地,骄傲不在,是时候该再重新择域名一枚了。 27 | 28 | 以上是为记,庆贺首次备案。 29 | -------------------------------------------------------------------------------- /source/_posts/csv-encoding-bom.md: -------------------------------------------------------------------------------- 1 | title: JAVA导出CSV乱码问题 2 | show: true 3 | date: 2017-10-11 16:09:41 4 | tags: [csv,oss,utf8,bom] 5 | categories: 技术人生 6 | --- 7 | # 背景 8 | 我在项目中使用阿里云OSS存储文件,导出时导出为csv格式的文件。然而打开时总是存在中文乱码。 9 | 通过网上的一番搜索,大抵是使用记事本先打开csv文件,然后再保存为ANSI格式,然后再用excel打开时就不存在乱码了。但这不是程序里的解决方式,我们不可能提供一个半成品的导出文件供用户使用。经过一番网上搜寻,发现问题的根源在于UTF8的BOM信息头。 10 | 本来UTF8是不需要BOM头的,这就不得不说到微软的可恶了。 11 | 12 | # BOM简介 13 | BOM中文译作"字节顺序标记",UTF8本不需要BOM来表明字节顺序,但WINDOWS用BOM来标记文件文件的编码方式。BOM的UTF8编码是"EF BB BF",所以如果接收者收到以"EF BB BF"开头的字节流,就知道这是UTF8编码了。WINDOWS系软件保存的UTF8编码的文件需要文件的开头保有这个BOM字符。 14 | 15 | # 问题解决 16 | 项目中使用OSS存储文件,存储成功后返回一个签名过的文件url地址,前端再根据这个url去请求获取文件。由于前端是直接使用"window.open(url)"的方式,直接新开窗口访问链接,下载下来的文件默认是UTF8编码的,因此使用excel打开时需要BOM字符来表明是UTF8编码,否则其中的中文则会产生乱码。 17 | 18 | 因此,在OSS存储时,我们就需要额外添加BOM头一并存储。代码如下: 19 | ``` 20 | OSSClient client = new OSSClient(ossHelper.getEndPoint(), ossHelper.getAccessKeyId(), 21 | ossHelper.getAccessKeySecret()); 22 | ObjectMetadata objectMetadata = new ObjectMetadata(); 23 | objectMetadata.setContentType("application/vnd.ms-excel"); 24 | objectMetadata.setContentEncoding("UTF-8"); 25 | objectMetadata.setContentDisposition("attachment; filename=" + fileName + ".csv"); 26 | 27 | // 增加BOM头信息 28 | String bom = new String(new byte[] { (byte) 0xEF, (byte) 0xBB,(byte) 0xBF }); 29 | 30 | try { 31 | // 以同样的编码获取字节流 32 | client.putObject(ossHelper.getBucketName(), fileName, 33 | new ByteArrayInputStream((bom + exportFileString).getBytes("UTF-8")), objectMetadata); 34 | }catch (UnsupportedEncodingException e){ 35 | e.printStackTrace(); 36 | } 37 | 38 | ``` 39 | -------------------------------------------------------------------------------- /source/_posts/drunk-post-of-programmer.md: -------------------------------------------------------------------------------- 1 | title: 【转】程序员的酒后真言 2 | show: true 3 | date: 2021-06-29 15:04:58 4 | tags: 5 | categories: 随感 6 | --- 7 | 转载:http://www.ruanyifeng.com/blog/2021/06/drunk-post-of-a-programmer.html 8 | 9 | 美国最大的论坛 Reddit,最近有一个热帖。 10 | 11 | 一个程序员说自己喝醉了,软件工程师已经当了10年,心里有好多话想说,"我可能会后悔今天说了这些话。" 12 | 13 | 14 | 15 | 他洋洋洒洒写了一大堆,获得9700多个赞。内容很有意思,值得一读,下面是节选。 16 | 17 | 18 | 19 | (1)职业发展的最好方法是换公司。 20 | 21 | (2)技术栈不重要。技术领域有大约 10-20 条核心原则,重要的是这些原则,技术栈只是落实它们的方法。你如果不熟悉某个技术栈,不需要过度担心。 22 | 23 | (3)工作和人际关系是两回事。有一些公司,我交到了好朋友,但是工作得并不开心;另一些公司,我没有与任何同事建立友谊,但是工作得很开心。 24 | 25 | (4)我总是对经理实话实说。怕什么?他开除我?我会在两周内找到一份新工作。 26 | 27 | (5)如果一家公司的工程师超过 100 人,它的期权可能在未来十年内变得很有价值。对于工程师人数很少的公司,期权一般都是毫无价值。 28 | 29 | (6)好的代码是初级工程师可以理解的代码。伟大的代码可以被第一年的 CS 专业的新生理解。 30 | 31 | (7)作为一名工程师,最被低估的技能是记录。说真的,如果有人可以教我怎么写文档,我会付钱,也许是 1000 美元。 32 | 33 | (8)网上的口水战,几乎都无关紧要,别去参与。 34 | 35 | (9)如果我发现自己是公司里面最厉害的工程师,那就该离开了。 36 | 37 | (10)我们应该雇佣更多的实习生,他们很棒。那些精力充沛的小家伙用他们的想法乱搞。如果他们公开质疑或批评某事,那就更好了。我喜欢实习生。 38 | 39 | 40 | 41 | (11)技术栈很重要。如果你使用 Python 或 C++ 语言,就会忍不住想做一些非常不同的事情。因为某些工具确实擅长某些工作。 42 | 43 | (12)如果你不确定自己想做什么东西,请使用 Java。这是一种糟糕的编程语言,但几乎无所不能。 44 | 45 | (13)对于初学者来说,最赚钱的编程语言是 SQL,干翻所有其他语言。你只了解 SQL 而不会做其他事情,照样赚钱。人力资源专家的年薪?也许5万美元。懂 SQL 的人力资源专家?9万美元。 46 | 47 | (14)测试很重要,但 TDD (测试驱动的开发)几乎变成了一个邪教。 48 | 49 | (15) 政府单位很轻松,但并不像人们说的那样好。对于职业生涯早期到中期的工程师,12 万美元的年薪 + 各种福利 + 养老金听起来不错,但是你将被禁锢在深奥的专用工具里面,离开政府单位以后,这些知识就没用了。我非常尊重政府工作人员,但说真的,这些地方的工程师,年龄中位数在 50 岁以上是有原因的。 50 | 51 | (16)再倒一杯酒。 52 | 53 | (17)大多数头衔都无关紧要,随便什么公司都可以有首席工程师。 54 | 55 | (18)手腕和背部的健康问题可不是开玩笑的,好的设备值得花钱。 56 | 57 | (19)当一个软件工程师,最好的事情是什么?你可以结识很多想法相同的人,大家互相交流,不一定有相同的兴趣,但是对方会用跟你相同的方式思考问题,这很酷。 58 | 59 | (20)有些技术太流行,我不得不用它。我心里就会很讨厌这种技术,但会把它推荐给客户,比如我恨 Jenkins,但把它推荐给新客户,我不觉得做错了。 60 | 61 | (21)成为一名优秀的工程师意味着了解最佳实践,成为高级工程师意味着知道何时打破最佳实践。 62 | 63 | (22)发生事故时,如果周围的人试图将责任归咎于外部错误或底层服务中断,那么是时候离开这家公司,继续前进了。 64 | 65 | (23)我遇到的最好的领导,同意我的一部分观点,同时耐心跟我解释,为什么不同意我的另一部分观点。我正在努力成为像他们一样的人。 66 | 67 | (24)算法和数据结构确实重要,但不应该无限夸大,尤其是面试的时候。我没见过药剂师面试时,还要测试有机化学的细节。这个行业的面试过程有时候很糟糕。 68 | 69 | (25)做自己喜欢的事情并不重要,不要让我做讨厌的事情更重要。 70 | 71 | (26)越接近产品,就越接近推动收入增长。无论工作的技术性如何,只要它接近产品,我都感到越有价值。 72 | 73 | (27)即使我平时用 Windows 工作,Linux 也很重要。为什么?因为服务器是 Linux 系统,你最终在 Linux 系统上工作。 74 | 75 | (28)人死了以后,你想让代码成为你的遗产吗?如果是那样,就花很多时间在代码上面吧,因为那是你的遗产。但是,如果你像我一样,更看重与家人、朋友和生活中其他人相处的时光,而不是写的代码,那就别对它太在意。 76 | 77 | (29)我挣的钱还不错,对此心存感激,但还是需要省钱。 78 | 79 | (30)糟糕,我没酒了。 80 | -------------------------------------------------------------------------------- /source/_posts/error-commit.md: -------------------------------------------------------------------------------- 1 | title: 解决git报错:".git/hooks/pre-commit No such file or directory" 2 | show: true 3 | date: 2016-12-22 16:22:00 4 | tags: git 5 | categories: 技术人生 6 | --- 7 | 第二次遇到这个问题了,第一次删除了.git目录重新下载了项目,结果commit记录什么的都不对了,损失惨重,这次又遇到这个问题没敢轻举妄动了,折腾了很久,终于找到了问题的根源,这里记录一下以备忘,顺便给遇到同样问题的朋友们一点启发。 8 | 9 | 这个问题的根源在于跨平台造成的换行符的不一致造成。回想两次操作,都是在push的时候提示要将CRLF替换成LF,"warning: CRLF will be replaced by LF"。接受IDE的建议修改以后,所有的文件的换行符都被替换,于是pre-commit文件的行尾也多了"\r"字符,导致运行时报错。 10 | ``` 11 | .git/hooks/pre-commit: line 4: [: 127 : integer expression expected 12 | .git/hooks/pre-commit: line 5: exit: 0 : numeric argument required 13 | ``` 14 | 15 | 找到问题的原因后,解决方案就呼之欲出了。删除掉多余的字符即可。 16 | 17 | ``` 18 | cp .git/hooks/pre-commit /tmp/pre-commit 19 | tr -d '\r' < /tmp/pre-commit > .git/hooks/pre-commit 20 | ``` 21 | 如果还有其余文件报错,一并处理即可。 22 | -------------------------------------------------------------------------------- /source/_posts/filewatchers.md: -------------------------------------------------------------------------------- 1 | title: 使用IDEA自动编译less文件 2 | show: true 3 | date: 2018-05-13 07:39:45 4 | tags: [filewatchers] 5 | categories: 技术人生 6 | --- 7 | 8 | 12/53,每周一篇博,坚持! 9 | 10 | ### 背景 11 | 我的工作性质是属于全栈的,也就是前后端都需要干的那种"全干工程师"。在阿里又会用到很多内部自研的框架,有的框架就不那么的好用。如工作中用到的这个前端框架,写的CSS文件不支持@import语法。。。这意味着,如果你想将不同页面间样式的公共部分抽取出来再@import的方式不可行,你只能不停的重复同样的样式代码,丑陋且不可维护。 12 | 好在框架支持less等CSS编译语言,而在less中写@import语句是没问题的。于是想到了一个可行的方式:项目维护less样式文件,抽取公共的部分,在需要的地方@import进来,唯一的问题就是需要将这些less文件编译成浏览器认识的CSS。我可不想每次自己来执行编译。 13 | 14 | 15 | 16 | ### FileWatchers插件 17 | IDEA下的FileWatchers插件可以帮助我实现自动编译的功能。它实际上就是一个文件监视器,当文件有所改动时,自动触发设置好的命令执行。 18 | 在说明FileWatchers使用之前,我们先具体的看一下,如何将less编译成可执行的CSS。 19 | 20 | ### 使用LESSC编译LESS文件 21 | 在动手之前,所需的前端依赖环境,如node.js、npm不再赘述。 22 | 首先使用npm安装lessc编译器: 23 | ``` 24 | npm i lessc -d -g 25 | ``` 26 | 安装完之后就可以使用了。 27 | 如: 28 | ```css 29 | /**1.less*/ 30 | @nice-blue: #5B83AD; 31 | div { 32 | p { 33 | color: @nice-blue; 34 | } 35 | } 36 | ``` 37 | 运行命令: 38 | `lessc 1.less > 1.css` 39 | 上述命令将生成: 40 | ``` 41 | div p { 42 | color: #5B83AD; 43 | } 44 | ``` 45 | 上述简单的例子可以看出,使用less来编写样式,给我们提供了一些CSS没有的功能,如嵌套和变量。这里不再赘述,less的详细使用可以参考[less手册](https://less.bootcss.com/)。 46 | 47 | ### IDEA下使用FileWatchers编译less文件 48 | 1. 安装FileWatchers插件 49 | 打开设置找到plugins,搜索FileWatchers并安装 50 | 51 | 2. 重启IDEA,打开设置搜索FileWatchers,通常是在Tools子菜单下 52 | 53 | 3. 设置FileWatchers 54 | 添加模板,这里我选择less 55 | 设置要监控的文件类型及文件变更后的操作如下: 56 | ![](http://wx3.sinaimg.cn/mw690/62d95157gy1fr9zdr0697j21ag0x8gs0.jpg) 57 | 58 | 配置完成后,当我一边写less样式时,FileWatchers将自动调用我的lessc编译器将less文件同步编译生成相应的css文件。 59 | 60 | 这篇博文只是利用FileWatchers来实现了自动编译less文件,其实它的作用远不止这个。只要是希望监视文件变动后自动触发一些操作的事情都可以交给FileWatchers帮忙实现。如当你想尝试某些ES6或更高版本JS的新功能,而又担心浏览器无法识别或者不想自己手动将文件转为低版本时,你可以借助FileWatchers和bable来实现自动的代码转译。 61 | 又或者,你可以利用它来自动压缩混淆代码等等,如果有更好的想法可以评论跟我分享。 62 | -------------------------------------------------------------------------------- /source/_posts/find-xargs-cp.md: -------------------------------------------------------------------------------- 1 | title: 使用find结合xargs进行大批量复制 2 | show: true 3 | date: 2016-07-19 19:59:32 4 | tags: [find,xargs,cp] 5 | categories: 技术人生 6 | --- 7 | ##### 背景 8 | 今天在写脚本的时候遇到这么一个问题,cp复制过程中报错: 9 | ``` 10 | cp: will not overwrite just-created `xxxx' 11 | ``` 12 | 没来由的,cp这么基础的命令怎么还会出错?想了想我这命令也就复制的文件多一点,可能是cp的文件太多了,导致cp参数超限了。于是开始验证,同样的复制命令,删除了一些文件之后就cp成功了。 13 | 14 | 虽然根据谷歌查找到的[**资料**](http://unix.stackexchange.com/questions/110282/cp-max-source-files-number-arguments-for-copy-utility)显示,我这cp的源文件长度还远没有到达最大限制。不纠缠于此,既然文件太多了,那么使用xargs来复制吧。 15 | 16 | ##### xargs 17 | 直接附上命令: 18 | ``` 19 | find ${src_dir} -type f | xargs -i cp {} ${dst_dir} 20 | ``` 21 | 22 | 由于cp是二元操作,需要传入源文件,这里需要使用xargs的替换模式。使用`-i`参数,然后可以使用`{}`表示来自标准输入的参数。 23 | -------------------------------------------------------------------------------- /source/_posts/git-learning-3.md: -------------------------------------------------------------------------------- 1 | title: git学习笔记(3) 2 | date: 2015-07-24 14:31:39 3 | tags: git 4 | categories: 技术人生 5 | show: true 6 | --- 7 | 本篇对Git的学习做一个扫尾笔记,主要是标签、配置等一些杂项。 8 | 三篇下来,基本上对日常使用中常用到的方法和命令都基本掌握了,以后有需要再查漏补缺了。 9 | 10 | # 4.标签 11 | 标签相当于给分支取了一个好记的别名,这在git里称为里程碑。比如我们的代码版本达到了发布版本,可以取个别名叫做v1.0等等。方便后续更容易访问,而不是查看git log找到对应的commitid。 12 | 13 | 标签即版本库快照。 14 | 15 | 16 | 17 | ## 4.1 创建标签 18 | git中打标签非常简单,拢共分两步: 19 | - 首先切换到待打标签的分支上 20 | ```js 21 | git checkout 22 | 23 | ``` 24 | - 然后git tag打标签 25 | ```js 26 | git tag 27 | ``` 28 | 29 | 默认是给最新提交打标签,也可以给某次的历史commit打标签: 30 | ```js 31 | git tag 32 | 33 | ``` 34 | ## 4.2 查看标签 35 | 可以使用`git tag`查看标签,`git show `可以查看标签信息。 36 | ![](http://ww3.sinaimg.cn/large/62d95157gw1eudveokukyj20lt09kn0b.jpg) 37 | 38 | ## 4.3 删除标签 39 | 删除本地标签: 40 | ```js 41 | git tag -d 42 | ``` 43 | 如果要删除远程标签:(先删除本地再删除远程) 44 | ```js 45 | git tag -d 46 | git push origin :refs/tags/ 47 | ``` 48 | 49 | ## 4.4 推送标签 50 | ```js 51 | git push origin 52 | ``` 53 | 一次性推送全部本地尚未推送到远程的标签: 54 | ```js 55 | git push origin --tags 56 | ``` 57 | 58 | # 5. 杂项 59 | ## 5.1 配置git显示颜色 60 | ```js 61 | git config --global color.ui true 62 | ``` 63 | 64 | ## 5.2 配置git命令别名 65 | 给常用git命令设置简短别名: 66 | ```js 67 | git config --global alias.st status 68 | git config --global alias.co checkout 69 | git config --global alias.ci commit 70 | git config --global alias.br branch 71 | git config --global alias.pu push 72 | git config --global alias.unstage 'reset HEAD' //放弃暂存区的修改 73 | ``` 74 | ## 5.3 配置忽略特殊文件 75 | 我们在管理代码时,有时候有些文件不想列入代码管理,比如nodejs工程的node_modules安装模块目录,这种属于系统生成不是我们开发的文件,每次在查看git修改的时候都会提示"untracked xxx",看着让强迫症患者还是挺不爽的。 76 | 庆幸的是,git提供了忽略这些明确不用加入代码管理的文件的方式。只需配置下配置文件忽略掉他们即可。 77 | ```js 78 | touch ./.gitignore //创建该配置文件,并添加待忽略文件,支持正则 79 | ``` 80 | 81 | 对于熟悉svn的来说,使用git只是熟能生巧的事情,最后附上一张总结的Git常用命令图。 82 | [点击查看源图](http://byte.kde.org/~zrusin/git/git-cheat-sheet-large.png) 83 | ![](http://byte.kde.org/~zrusin/git/git-cheat-sheet-large.png) 84 | -------------------------------------------------------------------------------- /source/_posts/gitcafe-dns.md: -------------------------------------------------------------------------------- 1 | title: gitcafe pages托管的博客dns解析 2 | show: true 3 | date: 2015-12-17 16:35:45 4 | tags: [gitcafe pages,gitcafe dns,gitcafe 域名解析] 5 | categories: 技术人生 6 | --- 7 | #### 背景 8 | 博客托管在github上,目前有很重要的两个问题: 9 | {% cq %} 10 | 1. github拒绝百度收录 11 | 2. 每次发文章都会有github page build warning告警邮件 12 | {% endcq%} 13 | 14 | 上次写了一篇解决告警邮件的问题,但百度不能收录的问题貌似不能同时被解决。虽然改回去以后短暂的百度可以收录了,但今天看又不能收录了,真是。。。 15 | 16 | 于是今天又折腾了一把,把博客迁移到gitcafe上托管了,不纠缠了,顺带还能提升访问速度。 17 | 18 | 本篇不是探讨如何迁移,网上一搜已经一把了,主要想记录一下迁移到gitcafe后如何进行自定义域名的解析。 19 | 关于这个问题,网上一水的文章,就没看到一个解释清楚了的,都是直接就贴配置了,但那些ip都是怎么来的呢?没有任何的说明,难道我的配置也可以写你的ip?这个就连[**官方的help文档**](https://help.gitcafe.com/manuals/help/pages-services#绑定自定义域名)也是语焉不详。 20 | 21 | 以下是我自己折腾成功后的结果,记录下来供后来者借鉴。为此还付出了网站一段时间无法访问的代价。。 22 | 23 | 24 | 25 | #### 解析方法 26 | 1. 和github不一样,gitcafe不用在项目下建立CNAME文件 27 | 2. dig反查自己gitcafe pages的ip,将自定义的域名解析到该ip上 28 | ```js 29 | //我的gitcafe pages域名:JHspider.gitcafe.io,按需替换 30 | dig JHspider.gitcafe.io 31 | 32 | ``` 33 | 找到结果中标红的那行 34 | ![](http://ww1.sinaimg.cn/mw690/62d95157gw1ez2raaxsvtj20j309e76b.jpg) 35 | 此处的ip即为网上多数文章中直接给出的ip的来源。 36 | 在域名解析商处,配置A记录,将自定义的域名解析到此ip即可。 37 | 38 | 以我的阿里云解析为例: 39 | ![](http://ww2.sinaimg.cn/mw690/62d95157gw1ez2rcob54zj20pt03fjrk.jpg) 40 | 41 | -------------------------------------------------------------------------------- /source/_posts/hello-world.md: -------------------------------------------------------------------------------- 1 | title: Hello World 2 | date: 2015-06-25 14:27:31 3 | show: true 4 | --- 5 | Welcome to [Hexo](http://hexo.io/)! This is your very first post. Check [documentation](http://hexo.io/docs/) for more info. If you get any problems when using Hexo, you can find the answer in [troubleshooting](http://hexo.io/docs/troubleshooting.html) or you can ask me on [GitHub](https://github.com/hexojs/hexo/issues). 6 | 7 | ## Quick Start 8 | 9 | 10 | ### Create a new post 11 | 12 | ``` bash 13 | $ hexo new "My New Post" 14 | ``` 15 | 16 | More info: [Writing](http://hexo.io/docs/writing.html) 17 | 18 | ### Run server 19 | 20 | ``` bash 21 | $ hexo server 22 | ``` 23 | 24 | More info: [Server](http://hexo.io/docs/server.html) 25 | 26 | ### Generate static files 27 | 28 | ``` bash 29 | $ hexo generate 30 | ``` 31 | 32 | More info: [Generating](http://hexo.io/docs/generating.html) 33 | 34 | ### Deploy to remote sites 35 | 36 | ``` bash 37 | $ hexo deploy 38 | ``` 39 | 40 | More info: [Deployment](http://hexo.io/docs/deployment.html) 41 | -------------------------------------------------------------------------------- /source/_posts/idea-jvm.md: -------------------------------------------------------------------------------- 1 | title: idea调整jvm参数加快启动编译速度 2 | show: true 3 | date: 2016-12-08 10:09:57 4 | tags: [idea,jvm] 5 | categories: 技术人生 6 | --- 7 | ## 背景 8 | 最近换了个团队,被逼搞起了java+react。在使用webpack打包编译react代码或者使用maven启动java的时候,IntelliJ IDEA卡的跟孙子似的,人生就在这一分一秒的等待中度过,真是让人焦虑的不行。可是我大Think carbon x1可是8G的大内存机器,怎么会这么慢呢。。一开始听说idea就是内存杀手的我还以为是正常的,直到又一次项目直接起不来,并且还报错内存不够用,这真是让人不能接受了,8G的内存起个java说内存不够用?于是听说过jvm参数一说的我怀疑了下是不是idea设置的不太对。。 9 | 10 | ## JVM参数 11 | 设置JVM内存的参数有四个: 12 | 1. -Xmx Java Heap最大值,默认为物理内存的四分之一 13 | 2. -Xms Java Heap初始值,最好将-Xmx和-Xms设置为相同值,避免垃圾回收时由于差值造成时间开销增大 14 | 3. -Xmn Java Heap Young区大小,最好保留默认值 15 | 4. -Xss 每隔线程Stack的大小,最好保留默认值 16 | 17 | ## 修改Idea JVM参数 18 | 打开idea的安装目录,切换到bin目录下,找到jvm的参数配置文件,32位程序为`idea.exe.vmoptions`,64位位`idea64.exe.vmoptions` 19 | 我的打开后看了下,-Xmx和-Xms默认都是设置了128m。。尼玛,什么年代了,给分配128兆内存,怪不得卡成翔。 20 | 果断调整设置分配4096m,其他保持默认不修改。 21 | 22 | ``` 23 | -Xms4096m 24 | -Xmx4096m 25 | -XX:ReservedCodeCacheSize=240m 26 | -XX:+UseConcMarkSweepGC 27 | -XX:SoftRefLRUPolicyMSPerMB=50 28 | -ea 29 | -Dsun.io.useCanonCaches=false 30 | -Djava.net.preferIPv4Stack=true 31 | -XX:+HeapDumpOnOutOfMemoryError 32 | -XX:-OmitStackTraceInFastThrow 33 | -Xverify:none //关闭Java字节码验证,从而加快了类装入的速度,并使得在仅为验证目的而启动的过程中无需装入类,缩短了启动时间。 34 | ``` 35 | 36 | 如果想提高启动速度,还可以将idea打开时默认加载的插件去掉一些自己不用的。路径是`File->Settings->Plugins`,勾掉自己不常用的。 37 | 38 | 关闭重启idea,那酸爽,没系安全带的我差点翻了车。。再试一下webpack打包,那是飞一样的感觉~~ 39 | -------------------------------------------------------------------------------- /source/_posts/idea-remote-debug.md: -------------------------------------------------------------------------------- 1 | title: 使用IntelliJ Idea进行远程调试 2 | show: true 3 | date: 2016-12-15 14:29:30 4 | tags: [idea,远程调试] 5 | categories: 技术人生 6 | --- 7 | 8 | 最近接手了一个烂摊子项目,据说是多少年前的了,没有人会部署本地环境,只能在服务器上通过脚本部署。这么一来就没法使用IDE的调试功能了,排查问题很不方便,跟同事一沟通,发现他们之前是用远程调试来排查问题。用了这么久Idea了,今天还是第一次知道还有远程调试这个功能。本篇就记录一下怎么在Idea里开启远程调试。 9 | 10 | 1. 开启远程访问端口启动服务 11 | 以java应用启动为例,启动参数里要添加这条额外的命令: 12 | ``` 13 | -Xrunjdwp:transport=dt_socket,address=8089,server=y,suspend=n 14 | ``` 15 | 其中的address就是要开启的远程访问端口 16 | 17 | 18 | 19 | 2. Idea打开工程,保证待调试代码和远程版本一致 20 | 编辑debug配置,如下图,在Remote处 21 | ![](http://ww1.sinaimg.cn/mw690/62d95157gw1farh0k000zj20uc0kqtbt.jpg) 22 | host填写远程机器地址,port填写8089 23 | 24 | 3. 添加该远程调试,开启debug调试 25 | ![](http://ww1.sinaimg.cn/mw690/62d95157gw1farh0kp4ayj20uc0kqgo5.jpg) 26 | 添加刚刚配置好的远程调试,点击Debug开启调试 27 | 28 | 4. 添加断点进行调试 29 | 然后就跟本地调试一样啦 30 | -------------------------------------------------------------------------------- /source/_posts/inner-class-deserialize.md: -------------------------------------------------------------------------------- 1 | title: JAVA内部类反序列化问题 2 | show: true 3 | date: 2018-12-31 01:10:34 4 | tags: [JAVA,内部类,反序列化] 5 | categories: 技术人生 6 | --- 7 | 8 | #### 背景 9 | 通常我们在Controller层接收前端传递的复杂参数时,都会封装一个请求参数类,然后将前端传递过来的参数解析成该请求对象。 10 | 这次我遇到的场景,前端传递的参数结构比较复杂,但只有三个字段,其中一个字段又是一个复杂结构,类似这样的结构: 11 | ``` 12 | id: xxx; 13 | name: xxx; 14 | data: { 15 | id: xxx, 16 | parentId: xxx, 17 | item1: xxx, 18 | item2: xxx, 19 | ...... 20 | } 21 | ``` 22 | 其中的data部分数据结构类已经在其他应用中定义,通过二方包的形式引入,为了省事,不想再在外部定义一个只有"id,name,data"三个字段的请求参数类,于是就在Controoler方法内部定义了一个内部类,供方法自己使用。 23 | 然后问题就来了,在参数解析的时候报错: 24 | ``` 25 | Exception in thread "main" com.alibaba.fastjson.JSONException: create instance error, xxxxx 26 | ``` 27 | 。 28 | 29 | 30 | #### 问题复现 31 | 新建测试类,搭建简单的测试代码如下: 32 | ```java 33 | public class Test { 34 | 35 | 36 | 37 | @Getter @Setter 38 | class Param { 39 | private String id; 40 | private String name; 41 | private String data; 42 | } 43 | 44 | public static void main(String[] args) { 45 | String str = "[{id: 1, name: \"test\", data: \"test data\"}]"; 46 | JSONObject.parseArray(str, Param.class); 47 | } 48 | } 49 | ``` 50 | 运行后报错: : "Exception in thread "main" com.alibaba.fastjson.JSONException: create instance error, class xxxx.xxxx.Test$Param" 51 | 一开始一直以为是不是自己JSONObject的parseArray方法用的有问题,然而在debug模式下手动执行`JSONObject.parseArray(str)`命令可以正常解析出参数类,只是没有传入类型参数而已,至此大概知道是不是类写的有问题,然而如此简单的一个类定义...... 52 | 又猜测是不是因为在main函数里调用,Param类需要定义为静态类?于是在Param前加static定义,再次运行竟然成功了。于是这个问题微妙起来,难道真的是因为在main函数测试模式下导致的?那么换一种写法。 53 | 54 | ``` 55 | public class Test { 56 | 57 | @Getter @Setter 58 | class Param { 59 | private String id; 60 | private String name; 61 | private String data; 62 | } 63 | 64 | public void test(){ 65 | String str = "[{id: 1, name: \"test\", data: \"test data\"}]"; 66 | JSONObject.parseArray(str, Param.class); 67 | } 68 | 69 | public static void main(String[] args) { 70 | new Test().test(); 71 | } 72 | } 73 | ``` 74 | 这回不在main函数中测试,结果运行还是报错,这就不是静态不静态的问题了。肯定是内部类的问题了。再次验证,将Param类转移到外部文件中重新定义。 75 | 重新运行测试,可以正常解析成类了。 76 | 77 | #### 结论 78 | 至此,通过测试基本可以断定,fastJson在反序列化内部类的时候有问题或者不支持。 79 | 于是网上查找了下关键词"fastjson 反序列化 内部类",答案呼之欲出: 80 | [官方的issue](https://github.com/alibaba/fastjson/issues/302)中已经指出:: "内部非静态类无法实例化"。 81 | -------------------------------------------------------------------------------- /source/_posts/interview-questions.md.bak: -------------------------------------------------------------------------------- 1 | title: 两道面试题 2 | show: true 3 | date: 2016-07-03 11:41:08 4 | tags: [面试,js] 5 | categories: 技术人生 6 | --- 7 | #### 背景 8 | 9 | 周末去面试练了下手,感觉发挥的不太好。主要是在技术考核阶段代码写的不好,说实话挺反感这种当场让面试者在白板上写代码的方式来考核,我举个例子应该你就明白了。我们每个人小时候应该都有过这种经历,考试的时候监考老师停在你身边看着你的时候,简直是无从下笔...面试也是一样的道理,你站在白板前,面试官在你身后盯着你,在那种应激的状态下很难思考充分,有时候简直是无从思考,所以如果下次再考我写代码的话,请允许我用自己的电脑吧,起码我还可以有试错和调试的机会。 10 | 11 | 面试的不好当然挺沮丧的,有点伤自信,我事后简单想了一下就写出来了,所以就更加觉得这种面试方式面不出来水平了,sigh...这里简单的记录一下,吸取个教训。 12 | 13 | ##### 问题一 14 | 15 | > 使用Promise描述如下过程:绿灯亮3秒,然后红灯亮3秒,然后黄灯再亮3秒。灯亮过程可以用console表示。 16 | 17 | 当时写的不好,纠结在是封装个sleep函数还是用setTimeout,然后定义了三个Promise对象分别表示红、绿、黄灯亮的过程,自己感觉也挺不好的,所以有点畏首畏尾写不下去。回来在自己机器上几分钟就写出来了,还没有重复定义,内心真是。。那个悔啊,被别人看扁了,其实哥真不是不会啊。 18 | 19 | ```js 20 | function sleep(delay){ 21 | var now = new Date().getTime(); 22 | while(new Date().getTime() - now < delay){ 23 | } 24 | } 25 | 26 | function led(color){ 27 | console.log(color); 28 | sleep(3000); 29 | return new Promise(function(resolve,reject){ 30 | resolve(); 31 | }); 32 | } 33 | 34 | //也可以使用自带的setTimeout 35 | function led2(color){ 36 | console.log(color); 37 | return new Promise(function(resolve,reject){ 38 | setTimeout(function(){ 39 | resolve(); 40 | },3000); 41 | }); 42 | } 43 | 44 | led("green").then(function(){ 45 | led("red").then(function(){ 46 | led("yellow"); 47 | }); 48 | }); 49 | ``` 50 | 51 | ###### 问题二 52 | 53 | > 自己实现一个sort2,尽可能地模拟js原有的sort函数 54 | 55 | 这个我确实不会写,js原有的sort函数还可以接收函数参数的。不过让我写个排序的函数还是没问题的。 56 | 57 | ```js 58 | function sort2(arr,option){ 59 | for(var i=0,len=arr.length;i arr[i]){ 64 | var tmp = arr[j]; 65 | arr[j] = arr[i]; 66 | arr[i] = tmp; 67 | } 68 | }else { 69 | if(arr[j] < arr[i]){ 70 | var tmp = arr[j]; 71 | arr[j] = arr[i]; 72 | arr[i] = tmp; 73 | } 74 | } 75 | } 76 | } 77 | return arr; 78 | } 79 | 80 | //var arr = [9,4,6,2,1,3,5,8,7,0]; 81 | var arr = ['c','b','e','a']; 82 | 83 | console.log(sort2(arr)); 84 | 85 | ``` 86 | 该函数支持正序,逆序,数字,字母排序。 87 | 88 | 现在还没有结果,如果因为这两道题挂了,你说我多么冤。我是带着作品去面试的,以为不会再让我当场写代码也没怎么准备,没想到人家也许都没怎么看过我的网站,反正没问到。考虑到当前面试白板编程还是普遍存在的,各位准备面试的,有机会还是多多练习下白板编程以及如何把面试官当做不存在提高应激情形下的编程能力吧。 89 | -------------------------------------------------------------------------------- /source/_posts/iptables.md: -------------------------------------------------------------------------------- 1 | title: iptables端口转发 2 | date: 2015-07-14 20:26:20 3 | tags: [iptables,端口转发] 4 | categories: 技术人生 5 | show: true 6 | --- 7 | # 背景 8 | 我有个网站部署在我linux服务器的自己账户下,我们都知道,如果要以1000以下的端口启动服务需要root权限。而我又没有root权限。 9 | 所以我的网站应用启动在8090端口上,然而访问的时候url带端口的方式看起来很山寨,很土贼,能不能不带端口访问到我的服务呢? 10 | 11 | # iptables端口转发 12 | 使用linux的iptables可以设置端口转发,于是百度查了下,可惜试了很多条都没有生效。于是将我尝试可用的做法记录已备忘。 13 | 14 | 15 | 16 | - 机器环境 17 | `uname -a` 18 | > Linux xxx(mac name) 2.6.32-220.23.2.ali878.el6.x86_64 #1 SMP Mon Jan 28 17:12:52 CST 2013 x86_64 x86_64 x86_64 GNU/Linux 19 | 20 | - 查看当前iptables状态 21 | `sudo service iptables status` 22 | > Chain PREROUTING (policy ACCEPT) 23 | > 24 | > Chain POSTROUTING (policy ACCEPT) 25 | > num target prot opt source destination 26 | > 27 | > Chain OUTPUT (policy ACCEPT) 28 | > num target prot opt source destination 29 | 30 | - 配置端口转发 31 | 将本机80端口的访问请求转发到8090端口上 32 | `sudo /sbin/iptables -t nat -I PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 8090` 33 | 34 | - 保存配置 35 | `sudo service iptables save` 36 | > iptables: Saving firewall rules to /etc/sysconfig/iptables:[ OK ] 37 | 38 | - 重启iptables[可能不需要,确保] 39 | `sudo service iptables restart` 40 | > Flushing firewall rules: [ OK ] 41 | > Setting chains to policy ACCEPT: nat [ OK ] 42 | > Unloading iptables modules: [ OK ] 43 | > Applying iptables firewall rules: [ OK ] 44 | 45 | - 再次查看当前iptables状态 46 | 确认是否多了下面这条内容: 47 | > Table: nat 48 | >Chain PREROUTING (policy ACCEPT) 49 | > num target prot opt source destination 50 | > 1 REDIRECT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:80 redir ports 8090 51 | 52 | 53 | 试试看是不是可以不加端口访问了呢? 54 | -------------------------------------------------------------------------------- /source/_posts/js-device.md: -------------------------------------------------------------------------------- 1 | title: js区分访问设备 2 | show: true 3 | date: 2015-12-10 10:55:32 4 | tags: [js,javascript,区分访问设备,获取访问设备] 5 | categories: 技术人生 6 | --- 7 | {% cq %} 需求是王道,有需求才有折腾的动力。 {% endcq %} 8 | 9 | 昨天在写结婚照分享的页面时,布局采用了一行三章的方式,于是每张照片的宽度定义为33%。 10 | 11 | PC下访问一切ok,但是换用手机端访问后发现有问题,三张照片有两张在一行上,另一张就掉到下一行去了。看起来很怪异。 12 | 于是想给PC访问和移动端访问做一个自适应设计。移动端屏幕下,一行就显示一张就可以了。 13 | 14 | #### 判断方法 15 | 判断访问终端是手机还是PC,大体上有以下几种方法: 16 | 1. 终端平台 17 | 2. 操作系统 18 | 3. 浏览器内核 19 | 4. userAgent 20 | ...... 21 | 22 | 23 | 24 | 这几种方法都需要利用到js的navigator对象来获取相应的信息,具体的navigator知识可以参考:[w3school Navigator对象](http://www.w3school.com.cn/jsref/dom_obj_navigator.asp) 25 | navigator都有哪些可以使用的属性可以在浏览器的终端里查看下。![](http://ww1.sinaimg.cn/mw690/62d95157gw1eyue0nqiegj209n07kaab.jpg) 26 | 经我实验,appName,platform,appVersion,useragent等可以获得当前设备信息。 27 | ![](http://ww2.sinaimg.cn/mw690/62d95157gw1eyue4s75yjj20oz05gjrx.jpg) 28 | 但有些信息准确度上就不好说了。appName和platform的误差可能会有,上图中我的64bit Chrome,appName和platform分别是"Netscape"、"Win32"。 29 | 30 | #### 代码实例 31 | 采用userAgent获取设备信息判断终端类型 32 | ```js 33 | function isPc(){ 34 | var userAgentInfo = navigator.userAgent; 35 | //可识别的移动终端,支持以下 36 | var agents = ["Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod"]; 37 | var flag = true; 38 | for(var i=0,len=agents.length;i javascript中有三种编码的函数,分别是:*`escape()`*,*`encodeURI()`*以及*`encodeURIComponent()`*。 38 | 39 | 1. escape 40 | 该方法不对ASCII字母和数字编码,也不会对ASCII标点符号编码,除此之外的所有字符均会被编码。 41 | 基本上该方法已经被javascript标准所遗弃,从ECMAScript v3开始,标准就建议使用encodeURI和encodeURIComponent代替。 42 | 43 | 2. encodeURI 44 | 该方法不会对字母和数字编码,也不会对这些ASCII标点符号编码:** -_.!~*'() ** 45 | 该方法的目的是对URI进行完整的编码,对URI中具有特殊含义的标点符号不进行转义。 46 | 因此正如我遇到的问题一样,如果URI中含有分隔符,则应当使用`encodeURIComponent`方法编码。 47 | 48 | 3. encodeURIComponent 49 | 该方法不会对字母和数字编码,也不会对这些ASCII标点符号编码:** -_.!~*'() ** 50 | 其他字符,如** ;/?:@&=+$,# **这些用于分隔 URI 组件的标点符号,都会由十六进制转义替换。 51 | encodeURIComponent除了编码标准的URI之外,对于它的参数也都一并进行处理。 52 | 53 | 他们对应的解码函数分别是: 54 | *`unescape()`*,*`decodeURI()`*,*`decodeURIComponent()`* 55 | -------------------------------------------------------------------------------- /source/_posts/js-for-in.md: -------------------------------------------------------------------------------- 1 | title: javascript中for..in循环获取对象属性顺序问题的探讨 2 | date: 2015-07-13 13:58:37 3 | tags: [javascript,for..in] 4 | categories: 技术人生 5 | show: true 6 | --- 7 | #背景 8 | 在项目开发过程中,有一个需求是这样的: 9 | > 平台接受用户输入的一串JSON字符,然后解析JSON串的key-value展示到平台上,并支持用户修改value值再更新。 10 | 11 | 效果图如下: 12 | ![](http://ww3.sinaimg.cn/large/62d95157gw1eu1746ujtwj20km064gml.jpg) 13 | 在调试过程中发现,一旦提交更新展示的字段顺序就跟前一次不一样,再提交一次更新貌似又能恢复,这是咋回事呢? 14 | 15 | 16 | 17 | #原因 18 | JSON对象本身是集合,而集合是无序的,因此for...in遍历对象属性时也是无序的,或者说是不可预期的。 19 | 20 | #替代方式 21 | 正如我的需求一样,就是对对象的顺序有依赖,否则在更新value时就会出现key与value对应不上的问题。 22 | 因此只能将key事先遍历出来进行排序,后面在有需要用到key时不再用for...in遍历,而是直接使用预先遍历出来的key数组。 23 | 24 | ```js 25 | var keyArr = new Array(); 26 | for(var item in params){ 27 | keyArr.push(item); 28 | } 29 | keyArr = keyArr.sort(); 30 | ... 31 | for(var i=0;i 这是我转战JAVA以来的第一篇博文,纪念一下。 8 | 9 | # 背景 10 | 组织变动,转战JAVA差不多有一个月了,做了一个小需求,遇到一个诡异的问题。本文记录一下排查经过,顺便提醒自己后续开发中避免这样的坑。 11 | 12 | # 问题描述 13 | JAVA后端需要给前端返回一串数据,其中有个交易订单号,该交易订单在返回给前端后跟后端吐出的值不一致。直观地来看,最后的几个数字被0取代了。 14 | 一开始以为取错了交易订单号,然而从DEBUG的过程来看,后端的处理结果没有问题,返回了正确的结果给前端。 15 | 如下图所示: 16 | ![](http://wx3.sinaimg.cn/mw690/62d95157gy1fgblq39u2kj208l02x74g.jpg) 17 | ![](http://wx1.sinaimg.cn/mw690/62d95157gy1fgblq2d5a7j20ho07ngmi.jpg) 18 | 19 | 当时也并没有纠结问题的根本原因,下意识地将交易订单号类型从`List`换成了`List`返回就正常了。 20 | 21 | 发布以后觉得这里可能是个坑,于是研究了一下果然是有缘由的。 22 | 23 | 24 | 25 | # 问题原因 26 | 既然将Long改为String就解决了问题,很自然地就想到是不是类型转换的过程中造成了精度丢失。但服务器返回的时候又是正确的,那么问题应该是出在浏览器端了。 27 | 于是着手验证: 28 | 浏览器终端上运行代码 29 | ``` 30 | var t = 1000006221004368407; 31 | console.log(t); // 输出1000006221004368400 32 | var tt = 100000622100436847; 33 | console.log(tt); // 输出100000622100436850 34 | ``` 35 | 至此已经能够确定是前端在解析的时候丢失精度了。 36 | 37 | 在网上搜索查到一段关于js整型大小的说明: 38 | ``` 39 | 精度 40 | 整数(不使用小数点或指数计数法)最多为 15 位。 41 | 小数的最大位数是 17,但是浮点运算并不总是 100% 准确 42 | ``` 43 | 44 | 问题解决了,巧合的是我们的项目里刚好id位数18位超过了js能够精确表达的最大位数。于是在将后端返回的数据JSON化渲染的过程中造成了精度丢失。 45 | 如果不是这个巧合,这个问题可能还不会被发现。 46 | 这也提示我们,**后续如果有超长位数数字需要显示的时候,数据结构最好定义为字符串类型。** 47 | -------------------------------------------------------------------------------- /source/_posts/kclr.md: -------------------------------------------------------------------------------- 1 | title: 空巢老人的养老问题的一些思考 2 | show: true 3 | date: 2018-03-19 21:50:23 4 | tags: [养老,空巢老人] 5 | categories: 心情杂感 6 | --- 7 | 4/53,每周一篇博,坚持! 8 | 9 | ##### 0. 楔子 10 | 周末随老婆一起参加了她外公的葬礼,我这个人比较多愁善感,触景生情,由人及己,不免一阵唏嘘。现在自己也到了上有老下有小的年纪,未来二三十年将是我们要面对身边长辈陆续告别我们的时候,如何解决老人养老的问题让老人有个良好的晚年生活其实不光是我们要面对的问题,这已经是个社会问题。 11 | 12 | ##### 1. 空巢问题 13 | 情绪是复杂的,问题是现实的,按照现如今社会发展的现状:老龄化加剧、传统家庭结构解体、城镇化的发展、独生子女...不单单是我们要考虑父辈的养老问题,等到我们老了的时候我们自己的养老也会成为一个棘手的问题。 14 | 15 | 中国是个有"孝"文化传统的国家,在过去"养儿防老",老了跟子女住一起由子女赡养让这一问题不那么显著。随着社会的发展,"养儿防老"被认为是封建腐朽思想了,城镇化让子女都离开身边独立发展了,年轻人都喜欢独立空间不喜欢和父母一起住,即使有愿意的也有层层原因限制: 不谈传统文化在年轻一代身上印记不明显,夫妻观念是否一致,单单独生子女需要赡养四个老人的经济压力就足够喝一壶了,有意愿的也没条件。年轻人自己要生活要奋斗,于是乎,老人们在散发了自己的光和热后就被"空巢"了。助推这一现象加剧的除了城镇化之外,计划生育政策导致的独生子女问题也在政策施行几十年后即将迎来可见的影响。 16 | 17 | 在这样的社会现状下,可以预想大多数人的晚年生活都将不会多么的有质量,有尊严。当子女远离自己,老两口只能相依为命,一方面是情感上的缺失,另一方面是无人照顾的困局。年岁日增后总有老而无力的时候,到时候生活自理都将成问题。请保姆照顾算是一个途径,然而请保姆这行当算是一个以钱财换良心的行当,谁也不能保证老人付出不菲的金钱后换来的不是保姆关起门来作威作福。敬老院则是另一个大多数人生最后的归宿,相比起私人请来的保姆,相对会更可靠些。那些经济不允许的可能就只能自求多福,难保不会被逼入绝境想不开。想来令人心酸。 18 | 19 | ##### 2. 如何应对? 20 | 虽然现在年轻一代传统孝感有所淡漠,但面对实实在在的城镇化进程以及独生子女带来的家庭结构问题,每个人自己的生存都很不容易,实在是不能在道德层面对不能尽孝的人做过多责备,试图让一对年轻人承担起抚养子女,双方父母甚至祖父母的责任,实在是不太现实。 21 | 22 | 虽然我们这一辈不得不面对大多数老人晚年无法享受子孙绕膝,不得不接受大部分时候情感缺失的现状,但是否能在既有问题下提高老人们的晚年生活质量呢? 23 | 24 | 欧美等发达国家的养老体系主要是社区型福利机构,类似于养老院,以老养老,老人们群居不至于无人照顾或者感觉孤独。 25 | 26 | 但中国国情不同,大部分的老人还是不愿意住养老院的,一方面住养老院需要一定的经济条件,另一方面养老院不是家,人之暮年对亲情的渴望是不以人的意志为转移的,住养老院有一种被家人抛弃的感觉。作为子女,一方面是要尽量多赚钱,给赡养父母提供经济上的支持,另一方面也要给老人正面的引导。这个社会问题,更需要国家政策健全养老体系制度来解决。希望以后能越来越好吧,也希望我们80后是历史上唯一的一批独生子女。 27 | 28 | 这个问题我真的不愿多想,但也不得不想... 29 | -------------------------------------------------------------------------------- /source/_posts/kcxl-2.md: -------------------------------------------------------------------------------- 1 | title: '[转载]程序员口才训练(二)' 2 | show: true 3 | date: 2018-03-30 20:50:00 4 | tags: 口才 5 | categories: 文摘采撷 6 | --- 7 | 8 | 6/53,每周一篇博,坚持! 9 | 10 | [续上篇](http://zhangjh.me/2018/03/24/kcxl/) 11 | 12 | ##### 2. 表达能力 13 | 你能够流利说话,接下来就需要提高自己的表达能力。 14 | 15 | 什么是表达能力? 16 | 17 | 就是你能够透过口头语言,把自己的思想准确表达出来,而且别人也能够理解到你所说的意思。 18 | 19 | 在我们日常生活当中,口头表达大致可以分为两类:对话方式和独白方式。只要把这两种方式的表达能力提高,我们就可以应付生活上各种交流的需求。 20 | 21 | 表达能力差的人,很难快速把看到、听到的客观事物,或者自己想到的意思,准确的给听众传递出来。例如你看完一部电影,你怎么告诉朋友这部电影是好看或者不好看呢? 22 | 23 | 《金字塔原理》这本书提供的一个逻辑表达方案,就是先观点,后理由;而上一级的理由也是下一级的观点。 24 | 25 | 简化之后的表达流程,就是观点,理由,例子(例子和理由调换次序也可以)。 26 | 27 | ![](http://wx3.sinaimg.cn/mw690/62d95157gy1fpv5h6cotzj20rk0hy49y.jpg) 28 | 29 | 但这个表达流程,看上去很容易,运用起来却并不是每个人都得心应手。究其原因,有两点没有做好。 30 | 31 | 32 | 33 | **第一,你每一确立你要表达的中心思想,也就是观点。** 34 | 35 | 当外界的客观事物和你自己想到的事情,刺激你产生一种表达欲望后,这个时候你的大脑就会形成一个针对这次表达的中心思想。 36 | 37 | 例如你看了一部电影,整个观影过程给予你非常愉快的观感(外界客观事物刺激),接着你就产生一种表达欲望,最后你就会因此形成一个表达的中心思想(这部电影很好看)。 38 | 39 | 于是,你跟朋友聊天,你就会向朋友表达你这个电影好看的观点。如果你不知道你想要说什么,那是因为你还没有确立你要表达的中心思想。 40 | 41 | 这样子你就很难发表自己的意见了。 42 | 43 | **第二,没有从已有的资料库里面,提取出可以印证你观点的材料,也就是里有。** 44 | 45 | 你看完一部电影,而这部电影就是一个“资料库”。你要懂得从这个资料库里面,提取一些材料来印证你表达的观点。 46 | 47 | 例如,这部电影是谁谁谁主演的,在电影里面的表演很厉害(材料一);这部电影的剧情迂回曲折,你不看到后面根本不知道接下来会怎么发展,整个过程很有悬念(材料二);这部电影的特效也很厉害,非常自然的融入到剧情里,没有为了炫技而炫技(材料三);这部电影看完后,你会感到非常震撼,很容易被里面的角色打动(材料四)。 48 | 49 | 当你能够把这些从外界获得的已有材料组合起来,就会形成一连串印证你观点的理由。 50 | 51 | 这种表达,就是以中心思想为圆心,再围绕圆心附上相关材料的句群,从而形成的一次思想的交流传递。如果你不懂得从这个资料库里面提取相关的材料,你就很难继续表达下去。 52 | 53 | ![](http://wx1.sinaimg.cn/large/62d95157gy1fpv5t6u1vaj20ps0kcn6o.jpg) 54 | 55 | 那为什么你无法提取材料呢? 56 | 57 | 原因有三: 58 | 1. 你对现有资料库没有用心留意积累;(解决:专心用心去学习) 59 | 60 | 2. 你对谈论的事情没有相关积累的资料库;(解决:多读多看多经历) 61 | 62 | 3. 你还没有对已有的资料库获得自己的理解;(解决:多思考,学而不思则罔) 63 | 64 | 当然,组合这些材料,在日常对话当中并没有特定的顺序,闲聊的时候想到什么就说什么就行。 65 | 66 | 但一些特殊情况,最好是先说了重要的地方,再说一些次要的地方。就是先把重点说出来,其他细节再慢慢去补充。 67 | 68 | 例如,你遇到交通意外,受了点皮外伤,你跟父母说起这件事,你应该先表明你没事这个重点,而不是依赖就描述你被小车撞倒在地,还受伤流血这样。尽管只是皮外伤,但你妈听到你这么说,肯定会吓死。 69 | 70 | 那怎么提高我们的表达能力呢? 71 | 72 | 就是背诵相关表达的文章,然后经常用自己的语言把这些文章复述出来。背诵是积累表达的框架,复述是按照这个框架说出自己的话。 73 | 74 | 如果你不知道怎么描述一件事,就多读一读描述性的文章;如果你不知道怎么说明一件物品,就多读一读相关的说明文;如果你抒情的话说不出来,就多读一读抒情类的文章,培养自己的语感。不会讲故事,就多读一读讲故事的文章。 75 | 76 | 有了这些文章的框架,再用自己的语言复述出来,长此以往,你的表达语感就会形成。这时你的表达能力就会大大提高了。 77 | 78 | 79 | -------------------------------------------------------------------------------- /source/_posts/kcxl-3.md: -------------------------------------------------------------------------------- 1 | title: '[转载]程序员口才训练(三)' 2 | show: true 3 | date: 2018-04-8 20:34:58 4 | tags: 口才 5 | categories: 文摘采撷 6 | --- 7 | 8 | 7/53,每周一篇博,坚持! 9 | 10 | [续上篇](http://zhangjh.me/2018/03/20/kcxl-2) 11 | 12 | ##### 3. 沟通能力 13 | 有了表达能力的加持,你的沟通能力就可以在此基础上培养了。 14 | 15 | 沟通的目的,就是透过语言交流,最终让彼此的思想都能够达成一致共识,取得某些效果。例如你跟家人沟通,就是希望对方能够按照你的想法去做,又或者你希望透过沟通,能够解决到对方不开心这个问题。 16 | 17 | 也就是说,沟通不像闲聊,可以天南地北的任意胡侃,而是需要透过你的语言,跟交流对象一起寻求最适合彼此的解决方案。 18 | 19 | 看到朋友失恋,你跟她沟通,就是希望可以让对方振作起来;看到孩子不听话,你跟他沟通,就是希望还在能够安分守己一点;看到老板这么苛刻,你跟他沟通,就是希望员工能够获得更好的待遇。 20 | 21 | 一篇文章讲述沟通,基本上很困难。 22 | 23 | 但一个好的沟通,应该做到五个方面: 24 | 25 | 26 | 27 | ![](http://wx3.sinaimg.cn/mw690/62d95157gy1fq7uhiw7v1j20rg0d07db.jpg) 28 | 29 | 例如你想让老板提高待遇,这是你的沟通目的,也是第一步。那怎么去沟通呢? 30 | 31 | 你当然不能在对方刚失去一桩生意的情况下,贸然开口跟他说,结果只会失败;同样,如果你刚入职不久,就要求老板加工资,谁都不会理睬你,因为你没有这个资本。 32 | 33 | 当你做出很多成绩,而薪金跟你的能力无法匹配的时候,这个时候你跟老板沟通,就会取得不错的效果。这就是要求你懂得识别什么时候才是最佳的沟通时机。 34 | 35 | 正如你看到朋友不开心,你安慰都不去安慰人家,就要求对方帮你做事,谁会答应呢? 36 | 37 | 第三步就是制定沟通策略。 38 | 39 | 你看到朋友不开心,这个时候你是拍拍对方的肩膀,简单说几句“你不要这样子”,“你不要哭”,还是坐下来了解对方为什么不开心的原因,然后再针对性的为对方排忧解难呢? 40 | 41 | 没有一种沟通策略是万全的,只能根据当下的情况,当下的对象来调整。对于别人来说最优的沟通策略,对于你也许就是最糟糕的。 42 | 43 | 一旦你意识到自己按照当前这种沟通策略没有任何效果,就应该变换沟通方式,换过另一种策略跟对方沟通。 44 | 45 | 在商界,这类型的沟通案例有很多。这一次大家无法达成共识,下一次调整一下谈判的沟通策略,于是就成事了。 46 | 47 | 所以反馈的结果,就是对自身策略的调整。 48 | 49 | 看看对方的底线在哪里,也看看自己的接受程度去到哪里。 50 | 51 | 如果你跟女朋友说:“喂,给我倒杯水过来”,这个沟通策略很糟糕,超出对方接受的底线,这时你就要调整策略,换成这样说:“亲爱的,可以帮我倒杯水吗?”只要这样说,依然是你接受的程度范围内,牺牲一点脸皮,做出让步,未尝不是好策略。 52 | 53 | 当双方都能够为了某个目的做出让步,例如不再伤心,不再要高价,不再这么顽固,这时候沟通就算完成任务了。 54 | 55 | 沟通并不是万能的,不要奢求任何事情都能够透过沟通解决。但沟通,却是我们与外界构建和维持良好关系的有效手段。 56 | 57 | 那怎么提高我们的沟通能力呢? 58 | 59 | 提高你的情商,你的沟通能力也会随之提高的。 60 | 61 | ![](http://wx3.sinaimg.cn/mw690/62d95157gy1fq7usrp8k8j20pq0pinar.jpg) 62 | -------------------------------------------------------------------------------- /source/_posts/linux-install-mysql.md: -------------------------------------------------------------------------------- 1 | title: Linux下安装mysql 2 | show: true 3 | date: 2017-03-14 10:22:33 4 | tags: [mysql] 5 | categories: 技术人生 6 | --- 7 | # 背景 8 | 安装Mysql不知道安装了多少次了,但是每次装的时候都要重新查看文档,每次又会遇到不一样的问题。还是记录一下安装步骤吧,省的每次都要重新翻文档了。 9 | 10 | # 安装步骤 11 | 以安装mysql5.6版本为例,其他版本可以下载官网对应版本,然后查看附带的INSTALL文档。 12 | 13 | 1. 下载 14 | `wget http://cdn.mysql.com/archives/mysql-5.6/mysql-5.6.26-linux-glibc2.5-x86_64.tar.gz ` 15 | 16 | 2. 解压并改名 17 | `tar -xvf mysql-5.6.26-linux-glibc2.5-x86_64.tar.gz && mv mysql-5.6.26-linux-glibc2.5-x86_64 mysql` 18 | 19 | 3. 创建用户组 20 | ``` 21 | #建议将mysql安装在/usr/local目录 22 | mv mysql /usr/local 23 | cd mysql 24 | sudo groupadd mysql 25 | sudo useradd -r -g mysql mysql 26 | ``` 27 | 28 | 4. 修改权限 29 | ``` 30 | sudo chown -R mysql:mysql * 31 | ``` 32 | 33 | 34 | 35 | 5. 初始化数据库 36 | ``` 37 | sudo scripts/mysql_install_db --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --user=mysql 38 | #也可以事先指定配置文件 39 | cp support-files/my-default.cnf my.cnf 40 | #修改my.cnf中basedir地址为/usr/local/mysql 41 | vi my.cnf 42 | sudo scripts/mysql_install_db --user=mysql 43 | ``` 44 | 45 | 6. 启动数据库 46 | `sudo bin/mysqld_safe &` 47 | 如果启动失败,可以去data目录下查看err结尾的错误日志,查看错误信息 48 | 49 | 7. 添加mysql为系统服务 50 | `sudo cp support-files/mysql.server /etc/init.d/mysql` 51 | 之后就可以使用`/etc/init.d/mysql start|stop|restart`来管理mysql了 52 | 53 | 8. 添加环境变量 54 | ``` 55 | sudo vi /etc/profile 56 | #修改PATH=$PATH:/usr/local/mysql/bin 57 | source /etc/profile 58 | ``` 59 | 添加环境变量之后即可任意目录下直接输入mysql进行连接而不用在mysql/bin目录下了。 60 | 61 | 9. 连接mysql 62 | `mysql -uroot -p #新安装没有密码,直接回车连接` 63 | 64 | 10. 设置密码和用户 65 | ``` 66 | #如给root添加密码 67 | mysqladmin -u root password "new password" 68 | #添加新用户 69 | mysql -u root -p 70 | #name处用用户替换,passwd处用密码替换 71 | mysql> GRANT USAGE ON *.* TO 'name'@'localhost' IDENTIFIED BY 'passwd' WITH GRANT OPTION; 72 | ``` 73 | 74 | # 常见错误 75 | 启动过程中报错可以去日志查看,然后针对性的搜索。这里列一下我安装过程中遇到的错误。 76 | 77 | #### Can't open the mysql.plugin table. Please run mysql_upgrade to create it 78 | 这个原因是在运行`mysql_install_db`初始化数据库的过程中出了问题,基本上是配置没有对应上。可以修改配置或者直接传递basedir和datadir,然后重新运行命令解决。 79 | 80 | 81 | -------------------------------------------------------------------------------- /source/_posts/markdown-learning.md: -------------------------------------------------------------------------------- 1 | title: markdown常用语法标记 2 | date: 2015-06-29 17:47:37 3 | tags: markdown 4 | categories: 技术人生 5 | show: true 6 | --- 7 | 工欲善其事必先利其器,hexo博客的写作方式采用的是标准的markdown语法。 8 | 因此要想写出漂亮的格式,掌握好必要的markdown语法必不可少。 9 | 工作中也用到markdown写周报,在此顺便再总结一下markdown常用的语法格式,温故而知新。 10 | 11 | 12 | 13 | # 标题 14 | ``` 15 | # 一级标题 16 | ## 二级标题 17 | ### 三级标题 18 | ...... 19 | ###### 六级标题 20 | ``` 21 | 22 | # 引用 23 | ``` 24 | > 引用的文字 25 | ``` 26 | eg: 27 | > Talk is cheap,show me the code. -- Linus Torvalds 28 | 29 | # 链接 30 | ``` 31 | [this is link text](http://xxx) 32 | ``` 33 | eg: 34 | [百度一下,你就知道](https://www.baidu.com) 35 | 36 | # 图片 37 | 图片跟链接类似,只是[]前面多一个! 38 | ``` 39 | ![](http://xxx) 40 | ``` 41 | eg: 42 | ![](https://www.baidu.com/img/bd_logo1.png) 43 | 44 | # 列表 45 | ``` 46 | - ul1 47 | - ul2 48 | 1. li1 49 | 2. li2 50 | ``` 51 | 符号和文本之间注意留空 52 | eg: 53 | - 无序列表1 54 | - 无序列表2 55 | 1. 有序列表1 56 | 2. 有序列表2 57 | 58 | # 代码&代码块 59 | 代码: 60 | ``` 61 | 用`包裹语句 62 | ``` 63 | 代码块: 64 | ``` 65 | 用```包裹代码块 66 | ``` 67 | eg: 68 | `console.log("hello world!");` 69 | ```js 70 | function test(){ 71 | console.log("hello world"); 72 | } 73 | ``` 74 | 75 | # 字体 76 | 粗体用两个`**`包含 77 | 斜体用一个`*`包含 78 | eg: 79 | **粗体** 80 | *斜体* 81 | 82 | 83 | 84 | -------------------------------------------------------------------------------- /source/_posts/maven-repo.md: -------------------------------------------------------------------------------- 1 | title: Maven仓库类型总结 2 | show: true 3 | date: 2018-03-03 21:09:46 4 | tags: maven 5 | categories: 技术人生 6 | --- 7 | 2/53,每周一篇博,坚持! 8 | 9 | #### Maven仓库类型 10 | Maven有几种不同的仓库类型: 11 | 1. 中央仓库,中央仓库是由Maven官方提供维护的资源仓库 12 | 2. 私有仓库,一般私有仓库由企业自己维护,不对外开放,和中央仓库一起可以称之为远程仓库。 13 | 3. 本地仓库,本地仓库顾名思义就是开发者自己本机所处的仓库环境,通常是自己打包的jar包目录。 14 | 配置的方式是修改maven配置文件的"repositories"部分。 15 | ``` 16 | 17 | 18 | 19 | 20 | central 21 | http://mvnrepo.alibaba-inc.com/mvn/repository 22 | 23 | 24 | 25 | 26 | /path/to/local/repo 27 | ``` 28 | 29 | 30 | 31 | #### Maven仓库加载机制 32 | 当我们在项目pom依赖里配置好了依赖的jar包三元组后,Maven首先会去本地仓库查询是否有对应依赖,如果查询到则直接开始编译,否则就去查询私服,如果查询到则返回开始编译,否则继续去查询中央仓库,如果还没有查到则报依赖不存在错误。 33 | ![](http://wx4.sinaimg.cn/mw690/62d95157gy1fp00ndn1y3j20hs06z0tc.jpg) 34 | 35 | #### 使用本地仓库调试 36 | 我们在实际项目开发过程中,经常会依赖其他应用提供的jar包服务。通常的流程是被依赖方更新后发布提交到公司的私服,然后应用依赖方再去下载对应版本的依赖。如果依赖方同时也是自己维护的应用时,在调试阶段频繁发布jar包版本会造成开发效率的低下,此时我们就可以借助本地仓库来提高开发效率。 37 | 我们开发完依赖的程序逻辑后,在本地进行打包,然后依赖方使用本地打包版本进行测试,直到测试通过再进行依赖包的正式发布。 38 | ``` 39 | // maven本地打包 40 | mvn install -Dmaven.test.skip 41 | // 运行上述命令后,maven就将按照应用工程pom中定义的三元组打包成本地jar存储在本地仓库中 42 | // 如果是非maven工程,也可以手工指定三元组信息打包 43 | mvn install -Dfile=xxx -DgroupId=xxx -DartifactId=xx -Dversion=xx -Dpackaging=jar 44 | // 然后就可以在maven工程中指定pom依赖了 45 | ``` 46 | 47 | 48 | -------------------------------------------------------------------------------- /source/_posts/mongodb-back-restore.md: -------------------------------------------------------------------------------- 1 | title: mongodb数据备份与恢复 2 | show: true 3 | date: 2016-06-08 12:45:22 4 | tags: [mongodb,备份,恢复] 5 | categories: 技术人生 6 | --- 7 | #### MongoDB数据备份 8 | ##### 1. 语法 9 | ``` 10 | mongodump -h dbhost -d dbname -c collection -o dbdirectory 11 | ``` 12 | - -h: mongodb所在服务器地址 13 | - -d: 需要备份的数据库实例名称,如test,如果不指定将备份所有的数据库 14 | - -c: 指定需要备份的数据表,如果不指定备份所有collection 15 | - -o: 数据备份存放的路径,如不存在需要提前建立,如:./backup,备份完成后备份数据会被存放在./backup/test 16 | 17 | ##### 2. 示例 18 | ``` 19 | mongodump -d favlink -o ./favlinks 20 | ``` 21 | 上述命令将本地数据库的favlink实例备份到当前路径的favlinks目录下,备份完成后的数据如图显示: 22 | ![](http://ww4.sinaimg.cn/mw690/62d95157gw1f4nqfens68j20np01ydg6.jpg) 23 | 24 | 25 | 26 | #### MongoDB数据恢复 27 | ##### 1. 语法 28 | ``` 29 | mongorestore -h dbhost -d dbname -c collection --directoryperdb dbdirectory 30 | ``` 31 | 以上参数同备份参数,`--directoryperdb`指明需要恢复的数据路径,如上述备份,恢复的时候需要指定为:`./backup/test` 32 | 更多的参数可以通过`--help`查询。 33 | 34 | ##### 2. 示例 35 | ``` 36 | mongorestore -d favlink --directoryperdb ./favlinks 37 | ``` 38 | 上述命令将保存在当前路径下的favlink数据库恢复到本机mongodb数据库里。恢复完成后如图显示: 39 | ![](http://ww1.sinaimg.cn/mw690/62d95157gw1f4nqrkd0ddj20sr069mzf.jpg) 40 | -------------------------------------------------------------------------------- /source/_posts/mongoose-update-all.md: -------------------------------------------------------------------------------- 1 | title: mongoose更新所有命中的文档 2 | show: true 3 | date: 2015-12-21 16:44:27 4 | tags: [mongodb,mongoose,update all] 5 | categories: 技术人生 6 | --- 7 | #### 背景 8 | 我的mongodb数据库通过mongoose读写,自定义了mongoose的读写接口。之前的历史数据在写的时候由于一个小bug,导致插入的数据id字段都一样(本来是作为主键区分数据的)。 9 | 于是在修改数据的时候,使用id就不可用了,因此额外写了个脚本想批量将这些历史数据订正。 10 | 结果在实际运行的过程中发现,总是有数据不生效,反复调试了很长时间,最终怀疑是更新时只更新到了第一次匹配的数据,而后实践表明确实如此。 11 | 写完mongoose读写接口之后就再也没有研究mongoose了,对mongoose API不熟悉了。。这篇文档以为记。 12 | 13 | #### 解决方法 14 | mongoose的[**API**](http://mongoosejs.com/docs/api.html#model_Model.update)里写到mongoose的update方法使用方法如下: 15 | ```js 16 | Model.update(conditions, doc, [options], [callback]) 17 | ``` 18 | 19 | 20 | 21 | 参数均json格式,conditions为命中条件,doc为待更新的目标文档,options是可选条件,callback为更新成功后操作。 22 | 这里可选的options操作我在封装的读写接口里置空了,要更新全部匹配的文档则需要利用到options可选条件。 23 | 24 | 此处,options的合法选项有(取值均为boolean): 25 | ```js 26 | safe (默认true) 27 | upsert (默认false,如果文档不存在时是否自动创建) 28 | multi (默认false,是否更新多个匹配文档) <-- 解决该问题所需用到的条件 29 | strict (默认true,确保不会把scheme中没有定义的值写入数据库) 30 | overwrite (默认false,允许覆写) 31 | ``` 32 | 33 | 了解到这些,于是解决方案呼之欲出: 34 | 将更新命令中的options条件改为:`{multi: true}` 35 | -------------------------------------------------------------------------------- /source/_posts/myreading-2020.md: -------------------------------------------------------------------------------- 1 | title: 我的阅读-2020 2 | show: true 3 | date: 2020-02-26 15:15:00 4 | tags: 阅读 5 | categories: 阅历 6 | --- 7 | ![分布式系统常用技术及案例分析](https://img3.doubanio.com/view/subject/s/public/s29345560.jpg) 8 | > 没啥干货。。 9 | 10 | ![人生护城河](https://img1.doubanio.com/view/subject/s/public/s33313187.jpg) 11 | > 人到中年,危机感也愈来愈重,有很多的困惑找不到答案,于是身心都很困苦,现在才稍有理解佛家说“众生皆苦”。辉哥的这本书多少有点启发,是一本值的二读的书。 12 | 13 | ![算法图解](https://img9.doubanio.com/view/subject/s/public/s29358625.jpg) 14 | > 最近在研究算法,有些年头不搞忘的七七八八了,脉脉上听人推荐了这本书,说是算法入门,没想到也太入门了点。。。与我没啥收货浪费几十块钱。本来应该看电子书的,想到搞算法这么严肃认真的事情还是应该买本实体书的,大意了轻信了网友的推荐 15 | 16 | ![如何获得真正的财富](https://img3.doubanio.com/view/subject/s/p/s29751621.jpg) 17 | > 书名很好,书很一般吧。前面的章节还能学到点经济学知识,写的也还算有点话题,到了后面就是想到哪写到哪了,基本就是作者的分答、论坛、星球之类的问题回答了吧,没啥系统。这类书看看拓展点视野是可以的,观点正确与否还是要有个人的判断的。 18 | 19 | ![聪明人是怎样用钱赚钱的](https://img1.doubanio.com/view/subject/s/p/s29684008.jpg) 20 | > 前半部分一些理论知识还是有所启发的,后面的没啥用处。理财类的书基本上应该就这样了,看不到什么新的内容了。后面就是践行了应该不再会看类似的书了。 21 | 22 | ![](https://img1.doubanio.com/view/subject/s/p/s32344999.jpg) 23 | > 很简洁的一本小册子,介绍了TED PPT设计的原则。然而我还是那个,"懂得很多原则,却依然做不好PPT"的人。。。 24 | 25 | ![](https://img9.doubanio.com/view/subject/s/p/s29451374.jpg) 26 | > 一本读起来很轻松的阅读建议手册,能吸取一些很好的建议,比如如何选书,如何衡量一本书对于自己的价值,如何使用逻辑、情境等方式阅读等。还是那句话,道理都懂,受过高等教育的人应该不至于不会读书,现如今制约我们长时间阅读的主要是分散的注意力,一方面是移动互联网的便捷,一方面是一颗焦虑而不安的心,导致读书远没有上学时那样聚焦和纯粹,现在有限的自由时间里分配来阅读就没办法分配其他事情,于是基本上阅读都是抱着很强的功利心。而且一旦这样就会觉得这本书也不想看那本书也不想看,然后时间就这么蹉跎了。。还是本书的观点之一,不管怎样先看起来,每天都坚持就好。 27 | 28 | ![](https://img2.doubanio.com/view/subject/s/p/s23128183.jpg) 29 | > 像《隐秘的角落》一样,哈珀李在这本书里从吉姆的胳膊伤为引子,讲述了那年夏天几个少年的经历。童年的夏天总是漫长的,足够多的经历足够多的成长。主线故事怪人拉德利,汤姆的冤案,批判了种族歧视和偏见的人性丑恶,同时给我们展示了一个完美的父亲形象,在子女教育上也有所启发。算是一本温暖的好书。 30 | -------------------------------------------------------------------------------- /source/_posts/myreading-2021.md: -------------------------------------------------------------------------------- 1 | title: 我的阅读-2021 2 | show: true 3 | date: 2021-05-18 07:33:00 4 | tags: 阅读 5 | categories: 阅历 6 | --- 7 | ![每天5分钟玩转kubernetes](https://img1.doubanio.com/view/subject/s/p/s29731157.jpg) 8 | > 走马观花地看了一遍,了解了一下k8s的相关概念,扫个盲比较合适。 9 | 10 | ![每天5分钟玩转docker容器技术](https://img1.doubanio.com/view/subject/s/p/s29623609.jpg) 11 | > 非常不错的一本docker入门指南,跟着命令操作一遍基本上就掌握了。 12 | 13 | ![万历十五年](https://img9.doubanio.com/view/subject/s/p/s1800355.jpg) 14 | > 现在这个注意力分散的时代,想认认真真读点纸质书真的是太难了,看一会儿就想翻翻手机。。平时要看点专业书,那真是“抽丝剥茧”般的困难,一天看不了几页。。还是看闲书来的畅快,“挑灯夜战,水银泻地”。说回这本书本身,每个人都被时代所裹挟,在时代的洪流面前,个人是何其地渺小。挣扎、奋斗的意义是什么?能得到什么样的实际结果,很大程度上并不能由个人左右。万历的逃避抗争、申时行的妥协调和、海瑞的理想化的清高、戚继光的军事化改革以及李贽的自我拉扯矛盾。。每个人都不能自主地脱离于时代,每个人又塑造了这个时代。 15 | 当时代的框限制住了,皇帝励精图治或耽于享乐,首辅的独裁或调和,将领的富于创造或习于苟安,文官的廉洁奉公或贪污腐化,思想家的进步或保守,都很难阻挡时代的车轮,仿佛个人的努力只是徒劳的螳臂当车,最终的结果都是无分善恶,统统不能取得有意义的结果。万历十五年,悲剧而失败的一年,与平静中酝酿帝国的崩塌,看的让人有一种悲观莫名的宿命感。 16 | 17 | ![通用源码阅读指导书--MyBatis源码详解](https://img1.doubanio.com/view/subject/s/p/s33686459.jpg) 18 | > 非常棒的一本书,阅读体验很棒,读起来很舒服。少有的能将代码和文字结合的很赞的一本技术书。 19 | 20 | ![生命密码](https://img2.doubanio.com/view/subject/s/public/s29912082.jpg) 21 | > 微信视频刷到了尹烨的《生命·觉者》的短视频,对人体、细菌的阐述让我兴趣大增,于是读了一下他的著作。但总体比较失望,这本书太简单了一点,仅仅是皮毛性的做了下生物学方面的科普,每章节对基因做了一点涉及。总体跟基因、生命的探讨太少了,可能也跟人类目前对基因还不是了解很深刻有关吧。 22 | 23 | ![redis设计与实现](https://img1.doubanio.com/view/subject/s/p/s27297117.jpg) 24 | > 这本书写的真的很好,深入浅出,把原理和设计解释的很清楚。看完很通透,有以前在学校学习知识的感觉,只是记性不如以前好了,看完忘的也比较快。。。 25 | 26 | ![漫长的告别](https://img2.doubanio.com/view/subject/s/p/s29860112.jpg) 27 | > 耗费十多个小时熬了几个夜读完了,中途一度想弃读,只是被“村上春树看了十二遍”这个标签吊着想看个究竟,加上沉没成本。。在我看来,剧情并不高明,比东野圭吾差远了,看这等闲书本来就是奔娱乐来的。很多设定和逻辑可能是文化差异?很难理解,看着还别扭不通。。所以,村上春树看十二遍的理由是什么? 28 | 29 | ![山月记](https://img1.doubanio.com/view/subject/s/p/s30020978.jpg) 30 | > 看到推荐书评说"如果你很迷茫自我拉扯,一定要读《山月记》"于是下来一看,结果懵逼了,书是不错,但就是挺奇怪的。。日本人用日文写的中国古典小说,再翻译过来出口转内销。。子路、李陵的故事都耳熟能详了,山月记写的很不错,悟净的故事也很哲学,光风梦就算了,实在读不下去,唯一一篇完全西洋风格的叙事故事,没有代入感不感兴趣感觉跟全书风格也很跳脱。。 31 | 32 | ![ES源码解析与优化实战](https://img1.doubanio.com/view/subject/s/p/s29931477.jpg) 33 | > ES相关的好书真的是太少了。。这本书看下来感觉完全没有收获,名字起的好。。 34 | -------------------------------------------------------------------------------- /source/_posts/myreading-2022.md: -------------------------------------------------------------------------------- 1 | title: 我的阅读-2022 2 | show: true 3 | date: 2022-02-25 10:27:26 4 | tags: 阅读 5 | categories: 阅历 6 | --- 7 | RocketMQ实战与源码解析 8 | > 总体来说写的不够深入,代码逻辑说明基本上都是贴一段代码,然后寥寥数语带过。不过这也算是源码解析类书籍的通病了,很少有书籍能够从整体业务链路角度来剖析源码阐述原理,大多都是贴一段认为的核心方法,然后片段式的进行解析。 9 | 10 | ![清明上河图:隐藏在千古名画中的阴谋与杀局](https://img1.doubanio.com/view/subject/s/public/s27956707.jpg) 11 | > 强烈推荐!作者的悬疑功底很到位,蒙太奇式的在主线之外穿插了多条支线,将一个庞大的局中局描绘的抓心挠肝。一手文采斐然的诗词和古文也是绝妙。但优点处也是缺点,书本很厚又吊人胃口,经常一个支线跳到另一个支线,每到关键之处就“请听下回分解”,考验读者的记忆力和耐性,稍有破坏阅读体验。另外,作为探案解密类书籍,很多地方借用巧合,顿悟来推动剧情,让合理性稍有欠缺。 12 | 13 | ![文治帝国:大宋300年的世运与任务](https://img2.doubanio.com/view/subject/s/public/s33909541.jpg) 14 | > 宋朝得国不正,导致国家制度天生缺陷,重文抑武,凡事都想着用钱解决。虽然造就了古代史上璀璨不亚于先秦的文化,但也造就了软骨头文弱的两宋军政。一部南宋史就是一部不停内斗、割地议和、自我阉割的屈辱史。整个古代大一统王朝里,除了两晋估计也就两宋了,要不是经济文化的繁荣遮羞,真的也算是“垃圾王朝”了。 15 | 16 | ![长安的荔枝](https://img9.doubanio.com/view/photo/s/public/p2715945946.webp) 17 | > 亲王11天写就的中篇,从底层办事员角度阐释”一骑红尘妃子笑“背后的无数心酸与艰难的背负。情节跌宕,引人入胜,推荐。 18 | -------------------------------------------------------------------------------- /source/_posts/mysql-case-when.md: -------------------------------------------------------------------------------- 1 | title: mysql中CASE...WHEN的使用 2 | show: true 3 | date: 2018-05-20 14:23:49 4 | tags: [mysql,case when] 5 | categories: 技术人生 6 | --- 7 | 8 | 13/53,每周一篇博,坚持! 9 | 10 | #### 背景 11 | Mysql一直是我的弱项之一,以前跟数据库打交道比较少,基本只限于基本的操作。现在专职做后端之后,跟数据库打交道的机会多了很多,Mysql这块也在有意识的补强。这篇博客就记录一下最近项目中使用到的CASE...WHEN的使用。 12 | 13 | 很多情况下,我们会用到映射结构,如将某个类型描述映射为某个数字,常见的如页面下拉框中通常我们会把文本赋值具体显示的值,把value赋值映射过的数字,如下代码所示: 14 | ``` 15 | 21 | ``` 22 | 我们在代码中拿到了相应的数字通常是使用Switch...Case结构来获取映射的状态值。而Mysql中的CASE...WHEN结构就是做类似的事情。 23 | 24 | 25 | 26 | #### 使用方式 27 | 假设下面的场景: 28 | 我们要从某个表中同步数据,源表的status字段存储的为tinyint的数字用来表示状态,映射关系如上述select中所述。我们希望同步过来后直接以文本形式存储在目的表中。 29 | 采用MySQL的CASE...WHEN可以这么写: 30 | ``` 31 | INSERT TABLE dest_table 32 | SELECT CASE status 33 | WHEN 1 THEN "试运营" 34 | WHEN 2 THEN "运营" 35 | WHEN 3 THEN "已退出" 36 | END 37 | FROM origin_table; 38 | ``` 39 | 40 | 类似这样的需求,将后端程序中的映射提前到了数据库处理,减少了后端开发的成本。 41 | 42 | 我们再看一个稍微复杂一点的需求: 43 | 我们需要将具体的数值对外脱敏,脱敏层级为0-50,50-100,100-200,200+。意味着对应区间内的数值渲染时都将映射为区间显示。 44 | 如果要在后端程序里做,我们需要额外编写数据映射处理方法,就不如直接在Mysql中处理来的简单方便: 45 | ``` 46 | SELECT CASE 47 | WHEN (ord_cnt > 0 AND ord_cnt <= 50) THEN "0-50单" 48 | WHEN (ord_cnt > 50 AND ord_cnt <= 100) THEN "50-100单" 49 | WHEN (ord_cnt > 100 AND ord_cnt <= 200) THEN "100,200单" 50 | WHEN (ord_cnt > 200) THEN "200单以上" 51 | FROM origin_table; 52 | ``` 53 | -------------------------------------------------------------------------------- /source/_posts/mysql-in-find_in_set.md: -------------------------------------------------------------------------------- 1 | title: mysql中in与find_in_set的使用 2 | show: true 3 | date: 2018-06-03 23:42:10 4 | tags: [mysql,in,find_in_set] 5 | categories: 技术人生 6 | --- 7 | 8 | 15/53,每周一篇博,坚持! 9 | 10 | 0. 写在前面 11 | 12 | 最近在工作中误用了mysql的in查询,导致了一个线上问题,花了我一个下午的时间排查加修复。mysql算是我的一个薄弱项了,主要是没有系统性的训练过。一些没用过的查询方式使用的时候借助搜索引擎,中文技术领域里一些技术分享还是比较坑的,语焉不详的算是一部分,误人子弟的也不乏其人。 13 | 14 | 这篇博文就主要整理一下我所梳理的mysql中in的用法及和find_in_set用法的差异所在。也许网上已经有很多的文章介绍了,但不乏一些介绍不够清晰的,我这里的博文都是经过实践验证的,不敢保证一定做到简洁明了人人能懂,但绝不做误人子弟之事。 15 | 16 | 17 | 18 | 1. in和find_in_set简介 19 | 20 | 这两个命令从字面 意思上来看,貌似都是用来查询某个字段是否在某个值范围内的意思。但实际上两者的使用场景上是有区别的,我那个线上问题就是在应该使用find_in_set的时候误用了in。 21 | - in 22 | 首先in做的是值与值间的精确匹配,它的用法如下: 23 | 24 | `column in (value1,value2,value3...)` 25 | 26 | "..."表示后面可以继续跟参数,也就是说in操作可以有任意的参数,每个参数间用逗号分隔。 27 | 语句将**依次**查询字段的值是否与参数给出的值匹配。如果匹配则表示查询成功。 28 | **这里值得注意的是**: 很多网上的文章说的是in比较的是等不等,也就是说column要和后面values组成的逗号序列值相等。这是不对的,实际上是要拿column的值依次和values组成的逗号序列值做匹配,如果value1和column值相等则算匹配成功,否则都算失败。 29 | - find_in_set 30 | 而find_in_set是从一个以逗号分隔的字符串列表中查找某个指定的字符串,它的用法如下: 31 | 32 | `find_in_set(str,"value1,value2,value3...")` 33 | 34 | 可以看出find_in_set操作只可以接受两个参数,只是第二个参数可以是一个任意长度的以逗号分隔的字符串列表。 35 | 如果在第二个参数这个字符串列表中找到第一个参数时则匹配成功。 36 | 37 | 不知道说清楚没有,再举个例子说明一下。 38 | 39 | 如数据库表存储的是图书信息,图书信息都分门别类按照书目所属的类别存储,一本图书只属于一个类别。此时我们希望查询出计算机和通信工程两个分类的书籍信息,就可以使用in来查询。 40 | 因为这明显是要将书目类别信息与给定的参数值做匹配的需求。 41 | 42 | 然而如果另一个数据库表存储的是某个学生近期借阅的书籍信息,每个学生一条数据,其中借阅书籍字段存储了他近期所借阅的所有书籍的书号。此时我们希望查询出该学生近期是否借阅过某本书,这时就可以使用find_in_set来查询。因为数据库里借阅书籍字段存储的是一串以逗号分隔的书号,这明显是要在一串字符串分隔的数据中查找指定的字符的需求。 43 | 44 | 从这两个小例子中可以看出,我们可以简单地以数据库存储的字段是否是逗号分隔的字符串列表来划分是否要使用find_in_set。 45 | 46 | 2. 示例 47 | 48 | 以我实际遇到的问题为例,我要处理的表数据存储的字段为readedPartnerIds:以逗号形式存储了服务商的id。 49 | 我的需求是:数据库里每一条记录代表了一条发给服务商的消息,如果某个服务商阅读过这条消息后,将该服务商的id追加到已读服务商id字段中,如果该服务商未读,则弹出消息。 50 | 51 | 开始我错误地使用了in操作: 52 | 53 | `select * from table where #partnerId# in (readedPartnerIds);` 54 | 55 | 这导致查询不到结果,该显示的消息弹框未显示出来。(有一条例外,即恰好partnerId值为readedPartnerIds字段的第一个值) 56 | 正确的写法应该使用 find_in_set操作: 57 | 58 | `select * from table where find_in_set(#partnerId#,readedPartnerIds)` 59 | 60 | 这样就能正确的从数据库存储的服务商id列表中查出是否包含了该服务商id。 61 | 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /source/_posts/node-crypto.md: -------------------------------------------------------------------------------- 1 | title: nodejs使用crypto进行加密/解密操作 2 | show: true 3 | date: 2016-06-17 15:00:18 4 | tags: [crypto,加密,解密] 5 | categories: [技术人生] 6 | --- 7 | #### 背景 8 | 前面博文总结了[favlink](http://favlink.me)的用户登录验证系统。说到登录验证那必然少不了用户名、密码的验证过程,而密码的操作也离不开加密,解密,毕竟不能明文存储吧!本篇就简单总结一下favlink开发过程中用到的nodejs加解密库。 9 | 10 | #### crypto简介 11 | [Crypto](http://nodejs.org/api/crypto.html)是包含在nodejs内核中的,主要提供加密、解密、签名、验证等功能。利用了OpenSSL来实现其加密技术。 12 | 13 | #### 使用方式 14 | ``` 15 | var crypto = require('crypto'); 16 | //加密 17 | function encrypt(str,secret){ 18 | var cipher = crypto.createCipher('aes192',secret); 19 | var enc = cipher.update(str,'utf8','hex'); 20 | enc += cipher.final('hex'); 21 | 22 | return enc; 23 | } 24 | 25 | //解密 26 | function decrypt(str,secret){ 27 | var decipher = crypto.createDecipher('aes192',secret); 28 | var dec = decipher.update(str,'hex','utf8'); 29 | dec += decipher.final('utf8'); 30 | return dec; 31 | } 32 | ``` 33 | - 我们先来看加密操作。 34 | `crypto.createCipher(algo,pwd)`,该函数接收两个参数,一个加密算法,一个密钥字串,返回一个'Cipher'对象。 35 | 加密算法有很多种,我这里使用的是'aes192',可以运行下面的代码查看所有支持的算法: 36 | ``` 37 | var crypto = require('crypto'); 38 | console.log(crypto.getCiphers()); 39 | ``` 40 | `cipher.update(data[,input_encoding][,output_encoding])`,该函数可接收三个参数,编码可选(输入只能是`'utf8','ascii','binary'`之一,输出只能是`'binary','base64','hex'`),返回指定编码后的加密数据,如果编码缺省,则返回`buffer`类型。 41 | `cipher.update()`可以运行多次,但只能在`cipher.final()`之前运行。 42 | `cipher.final(output_encoding)`,返回指定编码的加密字串。 43 | 44 | - 解密操作 45 | 解密操作类似,首先先定义解密用`decipher`对象,保持和加密所用的密钥、加密算法一致; 46 | 然后使用decipher将加密字串解密即可。 47 | 48 | #### 示例 49 | 1. 加密 50 | ``` 51 | encrypt("helloworld","weird sheep"); 52 | //Output: faf46f87e8befb82bc643805cfd753a6 53 | ``` 54 | 55 | 2. 解密 56 | ``` 57 | decrypt("faf46f87e8befb82bc643805cfd753a6","weird sheep"); 58 | //Output: helloworld 59 | ``` 60 | -------------------------------------------------------------------------------- /source/_posts/sendEmail.md: -------------------------------------------------------------------------------- 1 | title: 使用sendEmail在命令行下自动发送邮件 2 | show: true 3 | date: 2016-08-16 18:11:20 4 | tags: [sendEmail,发送邮件,中文乱码] 5 | categories: 技术人生 6 | --- 7 | 8 | > 偷懒是优秀程序员的美好品德。 9 | 10 | # 背景 11 | 12 | 作为一个码农,我们的原则是尽量把能自动化完成的任务交给机器。工作上一些流程性的邮件完全可以通过自动化实现。前端获取邮件信息,后端将信息组装发送出去。本篇博文将如何使用sendEmail发送邮件做一记录。 13 | 14 | # 安装 15 | 16 | 点击[此处](http://caspian.dotconf.net/menu/Software/SendEmail/),从官网下载sendEmail二进制文件。 17 | 18 | # 使用 19 | 20 | 官网的说明已经很完善,或者直接运行`sendEmail`命令,会打出详尽的命令参数。 21 | 22 | 主要的参数有: 23 | 24 | ``` 25 | -t 收件人 26 | -f 发件人 27 | -u 邮件主题 28 | -m 邮件内容 (也可以通过读取文件方式) 29 | -s 发送邮件服务器 30 | -a 发送附件 31 | -cc 抄送人 32 | -xu 发件人验证 33 | -xp 发件人密码 34 | ``` 35 | 36 | 37 | 38 | # 脚本封装 39 | 40 | ```sh 41 | #!/bin/bash 42 | 43 | function USAGE(){ 44 | echo "sh $0 <-t toEmail> <-u subject> <-m message> <-C ccEmail> <-a appendFile>" 45 | } 46 | 47 | if [ $# -lt 1 ];then 48 | USAGE 49 | exit 1 50 | fi 51 | 52 | while getopts t:u:m:C:a:h OPTION 53 | do 54 | case $OPTION in 55 | t) to="${OPTARG}" 56 | ;; 57 | u) subject="${OPTARG}" 58 | ;; 59 | m) message="${OPTARG}" 60 | ;; 61 | C) cc="${OPTARG}" 62 | ;; 63 | a) append="${OPTARG}" 64 | ;; 65 | h) USAGE 66 | ;; 67 | esac 68 | done 69 | 70 | params=" -t ${to} -u ${subject} -f ${from} -s xxxx(绿色围墙) -xu xxxx(绿色围墙) -xp xxxx(绿色围墙)" 71 | 72 | if [ "${cc}" != "" ];then 73 | params="${params} -cc ${cc}" 74 | fi 75 | 76 | if [ "${append}" != "" ];then 77 | params="${params} -a ${append}" 78 | fi 79 | 80 | echo ${params} 81 | 82 | cat txt | sendEmail ${params} 83 | ``` 84 | 85 | -------------------------------------------------------------------------------- /source/_posts/shell-run-mysql.md: -------------------------------------------------------------------------------- 1 | title: Linux Shell中运行mysql命令 2 | show: true 3 | date: 2017-03-14 18:08:27 4 | tags: [shell,mysql] 5 | categories: 技术人生 6 | --- 7 | 8 | ## 背景 9 | 我们经常需要批量地执行很多mysql命令,这时候如果直接在mysql终端下执行,效率很低。如果借助Shell来进行自动化地操作,则会大大方便我们操作。这里就记录一下我用来进行数据库表重建的方法。 10 | 11 | ## 准备mysql脚本 12 | 首先我们要准备相应的mysql命令脚本,以便shell调用。 13 | 如: 14 | ``` 15 | DROP TABLE IF EXISTS `attachment`; 16 | CREATE TABLE `attachment` ( 17 | `id` bigint(20) NOT NULL AUTO_INCREMENT, 18 | `init_name` varchar(100) NOT NULL, 19 | `file_path` varchar(100) NOT NULL, 20 | `gmt_create` datetime NOT NULL DEFAULT now(), 21 | `gmt_modified` timestamp NOT NULL DEFAULT now(), 22 | `creator` varchar(100) NOT NULL DEFAULT 'system', 23 | `modifier` varchar(100) NOT NULL DEFAULT 'system', 24 | `is_deleted` char(1) NOT NULL DEFAULT 'N', 25 | PRIMARY KEY (`id`) 26 | ) ENGINE=InnoDB AUTO_INCREMENT=460 DEFAULT CHARSET=utf8; 27 | ``` 28 | 正常写mysql命令即可。 29 | 30 | 31 | 32 | ## 编写Shell脚本 33 | 接着我们编写Shell脚本调用sql,我们要知道可以在Shell中使用 34 | ``` 35 | mysql < 16/53,每周一篇博,坚持! 9 | 10 | (翻译自[Github blog](https://blog.github.com/2018-06-04-github-microsoft/)) 11 | ![](http://wx2.sinaimg.cn/mw690/62d95157gy1fs0pfox35cj21ut0z5q58.jpg) 12 | 13 | 我很高兴地宣布,微软正在谋求收购Github并且有望在今年年底完成收购协议。虽然最终达成收购还需要几个月的时间,但我们想尽快分享这个消息给大家。 14 | 15 | 当十年前刚建立Github的时候,我从未想到过这个“标题”。Git是一个强大且优秀的工具(原文niche疑为nice笔误),“云”只是天上的东西,而微软则是一个非常不同的公司。人们谈论到开源和商业的时候,仿佛它们是水火不容的两件事。 16 | 17 | 18 | 19 | 然而我们不同意。作为开发者,我们知道这是一个错误的对立----我们长期以来一直在商业环境中成功地使用开源软件。我们真正需要的是一个更简单的同其他人协同工作的方式,无论代码是公开的、私有的还是二者兼有。我们希望使用Git达成这一所愿,我们希望世界上的任何人都能够加入进来,如果代码是开源的,我们不希望花费一分钱。所以我们创建了Github。 20 | 21 | 当然现在情况已经完全不同了。Git已经是最流行的版本控制系统,“云”也变成了非常非常多的电脑的意思,而微软也成为了当今Github上最为活跃的组织。仅仅他们的VS Code项目就获得了上百万开发者的点赞,VS Code完完全全地开放源码并且使用Github的Electron平台进行构建。除此之外,现如今大型企业也都习惯了拥抱开源。世界已经意识到快乐并高产的开发人员有多么重要。并且人们现在也都拥有智能手机了。 22 | 23 | 然而没变的是,我们的聚焦点依然在开发者身上。一开始,我们一直着迷于打造一款人们正在使用的产品。我们希望让开发者们更加多产,更多的人成为开发者。从“Code to Cloud,Code to Edge",Github的使命是帮助每一个开发者----无论他们的经验水平如何----有效地学习,编写并提供软件。 24 | 25 | 因此当我们期待未来十年的软件开发的时候,我们知道那些都会是关于开发者的。正如我们在过去几年中,通过从Git LFS到Electron项目合作中了解到的微软团队,我们了解到他们也是这么看的。他们在开源领域的工作激励了我们,Minecraft(我的世界)和LinkedIn(领英)收购后的成功也向我们表明他们对拓展新业务的是非常认真的,同时Azure的发展也证明他们是一个创新的开发平台。 26 | 27 | 但不止如此,他们关于未来的认知和我们的观点高度契合。我们都认为Github仍会是一个对所有开发者保持开放的平台。无论您的语种、技术栈、平台、云或者许可证如何,Github将会继续是你的家----那个软件创建、协作、发现的最佳场所。 28 | 29 | 我们都认为软件开发需要更简单、更加无障碍、更加智能、更加开放,以使更多的人可以成为开发者,已经是开发者的可以花费更多的时间在他们正试图解决的独特的问题上。 30 | 31 | 我们都看到了开发人员日益增长的需求以及软件在我们生活的各个方面日益增长的重要性。 32 | 33 | 更为重要的是,我们都认为我们一起可以比双方独自时做到更好。毕竟,合作正是我们所做事情的核心。 34 | 35 | 作为变化的一部分,Nat Friedman将成为Github的CEO。我们一直在寻找一位新的CEO,现在在微软和Nat中找到了我们认为将在未来几年加强和发展Github社区和公司的合作伙伴。Nat 拥有相当丰富的软件经验和开源软件社区的经验,曾共同创建了Xamarin,并且在大量的开源软件项目工作过数年。他将是一个帮助Github成长且继续让开发者的生活变得更美好的完美人选。 36 | 37 | 至于我,我将在与微软和Nat的团队紧密合作中担任一个新的角色,未来会跟大家分享更多的细节。 38 | 39 | 我对Github和我们的社区在过去十年中所取得的成就感到非常自豪,我迫不及待地想看到未来会发生什么。软件开发的未来是光明的,我很高兴能够与微软一起联手实现这一目标。 40 | 41 | [@defunkt](https://github.com/defunkt) 42 | CEO & Co-Founder, GitHub 43 | 44 | 45 | -------------------------------------------------------------------------------- /source/_posts/written-crawler.md: -------------------------------------------------------------------------------- 1 | title: 自己动手写爬虫(1) 2 | show: false 3 | date: 2017-03-21 14:54:15 4 | tags: [爬虫,node,tumblr,自己动手写爬虫] 5 | categories: 技术人生 6 | --- 7 | -------------------------------------------------------------------------------- /source/_posts/xz-decompress.md: -------------------------------------------------------------------------------- 1 | title: xz格式文件的解压 2 | show: true 3 | date: 2016-08-04 16:34:42 4 | tags: [xz,解压] 5 | categories: 技术人生 6 | --- 7 | 8 | 安装node的时候经常会下载到xz格式的压缩包,它是tar包外层在用xz压缩一遍,压缩比更高。 9 | 10 | 用的不是很多,但正因为此每次用到都要查一下,记录一下: 11 | 12 | ``` 13 | #解压: 14 | xz -d file.xz 15 | tar -xvf file.tar 16 | 17 | #如果没有xz命令,安装一下 18 | sudo yum install xz 19 | ``` 20 | -------------------------------------------------------------------------------- /source/_posts/zhihu-node.md: -------------------------------------------------------------------------------- 1 | title: 知乎摘选--关于nodejs 2 | date: 2015-07-03 13:29:30 3 | tags: [知乎,nodejs] 4 | categories: 文摘采撷 5 | show: true 6 | --- 7 | - [如何系统学习nodejs](http://www.zhihu.com/question/22035738) 8 | - [nodejs有没有最佳实践](http://www.zhihu.com/question/22131414) 9 | - [有没优雅的写法,让nodejs的回调+循环不那么操蛋?](http://www.zhihu.com/question/24847805) 10 | - [如何进行nodejs异步编程?](http://www.zhihu.com/question/28005913) 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /source/_posts/zhihu-writing.md: -------------------------------------------------------------------------------- 1 | title: 知乎摘选--关于写作 2 | date: 2015-07-02 20:02:42 3 | tags: [知乎,写作] 4 | categories: 文摘采撷 5 | show: true 6 | --- 7 | 如何提高写作水平?摘记一些知乎上关于写作话题的问答,希望有时间的时候可以看一看。 8 | 我深知"Mark"最无用,收归一处会看的几率会更大吧。 9 | 10 | - [如何提高写作水平](http://www.zhihu.com/question/20669324) 11 | - [写作过程中如何控制节奏](http://www.zhihu.com/question/22576459) 12 | - [知乎上关于小说写作的精彩问答有哪些](http://www.zhihu.com/question/20377474) 13 | - [怎么写小说](http://www.zhihu.com/question/19997669) 14 | - [如何写好一个故事](http://www.zhihu.com/question/20182906) 15 | - [如何学习小说写作](http://www.zhihu.com/question/20329849) 16 | - [如何提高个人的写作能力](http://www.zhihu.com/question/19969360) 17 | - [怎样提升一个人的文笔](http://www.zhihu.com/question/19591218) 18 | -------------------------------------------------------------------------------- /source/about/index.md: -------------------------------------------------------------------------------- 1 | title: 关于 2 | date: 2015-09-23 14:27:34 3 | --- 4 | # 个人信息 5 | ![](/images/default_avatar.jpg) 6 | 张基宏 男 86年处女座一枚 骄傲的大蓝鲸人 7 | 一个伪文青 一个Low Geek 8 | **个人邮箱**:njhxzhangjihong@126.com 9 | **毕业时间**:2012.4 10 | **学  历**:南邮计算机硕士 11 | **Github**: https://github.com/zhangjh 12 | **个人网址收藏站**:https://favlink.cn 13 | 14 | 出于兴趣和不浪费VPS的初衷,建了独立博客网站 15 | 人到中年,工作压力繁重,目前已没有动力更新。。 16 | 17 | 18 | 个人独立开发的微信小程序,欢迎使用~ 19 |
20 |
AI文图:一个ChatGpt小程序,包括问答、绘画以及一些AI应用
21 | 22 |
汉字助学:一个低年级汉字辅助学习小程序,包括拼音、汉字的认读识记,自定义生字本、错题本等功能
23 | 24 |
25 | 26 | -------------------------------------------------------------------------------- /source/capture_demo.html: -------------------------------------------------------------------------------- 1 | layout: false 2 | -------- 3 | 4 | 5 | 6 | 7 | 8 | HTML5控制摄像头 9 | 10 | 11 | 13 | 14 | 15 | no canvas availabel 16 | 17 | 18 | 46 | 47 | -------------------------------------------------------------------------------- /source/categories/index.md: -------------------------------------------------------------------------------- 1 | title: 分类 2 | type: "categories" 3 | comments: false 4 | date: 2015-06-30 12:07:50 5 | --- 6 | -------------------------------------------------------------------------------- /source/donate.html: -------------------------------------------------------------------------------- 1 | date: 2015-12-09 10:13:38 2 | show: false 3 | --- 4 | 5 | 6 | 7 | 16 | 17 | 18 |

【聚合翻译扩展】支持我一下

19 |
20 | 源于谷歌翻译正式退出中国,后续日常使用中对于翻译的需求,除了网站不能使用,chrome的谷歌翻译扩展也不能正常使用了。。 21 | 这个项目主要为了实现chrome的划线翻译、主动翻译功能,同时聚合了国内主流翻译引擎:百度、有道,以及Bing的翻译功能,所以取名聚合翻译。 22 |
23 |
24 | 国内访问百度、有道还是没问题的,可以自己注册一个账号提供给扩展。 25 | 但为了方便不能翻墙以及没有太强工程背景的同学,bing和谷歌我使用了我自己的账号提供给扩展使用。 26 | 这部分接口费用以及VPS费用由我个人承担。 27 |
28 |
29 | 如果您认可该扩展,并觉得给您的日常使用带来了便利,为了该扩展的可持续发展,希望您能赞助我一下! 30 | 31 |
32 | 33 | -------------------------------------------------------------------------------- /source/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhangjh/hello-blog/a0fffc86c231ed109203492e8cfdd5098db58e66/source/favicon.ico -------------------------------------------------------------------------------- /source/issue/index.md: -------------------------------------------------------------------------------- 1 | title: 网站大事记 2 | show: true 3 | date: 2017-07-25 16:45:33 4 | --- 5 | # 网站大事记 6 | - 2015.06.25  网站建立 7 | - 2015.06.26  [第一篇博客](/2015/06/26/beginning/) 8 | - 2015.08.07  增加站内搜索功能 9 | - 2015.12.02  增加公益404 10 | - 2015.12.15  百度首次收录 11 | - 2016.01.08  域名** 5941740.cn ** [备案通过](2016/01/08/beian/) 12 | - 2016.04.12  增加访问统计 13 | - 2016.05.25  增加电子书搜索功能 14 | - 2016.07.31  谷歌首次收录 15 | - 2016.06.17  增加打赏功能 16 | - 2017.03.22  评论系统由多说切换至畅言 17 | - 2017.07.21  正式启用新域名** zhangjh.me **,旧域名访问正常 18 | - 2017.11.28  站内搜索从swifttype切换至百度 19 | - 2018.02.22  文章阅读统计次数从firebase切换至自有数据库,解决firebase国内被墙问题,除网站总pv外文章次数清零 20 | - 2018.03.09  增加RSS订阅 21 | - 2018.04.03  博客[自研评论系统](https://github.com/zhangjh/comment)上线,替代畅言 22 | - 2018.05.06  jiathis分享下线,更换为百度分享 23 | - 2018.10.21  完成HTTPS改造 24 | - 2022.09.25 已经长期不更新博客,为了降低服务器成本,将博客从VPS迁移到居家服务器,并配置了内网穿透,同时丢失了绝大部分评论数据,性能稍许下降 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /source/jd_root.txt: -------------------------------------------------------------------------------- 1 | e95d2f4a675fe6f2148b4fc58818a5519fdf8e6afabf0eec -------------------------------------------------------------------------------- /source/privacy.html: -------------------------------------------------------------------------------- 1 | layout: false 2 | -------- 3 | 4 | 5 | 6 | 16 | 17 | 18 |

慧搜App隐私政策

19 |
20 | 慧搜App使用过程中仅依赖必须的相册权限,App以及开发者不会收集任何用户数据。 21 |
22 | 23 | 24 | -------------------------------------------------------------------------------- /source/tags/index.md: -------------------------------------------------------------------------------- 1 | title: All tags 2 | type: "tags" 3 | comments: false 4 | date: 2015-06-30 12:08:49 5 | --- 6 | -------------------------------------------------------------------------------- /source/weixin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhangjh/hello-blog/a0fffc86c231ed109203492e8cfdd5098db58e66/source/weixin.png -------------------------------------------------------------------------------- /start.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #source ~/.bash_profile 3 | 4 | function install(){ 5 | npm i -d 6 | } 7 | 8 | function build(){ 9 | npm run clean 10 | npm run generate 11 | #sed -i 's/\&/\%26/g' public/sitemap.xml 12 | ##gulp 压缩 13 | npm run gulp 14 | if [ $? -ne 0 ];then 15 | echo "gulp压缩失败" 16 | exit 1 17 | fi 18 | } 19 | 20 | #function sync(){ 21 | # dst=$1 22 | ##gulp压缩的替换 23 | # cp -r dst/* public/ 24 | # rsync -arzv --delete public/* ${dst} 25 | #} 26 | 27 | #function upload(){ 28 | # dst=$1 29 | # msg=$2 30 | # if [ "${msg}" == "" ];then 31 | # msg="add new page" 32 | # fi 33 | # cd ${dst} 34 | # git add -A 35 | # git commit -a -m "${msg}" 36 | # git push 37 | # if [ $? -ne 0 ];then 38 | # echo "git push failed" 39 | # exit 1 40 | # fi 41 | # cd - 42 | #} 43 | 44 | function run(){ 45 | # 容器启动不再需要手杀进程 46 | #killall hexo 47 | #pid=`lsof -i:4000 | grep hexo | awk '{print $2}'` 48 | #if [[ "X${pid}" != "X" ]];then 49 | # kill -9 ${pid} 50 | #fi 51 | nohup npm run start & 52 | } 53 | 54 | #. ~/.bash_profile 55 | install 56 | build 57 | #sync myblog 58 | #upload myblog $1 59 | 60 | ## 提交项目自身 61 | git status | grep -q "working directory clean" 62 | if [ $? -ne 0 ];then 63 | git add -A 64 | msg="add new pages" 65 | if [ "X$1" != "X" ];then 66 | msg=$1 67 | fi 68 | git commit -a -m "${msg}" 69 | #git push 70 | fi 71 | 72 | #run 73 | exit 0 74 | -------------------------------------------------------------------------------- /themes/nextNew/.bowerrc: -------------------------------------------------------------------------------- 1 | { 2 | "directory": "source/vendors" 3 | } -------------------------------------------------------------------------------- /themes/nextNew/.editorconfig: -------------------------------------------------------------------------------- 1 | # editorconfig.org 2 | 3 | root = true 4 | 5 | [*] 6 | charset = utf-8 7 | end_of_line = lf 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | indent_style = space 11 | indent_size = 2 12 | 13 | [*.py] 14 | indent_size = 4 15 | -------------------------------------------------------------------------------- /themes/nextNew/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .idea/ 3 | *.log 4 | node_modules/ 5 | 6 | # Ignore unused verdors' files 7 | source/vendors/fancybox/* 8 | !source/vendors/fancybox/source/ 9 | source/vendors/font-awesome/less/ 10 | source/vendors/font-awesome/scss/ 11 | -------------------------------------------------------------------------------- /themes/nextNew/.hound.yml: -------------------------------------------------------------------------------- 1 | javascript: 2 | enabled: false 3 | config_file: .jshintrc 4 | ignore_file: .javascript_ignore 5 | -------------------------------------------------------------------------------- /themes/nextNew/.javascript_ignore: -------------------------------------------------------------------------------- 1 | source/vendors/* 2 | -------------------------------------------------------------------------------- /themes/nextNew/.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "curly": true, 3 | "eqnull": true, 4 | "eqeqeq": true, 5 | "undef": true, 6 | "newcap": true, 7 | "undef": true, 8 | "unused": true, 9 | "laxcomma": false, 10 | "asi": false, 11 | "expr": true, 12 | "loopfunc": false, 13 | "strict": false, 14 | 15 | "globals": { 16 | "$": true, 17 | "window": true, 18 | "document": true 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /themes/nextNew/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 | [![views](https://sourcegraph.com/api/repos/github.com/iissnan/hexo-theme-next/.counters/views.svg)](https://sourcegraph.com/github.com/iissnan/hexo-theme-next) 32 | [![hexo-image]][hexo-url] 33 | [![bower-image]][bower-url] 34 | [![jquery-image]][jquery-url] 35 | [![velocity-image]][velocity-url] 36 | 37 | [hexo-image]: http://img.shields.io/badge/Hexo-2.4+-2BAF2B.svg?style=flat-square 38 | [hexo-url]: http://hexo.io 39 | [bower-image]: http://img.shields.io/badge/Bower-*-2BAF2B.svg?style=flat-square 40 | [bower-url]: http://bower.io 41 | [jquery-image]: https://img.shields.io/badge/jquery-2.1-2BAF2B.svg?style=flat-square 42 | [jquery-url]: http://jquery.com/ 43 | [velocity-image]: https://img.shields.io/badge/Velocity-1.2-2BAF2B.svg?style=flat-square 44 | [velocity-url]: http://julian.com/research/velocity/ 45 | -------------------------------------------------------------------------------- /themes/nextNew/bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "isn-next", 3 | "version": "0.3.0", 4 | "homepage": "https://github.com/iissnan/hexo-theme-next", 5 | "authors": [ 6 | "iissnan " 7 | ], 8 | "description": "High quality and elegant theme for Hexo", 9 | "repository": "https://github.com/iissnan/hexo-theme-next", 10 | "keywords": [ 11 | "hexo", 12 | "notes", 13 | "theme", 14 | "iissnan", 15 | "NexT" 16 | ], 17 | "license": "MIT", 18 | "ignore": [ 19 | "**/.*", 20 | "node_modules", 21 | "bower_components", 22 | "source/vendors", 23 | "test", 24 | "tests", 25 | "screenshots" 26 | ], 27 | "dependencies": { 28 | "fancybox": "~2.1.5", 29 | "velocity": "~1.2.1", 30 | "jquery": "http://code.jquery.com/jquery-2.1.3.min.js", 31 | "fastclick": "~1.0.6", 32 | "font-awesome": "fontawesome#~4.4.0", 33 | "jquery_lazyload": "jquery.lazyload#~1.9.7" 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /themes/nextNew/languages/de.yml: -------------------------------------------------------------------------------- 1 | title: 2 | archive: Archiv 3 | category: Kategorie 4 | tag: Tag 5 | 6 | menu: 7 | home: Startseite 8 | archives: Archiv 9 | categories: Kategorien 10 | tags: Tags 11 | about: Über 12 | feed: RSS 13 | search: Suche 14 | 15 | sidebar: 16 | overview: Übersicht 17 | toc: Inhaltsverzeichnis 18 | 19 | post: 20 | posted: Veröffentlicht am 21 | in: in 22 | read_more: Weiterlesen 23 | untitled: Unbenannt 24 | toc_empty: Dieser Artikel hat kein Inhaltsverzeichnis 25 | 26 | page: 27 | totally: Gesamt 28 | tags: tags 29 | 30 | footer: 31 | powered: "Erstellt mit %s" 32 | theme: Theme 33 | 34 | counter: 35 | tag_cloud: 36 | zero: Keine Tags 37 | one: Insgesamt ein Tag 38 | other: "Insgesamt %d Tags" 39 | 40 | categories: 41 | zero: Keine Kategorien 42 | one: Insgesamt eine Kategorie 43 | other: "Insgesamt %d Kategorien" 44 | 45 | archive_posts: 46 | zero: Keine Artikel vorhanden. 47 | one: Ein Artikel. 48 | other: "Insgesamt %d Artikel." 49 | 50 | state: 51 | posts: Artikel 52 | pages: Seiten 53 | tags: Tags 54 | categories: Kategorien 55 | 56 | cheers: 57 | um: Öhm.. 58 | ok: OK 59 | nice: Schön 60 | good: Gut 61 | great: Wunderbar 62 | excellent: Exzellent 63 | 64 | keep_on: Bleib dran. 65 | 66 | symbol: 67 | comma: '. ' 68 | period: ', ' 69 | -------------------------------------------------------------------------------- /themes/nextNew/languages/default.yml: -------------------------------------------------------------------------------- 1 | title: 2 | archive: Archive 3 | category: Category 4 | tag: Tag 5 | 6 | menu: 7 | home: Home 8 | archives: Archives 9 | categories: Categories 10 | tags: Tags 11 | about: About 12 | search: Search 13 | 14 | sidebar: 15 | overview: Overview 16 | toc: Table Of Contents 17 | 18 | post: 19 | sticky: Sticky 20 | posted: Posted on 21 | in: In 22 | read_more: Read more 23 | untitled: Untitled 24 | toc_empty: This post does not have a Table Of Contents 25 | 26 | page: 27 | totally: Totally 28 | tags: tags 29 | 30 | footer: 31 | powered: "Powered by %s" 32 | theme: Theme 33 | 34 | counter: 35 | tag_cloud: 36 | zero: No tags 37 | one: 1 tag in total 38 | other: "%d tags in total" 39 | 40 | categories: 41 | zero: No categories 42 | one: 1 category in total 43 | other: "%d categories in total" 44 | 45 | archive_posts: 46 | zero: No posts. 47 | one: 1 post. 48 | other: "%d posts in total." 49 | 50 | state: 51 | posts: posts 52 | pages: pages 53 | tags: tags 54 | categories: categories 55 | 56 | cheers: 57 | um: Um.. 58 | ok: OK 59 | nice: Nice 60 | good: Good 61 | great: Great 62 | excellent: Excellent 63 | 64 | keep_on: Keep on posting. 65 | 66 | symbol: 67 | comma: ', ' 68 | period: '. ' 69 | -------------------------------------------------------------------------------- /themes/nextNew/languages/en.yml: -------------------------------------------------------------------------------- 1 | title: 2 | archive: Archive 3 | category: Category 4 | tag: Tag 5 | 6 | menu: 7 | home: Home 8 | archives: Archives 9 | categories: Categories 10 | tags: Tags 11 | about: About 12 | search: Search 13 | 14 | sidebar: 15 | overview: Overview 16 | toc: Table Of Contents 17 | 18 | post: 19 | sticky: Sticky 20 | posted: Posted on 21 | in: In 22 | read_more: Read more 23 | untitled: Untitled 24 | toc_empty: This post does not have a Table Of Contents 25 | 26 | page: 27 | totally: Totally 28 | tags: tags 29 | 30 | footer: 31 | powered: "Powered by %s" 32 | theme: Theme 33 | 34 | counter: 35 | tag_cloud: 36 | zero: No tags 37 | one: 1 tag in total 38 | other: "%d tags in total" 39 | 40 | categories: 41 | zero: No categories 42 | one: 1 category in total 43 | other: "%d categories in total" 44 | 45 | archive_posts: 46 | zero: No posts. 47 | one: 1 post. 48 | other: "%d posts in total." 49 | 50 | state: 51 | posts: posts 52 | pages: pages 53 | tags: tags 54 | categories: categories 55 | 56 | cheers: 57 | um: Um.. 58 | ok: OK 59 | nice: Nice 60 | good: Good 61 | great: Great 62 | excellent: Excellent 63 | 64 | keep_on: Keep on posting. 65 | 66 | symbol: 67 | comma: ', ' 68 | period: '. ' 69 | -------------------------------------------------------------------------------- /themes/nextNew/languages/fr-FR.yml: -------------------------------------------------------------------------------- 1 | title: 2 | archive: Archive 3 | category: Catégorie 4 | tag: Tag 5 | 6 | menu: 7 | home: Accueil 8 | archives: Archives 9 | categories: Categories 10 | tags: Tags 11 | about: A propos 12 | search: recherche 13 | 14 | sidebar: 15 | overview: Ensemble 16 | toc: Table Des Matières 17 | 18 | post: 19 | sticky: Sticky 20 | posted: Posté le 21 | in: In 22 | read_more: Lire la suite 23 | untitled: Non titré 24 | toc_empty: This post does not have a Table Of Contents 25 | 26 | page: 27 | totally: Total 28 | tags: tags 29 | 30 | footer: 31 | powered: "Powered by %s" 32 | theme: Thème 33 | 34 | counter: 35 | tag_cloud: 36 | zero: Aucun tags 37 | one: 1 tag au total 38 | other: "%d tags au total" 39 | 40 | categories: 41 | zero: Aucun categories 42 | one: 1 category au total 43 | other: "%d categories au total" 44 | 45 | archive_posts: 46 | zero: Aucun article. 47 | one: 1 article. 48 | other: "%d articles au total." 49 | 50 | state: 51 | posts: articles 52 | pages: pages 53 | tags: tags 54 | categories: categories 55 | 56 | 57 | cheers: 58 | um: Um.. 59 | ok: OK 60 | nice: Jolie 61 | good: Bien 62 | great: Super 63 | excellent: Excellent 64 | 65 | keep_on: Et ca ne fait que commencer. 66 | 67 | symbol: 68 | comma: ', ' 69 | period: '. ' 70 | -------------------------------------------------------------------------------- /themes/nextNew/languages/pt.yml: -------------------------------------------------------------------------------- 1 | title: 2 | archive: Arquivo 3 | category: Categoria 4 | tag: Tag 5 | 6 | menu: 7 | home: Home 8 | archives: Arquivos 9 | categories: Categorias 10 | tags: Tags 11 | about: Sobre 12 | search: Pesquisa 13 | 14 | sidebar: 15 | overview: Visão Geral 16 | toc: Tabela de Conteúdo 17 | 18 | post: 19 | sticky: Sticky 20 | posted: Postado em 21 | in: Em 22 | read_more: Ler mais 23 | untitled: Sem título 24 | toc_empty: Esta publicação não possui uma tabela de conteúdo 25 | 26 | page: 27 | totally: Totalmente 28 | tags: tags 29 | 30 | footer: 31 | powered: "Desenvolvido com amor com %s" 32 | theme: Tema 33 | 34 | counter: 35 | tag_cloud: 36 | zero: Sem tags 37 | one: 1 tag no total 38 | other: "%d tags no total" 39 | 40 | categories: 41 | zero: Sem categorias 42 | one: 1 categoria no total 43 | other: "%d categorias no total" 44 | 45 | archive_posts: 46 | zero: Sem publicações. 47 | one: 1 post. 48 | other: "%d publicações no total." 49 | 50 | state: 51 | posts: publicações 52 | pages: páginas 53 | tags: tags 54 | categories: categorias 55 | 56 | cheers: 57 | um: Um.. 58 | ok: OK 59 | nice: Legal 60 | good: Bom 61 | great: Grandioso 62 | excellent: Excelente 63 | 64 | keep_on: Mantenha-se publicando! 65 | 66 | symbol: 67 | comma: ', ' 68 | period: '. ' 69 | -------------------------------------------------------------------------------- /themes/nextNew/languages/ru.yml: -------------------------------------------------------------------------------- 1 | title: 2 | archive: Архив 3 | category: Категория 4 | tag: Тэг 5 | 6 | menu: 7 | home: Домой 8 | archives: Архив 9 | categories: Категории 10 | tags: Тэги 11 | about: О сайте 12 | search: поиск 13 | 14 | sidebar: 15 | overview: Обзор 16 | toc: Содержание 17 | 18 | post: 19 | sticky: Sticky 20 | posted: отправлено 21 | in: в 22 | read_more: Читать дальше 23 | untitled: Без имени 24 | toc_empty: Этот пост не имеет оглавления 25 | 26 | page: 27 | totally: Всего 28 | tags: тэги 29 | 30 | footer: 31 | powered: "Powered by %s" 32 | theme: Theme 33 | 34 | counter: 35 | tag_cloud: 36 | zero: Нет тэгов 37 | one: 1 тэг 38 | two: "%d тэга всего" 39 | three: "%d тэга всего" 40 | four: "%d тэга всего" 41 | other: "%d тэгов всего" 42 | 43 | categories: 44 | zero: Нет категорий 45 | one: 1 категория 46 | two: "%d категории всего" 47 | three: "%d категории всего" 48 | four: "%d категории всего" 49 | other: "%d категорий всего" 50 | 51 | archive_posts: 52 | zero: Нет записей. 53 | one: 1 запись. 54 | two: "%d записи всего." 55 | three: "%d записи всего." 56 | four: "%d записи всего." 57 | other: "%d записей всего." 58 | 59 | state: 60 | posts: записи 61 | pages: страницы 62 | tags: тэги 63 | categories: категории 64 | 65 | cheers: 66 | um: Эм.. 67 | ok: OK 68 | nice: Неплохо 69 | good: Хорошо 70 | great: Замечательно 71 | excellent: Великолепно 72 | 73 | keep_on: Продолжаю писать. 74 | 75 | symbol: 76 | comma: ', ' 77 | period: '. ' 78 | -------------------------------------------------------------------------------- /themes/nextNew/languages/zh-Hans.yml: -------------------------------------------------------------------------------- 1 | title: 2 | archive: 归档 3 | category: 分类 4 | tag: 标签 5 | 6 | menu: 7 | home: 首页 8 | archives: 归档 9 | categories: 分类 10 | tags: 标签 11 | about: 关于 12 | search: 搜索 13 | commonweal: 公益404 14 | issue: 网站大事记 15 | 16 | 17 | sidebar: 18 | overview: 站点概览 19 | toc: 文章目录 20 | 21 | post: 22 | sticky: 置顶 23 | posted: 发表于 24 | in: 分类于 25 | read_more: 阅读全文 26 | untitled: 未命名 27 | toc_empty: 此文章未包含目录 28 | 29 | page: 30 | totally: 共有 31 | tags: 标签 32 | 33 | footer: 34 | powered: "由 %s 强力驱动" 35 | theme: 主题 36 | 37 | 38 | counter: 39 | tag_cloud: 40 | zero: 暂无标签 41 | one: 目前共计 1 个标签 42 | other: "目前共计 %d 个标签" 43 | 44 | categories: 45 | zero: 暂无分类 46 | one: 目前共计 1 个分类 47 | other: "目前共计 %d 个分类" 48 | 49 | archive_posts: 50 | zero: 暂无日志。 51 | one: 目前共计 1 篇日志。 52 | other: "目前共计 %d 篇日志。" 53 | 54 | state: 55 | posts: 日志 56 | pages: 页面 57 | tags: 标签 58 | categories: 分类 59 | 60 | cheers: 61 | um: 嗯.. 62 | ok: OK 63 | nice: 好 64 | good: 很好 65 | great: 非常好 66 | excellent: 太棒了 67 | 68 | keep_on: 继续努力。 69 | 70 | symbol: 71 | comma: ', ' 72 | period: '。 ' 73 | -------------------------------------------------------------------------------- /themes/nextNew/languages/zh-hk.yml: -------------------------------------------------------------------------------- 1 | title: 2 | archive: 歸檔 3 | category: 分類 4 | tag: 標籤 5 | 6 | menu: 7 | home: 首頁 8 | archives: 歸檔 9 | categories: 分類 10 | tags: 標籤 11 | about: 關於 12 | search: 檢索 13 | 14 | 15 | sidebar: 16 | overview: 本站概覽 17 | toc: 文章目錄 18 | 19 | post: 20 | sticky: 置頂 21 | posted: 發表於 22 | in: 分類於 23 | read_more: 閱讀全文 24 | untitled: 未命名 25 | toc_empty: 此文章未包含目錄 26 | 27 | page: 28 | totally: 共有 29 | tags: 標籤 30 | 31 | footer: 32 | powered: "由 %s 強力驅動" 33 | theme: 主題 34 | 35 | 36 | counter: 37 | tag_cloud: 38 | zero: 暫無標籤 39 | one: 目前共有 1 個標籤 40 | other: "目前共有 %d 個標籤" 41 | 42 | categories: 43 | zero: 暫無分類 44 | one: 目前共有 1 個分類 45 | other: "目前共有 %d 個分類" 46 | 47 | archive_posts: 48 | zero: 暫無文章。 49 | one: 目前共有 1 篇文章。 50 | other: "目前共有 %d 篇文章。" 51 | 52 | state: 53 | posts: 文章 54 | pages: 頁面 55 | tags: 標籤 56 | categories: 分類 57 | 58 | cheers: 59 | um: 嗯.. 60 | ok: OK 61 | nice: 好 62 | good: 很好 63 | great: 非常好 64 | excellent: 激爆好 65 | 66 | keep_on: 繼續努力。 67 | 68 | symbol: 69 | comma: ', ' 70 | period: '。 ' 71 | -------------------------------------------------------------------------------- /themes/nextNew/languages/zh-tw.yml: -------------------------------------------------------------------------------- 1 | title: 2 | archive: 歸檔 3 | category: 分類 4 | tag: 標籤 5 | 6 | menu: 7 | home: 首頁 8 | archives: 歸檔 9 | categories: 分類 10 | tags: 標籤 11 | about: 關於 12 | search: 檢索 13 | 14 | 15 | sidebar: 16 | overview: 本站概覽 17 | toc: 文章目錄 18 | 19 | post: 20 | sticky: 置頂 21 | posted: 發表於 22 | in: 分類於 23 | read_more: 閱讀全文 24 | untitled: 未命名 25 | toc_empty: 此文章未包含目錄 26 | 27 | page: 28 | totally: 共有 29 | tags: 標籤 30 | 31 | footer: 32 | powered: "由 %s 強力驅動" 33 | theme: 主題 34 | 35 | 36 | counter: 37 | tag_cloud: 38 | zero: 暫無標籤 39 | one: 目前共計 1 個標籤 40 | other: "目前共計 %d 個標籤" 41 | 42 | categories: 43 | zero: 暫無分類 44 | one: 目前共計 1 個分類 45 | other: "目前共計 %d 個分類" 46 | 47 | archive_posts: 48 | zero: 暫無文章。 49 | one: 目前共計 1 篇文章。 50 | other: "目前共計 %d 篇文章。" 51 | 52 | state: 53 | posts: 文章 54 | pages: 頁面 55 | tags: 標籤 56 | categories: 分類 57 | 58 | cheers: 59 | um: 嗯.. 60 | ok: OK 61 | nice: 好 62 | good: 很好 63 | great: 非常好 64 | excellent: 非常屌 65 | 66 | keep_on: 繼續努力。 67 | 68 | symbol: 69 | comma: ', ' 70 | period: '。 ' 71 | -------------------------------------------------------------------------------- /themes/nextNew/layout/_macro/post-collapse.swig: -------------------------------------------------------------------------------- 1 | {% macro render(post) %} 2 | 3 | 33 | 34 | {% endmacro %} 35 | -------------------------------------------------------------------------------- /themes/nextNew/layout/_partials/comments.swig: -------------------------------------------------------------------------------- 1 | {% if page.comments %} 2 | 13 | {% endif %} 14 | -------------------------------------------------------------------------------- /themes/nextNew/layout/_partials/duoshuo-hot-articles.swig: -------------------------------------------------------------------------------- 1 | {# 多说热评文章 #} 2 | {% if (theme.duoshuo_hotartical and page.title) %} 3 |

热评文章

4 |
5 | {% endif %} 6 | -------------------------------------------------------------------------------- /themes/nextNew/layout/_partials/footer.swig: -------------------------------------------------------------------------------- 1 | 10 | 11 |
12 | 13 | {% include '../_scripts/analytics/zhanzhang-analytics.swig' %} 14 |
15 | 21 |
22 | 网站大事记 23 |
24 | 25 | 36 | 37 | {% block footer %} 38 | {% if theme.firebase %} 39 | {% include '../_scripts/analytics/visit.swig' %} 40 | {% endif %} 41 | {% endblock %} 42 | -------------------------------------------------------------------------------- /themes/nextNew/layout/_partials/old-browsers.swig: -------------------------------------------------------------------------------- 1 | 10 | -------------------------------------------------------------------------------- /themes/nextNew/layout/_partials/pagination.swig: -------------------------------------------------------------------------------- 1 | {% if page.prev or page.next %} 2 | 11 | {% endif %} 12 | -------------------------------------------------------------------------------- /themes/nextNew/layout/_partials/search.swig: -------------------------------------------------------------------------------- 1 | {% if theme.swiftype_search %} 2 | {% include 'search/swiftype.swig' %} 3 | {% elseif theme.baidu_search %} 4 | {% include 'search/baidu.swig' %} 5 | {% elseif theme.tinysou_Key %} 6 | {% include 'search/tinysou.swig' %} 7 | {% endif %} 8 | -------------------------------------------------------------------------------- /themes/nextNew/layout/_partials/search/baidu.swig: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 |
5 | -------------------------------------------------------------------------------- /themes/nextNew/layout/_partials/search/swiftype.swig: -------------------------------------------------------------------------------- 1 | {% if theme.scheme %} 2 |
3 | 4 |
5 | {% endif %} 6 | 7 | 18 | -------------------------------------------------------------------------------- /themes/nextNew/layout/_partials/search/tinysou.swig: -------------------------------------------------------------------------------- 1 |
2 | 3 |
4 | -------------------------------------------------------------------------------- /themes/nextNew/layout/_partials/share/baidu_share.swig: -------------------------------------------------------------------------------- 1 |
2 | 3 | -------------------------------------------------------------------------------- /themes/nextNew/layout/_partials/share/duoshuo_share.swig: -------------------------------------------------------------------------------- 1 |
5 |
6 | 15 |
16 |
17 |
18 |
-------------------------------------------------------------------------------- /themes/nextNew/layout/_partials/share/jiathis.swig: -------------------------------------------------------------------------------- 1 | 2 |
3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /themes/nextNew/layout/_partials/share/share_js.swig: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /themes/nextNew/layout/_scripts/ads/ads.js: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /themes/nextNew/layout/_scripts/ads/az_recommend_books.swig: -------------------------------------------------------------------------------- 1 | 23 | -------------------------------------------------------------------------------- /themes/nextNew/layout/_scripts/ads/bottom-jd-ads.swig: -------------------------------------------------------------------------------- 1 | 2 | 21 | 22 | 26 | -------------------------------------------------------------------------------- /themes/nextNew/layout/_scripts/ads/googleads.swig: -------------------------------------------------------------------------------- 1 | 2 | 8 | -------------------------------------------------------------------------------- /themes/nextNew/layout/_scripts/analytics.swig: -------------------------------------------------------------------------------- 1 | {% include 'analytics/facebook-sdk.swig' %} 2 | {% include 'analytics/google-analytics.swig' %} 3 | {% include 'analytics/baidu-analytics.swig' %} 4 | -------------------------------------------------------------------------------- /themes/nextNew/layout/_scripts/analytics/baidu-analytics.swig: -------------------------------------------------------------------------------- 1 | {% if theme.baidu_analytics %} 2 | 11 | {% endif %} 12 | -------------------------------------------------------------------------------- /themes/nextNew/layout/_scripts/analytics/facebook-sdk.swig: -------------------------------------------------------------------------------- 1 | {% if theme.facebook_sdk.enable %} 2 | 19 | {% endif %} 20 | -------------------------------------------------------------------------------- /themes/nextNew/layout/_scripts/analytics/google-analytics.swig: -------------------------------------------------------------------------------- 1 | {% if theme.google_analytics %} 2 | 10 | {% endif %} -------------------------------------------------------------------------------- /themes/nextNew/layout/_scripts/analytics/visit.swig: -------------------------------------------------------------------------------- 1 | 36 | -------------------------------------------------------------------------------- /themes/nextNew/layout/_scripts/analytics/zhanzhang-analytics.swig: -------------------------------------------------------------------------------- 1 | {% if config.zhanzhang_analytics %} 2 | 3 | {% endif %} 4 | -------------------------------------------------------------------------------- /themes/nextNew/layout/_scripts/baidushare.swig: -------------------------------------------------------------------------------- 1 | {% if theme.baidushare and page.title %} 2 | 3 | 4 | 5 |
6 | 7 | 8 | 9 | 10 | {% endif %} 11 | -------------------------------------------------------------------------------- /themes/nextNew/layout/_scripts/bootstrap.scrollspy.swig: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /themes/nextNew/layout/_scripts/comments/changyan.swig: -------------------------------------------------------------------------------- 1 | {% if (theme.changyan) and page.comments %} 2 | 3 | {% if theme.changyan_appid %} 4 | {% set changyan_appid = theme.changyan_appid %} 5 | {% endif %} 6 | 7 | 8 |
9 | 10 | 11 | 21 | 22 | {% endif %} 23 | -------------------------------------------------------------------------------- /themes/nextNew/layout/_scripts/comments/disqus.swig: -------------------------------------------------------------------------------- 1 | {% if not (theme.duoshuo and theme.duoshuo.shortname) and not theme.duoshuo_shortname %} 2 | 3 | {% if theme.disqus_shortname %} 4 | 5 | 24 | {% endif %} 25 | 26 | {% endif %} -------------------------------------------------------------------------------- /themes/nextNew/layout/_scripts/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 | {% if theme.duoshuo_info.ua_enable %} 22 | {% if theme.duoshuo_info.admin_enable %} 23 | {% if theme.duoshuo_info.user_id %} 24 | 28 | {% endif %} 29 | 30 | 31 | {% endif %} 32 | {% endif %} 33 | -------------------------------------------------------------------------------- /themes/nextNew/layout/_scripts/fancy-box.swig: -------------------------------------------------------------------------------- 1 | {% if theme.fancybox %} 2 | 3 | 4 | {% endif %} 5 | -------------------------------------------------------------------------------- /themes/nextNew/layout/_scripts/helpers.swig: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /themes/nextNew/layout/_scripts/mathjax.swig: -------------------------------------------------------------------------------- 1 | {% if theme.mathjax %} 2 | 11 | 12 | 20 | 21 | {% if config.language === 'zh-Hans' %} 22 | 23 | 24 | {% else %} 25 | 26 | {% endif %} 27 | {% endif %} 28 | -------------------------------------------------------------------------------- /themes/nextNew/layout/_scripts/motion.swig: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /themes/nextNew/layout/_scripts/pages/post-ads.swig: -------------------------------------------------------------------------------- 1 | 17 | 18 | -------------------------------------------------------------------------------- /themes/nextNew/layout/_scripts/tinysou.swig: -------------------------------------------------------------------------------- 1 | {% if config.tinysou_Key %} 2 | 23 | {% endif %} -------------------------------------------------------------------------------- /themes/nextNew/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 | {% block script_extra_before %} 57 | {% if theme.use_motion %} 58 | 61 | {% endif %} 62 | {% endblock %} 63 | 64 | {% block script_extra %} 65 | {% if theme.use_motion %} 66 | 69 | {% endif %} 70 | {% endblock %} 71 | -------------------------------------------------------------------------------- /themes/nextNew/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 | 30 | 31 | {% block script_extra_before %} 32 | {% if theme.use_motion %} 33 | 36 | {% endif %} 37 | {% endblock %} 38 | -------------------------------------------------------------------------------- /themes/nextNew/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 | 14 | {% set posts_normal = page.posts %} 15 | 16 | {# Compatible with Hexo 2.* #} 17 | {% if page.posts.first().sticky >= 0 %} 18 | {# Extract sticky posts. #} 19 | {% if page.current === 1 %} 20 | {% set posts_sticky = site.posts.find({sticky: { '$gt': 0 }}) %} 21 | {% set posts_sticky = posts_sticky.sort('-sticky') %} 22 | {% for post in posts_sticky %} 23 | {{ post_template.render(post, true) }} 24 | {% endfor %} 25 | {% endif %} 26 | 27 | {% set posts_normal = page.posts.find({sticky: 0}) %} 28 | {% endif %} 29 | 30 | {% for post in posts_normal %} 31 | {% if post.show %} 32 | {{ post_template.render(post, true) }} 33 | {% endif %} 34 | {% endfor %} 35 | 36 |
37 | 38 | {% include '_partials/pagination.swig' %} 39 | {% endblock %} 40 | 41 | {% block sidebar %} 42 | {{ sidebar_template.render(false) }} 43 | {% endblock %} 44 | -------------------------------------------------------------------------------- /themes/nextNew/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" %} 8 | {{ __('title.category') + page_title_suffix }} 9 | {% elif page.type === "tags" %} 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 | {# tagcloud page support #} 20 | {% if page.type === "tags" %} 21 |
22 |
23 | {{ _p('counter.tag_cloud', site.tags.length) }} 24 |
25 |
26 | {{ tagcloud({min_font: 12, max_font: 30, amount: 200, color: true, start_color: '#ccc', end_color: '#111'}) }} 27 |
28 |
29 | {% elif page.type === 'categories' %} 30 |
31 |
32 | {{ _p('counter.categories', site.categories.length) }} 33 |
34 |
35 | {{ list_categories() }} 36 |
37 |
38 | {% else %} 39 | {{ page.content }} 40 | {% endif %} 41 |
42 | 43 | {% endblock %} 44 | 45 | {% block sidebar %} 46 | {{ sidebar_template.render(false) }} 47 | {% endblock %} 48 | -------------------------------------------------------------------------------- /themes/nextNew/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 |
18 | 28 |
29 | {% include '_scripts/ads/bottom-jd-ads.swig' %} 30 |
31 | 32 | 33 |
34 | {% if theme.jiathis %} 35 | {% include '_partials/share/jiathis.swig' %} 36 | {% elseif theme.duoshuo_shortname and theme.duoshuo_share %} 37 | {% include '_partials/share/duoshuo_share.swig' %} 38 | {% elseif theme.baidu_share %} 39 | {% include '_partials/share/baidu_share.swig' %} 40 | {% elseif theme.share_js %} 41 | {% include '_partials/share/share_js.swig' %} 42 | {% endif %} 43 |
44 |
45 | 46 | {% endblock %} 47 | 48 | {% block sidebar %} 49 | {{ sidebar_template.render(true) }} 50 | {% endblock %} 51 | 52 | 53 | {% block script_extra %} 54 | {% include '_scripts/pages/post-details.swig' %} 55 | {% endblock %} 56 | -------------------------------------------------------------------------------- /themes/nextNew/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 | 29 | {% block script_extra_before %} 30 | {% if theme.use_motion %} 31 | 34 | {% endif %} 35 | {% endblock %} 36 | -------------------------------------------------------------------------------- /themes/nextNew/scripts/filters/sticky.js: -------------------------------------------------------------------------------- 1 | /* global hexo */ 2 | 3 | var PRIORITY_AFTER_BUILTIN_FILTER = 11; 4 | 5 | hexo.extend.filter.register('before_generate', function () { 6 | 7 | this.model('Post').toArray().map(function (post) { 8 | var sticky = Number(post.sticky); 9 | post.sticky = isNaN(sticky) ? 0 : sticky; 10 | post.save(); 11 | }); 12 | 13 | }, PRIORITY_AFTER_BUILTIN_FILTER); 14 | -------------------------------------------------------------------------------- /themes/nextNew/scripts/merge-configs.js: -------------------------------------------------------------------------------- 1 | /* global hexo */ 2 | 3 | /** 4 | * Merge configs in _data/next.yml into hexo.theme.config. 5 | * Note: configs in _data/next.yml will override configs in hexo.theme.config. 6 | */ 7 | hexo.on('generateBefore', function () { 8 | if (hexo.locals.get) { 9 | var data = hexo.locals.get('data'); 10 | data && data.next && assign(hexo.theme.config, data.next); 11 | } 12 | }); 13 | 14 | 15 | // https://github.com/sindresorhus/object-assign 16 | function assign(target, source) { 17 | var from; 18 | var keys; 19 | var to = toObject(target); 20 | 21 | for (var s = 1; s < arguments.length; s++) { 22 | from = arguments[s]; 23 | keys = ownEnumerableKeys(Object(from)); 24 | 25 | for (var i = 0; i < keys.length; i++) { 26 | to[keys[i]] = from[keys[i]]; 27 | } 28 | } 29 | 30 | return to; 31 | } 32 | 33 | function toObject(val) { 34 | if (val == null) { 35 | throw new TypeError('Object.assign cannot be called with null or undefined'); 36 | } 37 | 38 | return Object(val); 39 | } 40 | 41 | function ownEnumerableKeys(obj) { 42 | var keys = Object.getOwnPropertyNames(obj); 43 | 44 | if (Object.getOwnPropertySymbols) { 45 | keys = keys.concat(Object.getOwnPropertySymbols(obj)); 46 | } 47 | 48 | return keys.filter(function (key) { 49 | return Object.prototype.propertyIsEnumerable.call(obj, key); 50 | }); 51 | } 52 | -------------------------------------------------------------------------------- /themes/nextNew/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/nextNew/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/nextNew/source/CNAME: -------------------------------------------------------------------------------- 1 | zhangjh.me 2 | -------------------------------------------------------------------------------- /themes/nextNew/source/css/_common/_component/back-to-top.styl: -------------------------------------------------------------------------------- 1 | .back-to-top { 2 | position: fixed; 3 | bottom: 19px; 4 | right: 50px; 5 | z-index: $zindex-5; 6 | width: 15px; 7 | height: 13px; 8 | padding: 5px; 9 | background: $black-deep; 10 | color: white; 11 | cursor: pointer; 12 | -webkit-transform: translateZ(0); 13 | 14 | +mobile() { 15 | display: none; 16 | } 17 | +tablet() { 18 | display: none; 19 | } 20 | 21 | &:before { 22 | display: block; 23 | content: " "; 24 | margin-top: 2px; 25 | width: 0; 26 | height: 0; 27 | border-width: 0 7px 8px 7px; 28 | border-color: transparent transparent white transparent; 29 | border-style: solid; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /themes/nextNew/source/css/_common/_component/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/nextNew/source/css/_common/_component/buttons.styl: -------------------------------------------------------------------------------- 1 | .btn { 2 | display: inline-block; 3 | padding: 0 20px; 4 | font-size: 15px; 5 | color: $btn-default-color; 6 | background: $btn-default-bg; 7 | border: 2px solid $btn-default-border; 8 | text-decoration: none; 9 | transition-property: background-color; 10 | the-transition(); 11 | 12 | &:hover { 13 | border-color: $btn-default-hover-border-color; 14 | color: $btn-default-hover-color; 15 | background: $btn-default-hover-bg; 16 | } 17 | } 18 | 19 | .btn-bar { 20 | display: block; 21 | width: 22px; 22 | height: 2px; 23 | background: $text-color; 24 | border-radius: 1px; 25 | 26 | &+.btn-bar { margin-top: 4px; } 27 | } 28 | -------------------------------------------------------------------------------- /themes/nextNew/source/css/_common/_component/comments.styl: -------------------------------------------------------------------------------- 1 | .comments { margin: 60px 20px 0; } 2 | -------------------------------------------------------------------------------- /themes/nextNew/source/css/_common/_component/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/nextNew/source/css/_common/_component/group-pictures.styl: -------------------------------------------------------------------------------- 1 | .post .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/nextNew/source/css/_common/_component/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 | } 11 | 12 | #jiathis { 13 | text-align: center; 14 | } 15 | 16 | #jiathis_weixin_modal { 17 | text-align: center; 18 | margin-left: -180px !important; 19 | } 20 | 21 | #jiathis_webchat img { 22 | margin-left: auto; 23 | margin-right: auto; 24 | } 25 | 26 | #jiathis_weixin_tip { 27 | line-height: normal; 28 | } 29 | -------------------------------------------------------------------------------- /themes/nextNew/source/css/_common/_component/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/nextNew/source/css/_common/_component/posts-collapse.styl: -------------------------------------------------------------------------------- 1 | @media (max-width: 767px) { 2 | .posts-collapse { 3 | margin: 0 20px; 4 | 5 | .post-title, .post-meta { 6 | display: block; 7 | width: auto; 8 | text-align: left; 9 | } 10 | } 11 | } 12 | 13 | .posts-collapse { 14 | 15 | margin-left: $posts-collapse-left; 16 | +mobile() { margin: 0 20px; } 17 | 18 | .collection-title { 19 | position: relative; 20 | margin: 60px 0; 21 | 22 | h2 { margin-left: 20px; } 23 | 24 | small { color: $grey; } 25 | 26 | &::before { 27 | content: " "; 28 | position: absolute; 29 | left: 0; 30 | top: 50%; 31 | margin-left: -4px; 32 | margin-top: -4px; 33 | width: 8px; 34 | height: 8px; 35 | background: $grey; 36 | circle(); 37 | } 38 | } 39 | 40 | .post { margin: 30px 0; } 41 | 42 | .post-header { 43 | position: relative; 44 | the-transition(); 45 | transition-property: border; 46 | border-bottom: 1px dashed $grey-light; 47 | 48 | &::before { 49 | content: " "; 50 | position: absolute; 51 | left: 0; 52 | top: 12px; 53 | width: 6px; 54 | height: 6px; 55 | margin-left: -4px; 56 | background: $grey; 57 | circle(); 58 | border: 1px solid white; 59 | the-transition(); 60 | transition-property: background; 61 | } 62 | } 63 | 64 | .post-header:hover { 65 | border-bottom-color: $grey-dim; 66 | 67 | &::before { background: $black-deep; } 68 | } 69 | 70 | .post-meta { 71 | position: absolute; 72 | font-size: 12px; 73 | left: 20px; 74 | top: 5px; 75 | } 76 | 77 | .post-comments-count { display: none; } 78 | 79 | .post-title { 80 | margin-left: 60px; 81 | font-size: 16px; 82 | font-weight: normal; 83 | font-family: $font-family-posts; 84 | line-height: inherit; 85 | 86 | &::after { 87 | margin-left: 3px; 88 | opacity: 0.6; 89 | } 90 | 91 | a { 92 | color: $grey-dim; 93 | border-bottom: none; 94 | } 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /themes/nextNew/source/css/_common/_component/posts-type.styl: -------------------------------------------------------------------------------- 1 | .page-home, .page-post-detail { 2 | .post-type-quote { 3 | .post-header, 4 | .post-tags { 5 | display: none; 6 | } 7 | 8 | blockquote { 9 | @extend .blockquote-center 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /themes/nextNew/source/css/_common/_component/posts.styl: -------------------------------------------------------------------------------- 1 | .post-body .fancybox img { 2 | /*display: block !important;*/ 3 | display: block; 4 | margin: 0 auto; 5 | cursor: pointer; 6 | cursor: zoom-out; 7 | cursor: -webkit-zoom-in; 8 | } 9 | 10 | .post-body .image-caption { 11 | margin: 10px auto 15px; 12 | text-align: center; 13 | font-size: $font-size-base; 14 | color: $grey-dark; 15 | font-weight: bold; 16 | line-height: 1; 17 | } 18 | 19 | .post-body .figure .caption { 20 | @extend .post-body .image-caption; 21 | } 22 | 23 | .post-sticky-flag { 24 | display: inline-block; 25 | font-size: 16px; 26 | -ms-transform: rotate(30deg); 27 | transform: rotate(30deg); 28 | } 29 | -------------------------------------------------------------------------------- /themes/nextNew/source/css/_common/_component/tag-cloud.styl: -------------------------------------------------------------------------------- 1 | .tag-cloud { 2 | text-align: center; 3 | 4 | a { 5 | display: inline-block; 6 | margin: 10px; 7 | } 8 | } -------------------------------------------------------------------------------- /themes/nextNew/source/css/_common/_core/base.styl: -------------------------------------------------------------------------------- 1 | h2, h3, h4, h5, h6 { margin: 20px 0 15px; } 2 | 3 | ul { list-style: square; } 4 | 5 | a { word-wrap: break-word; } 6 | 7 | hr { 8 | margin: 40px 0; 9 | height: 3px; 10 | border: none; 11 | background-color: $gray-lighter; 12 | background-image: repeating-linear-gradient( 13 | -45deg, 14 | white, 15 | white 4px, 16 | transparent 4px, 17 | transparent 8px 18 | ); 19 | } 20 | 21 | blockquote { 22 | padding: 0 15px; 23 | color: $grey-dim; 24 | border-left: 4px solid $gray-lighter; 25 | 26 | cite::before { 27 | content: "-"; 28 | padding: 0 5px; 29 | } 30 | } 31 | 32 | dt { 33 | font-weight: 700; 34 | } 35 | dd { 36 | margin: 0; 37 | padding: 0; 38 | } 39 | 40 | .pullquote { 41 | width: 45%; 42 | &.left { 43 | float: left; 44 | margin-left: 5px; 45 | margin-right: 10px; 46 | } 47 | &.right { 48 | float: right; 49 | margin-left: 10px; 50 | margin-right: 5px; 51 | } 52 | } 53 | 54 | .highlight table, .gist table { 55 | width: auto; 56 | td { 57 | border: none; 58 | } 59 | 60 | } 61 | .highlight, .gist { 62 | a { 63 | color: $link-hover-color !important; 64 | text-decoration: none !important; 65 | } 66 | } 67 | 68 | .video-container { 69 | position: relative; 70 | padding-top: 60%; 71 | height: 0; 72 | overflow: hidden; 73 | iframe, object, embed { 74 | position: absolute; 75 | top: 0; 76 | left: 0; 77 | width: 100%; 78 | height: 100%; 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /themes/nextNew/source/css/_common/_core/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 | 35 | // Expand image to 126% with nagative margin-left/right on Desktop. 36 | .full-image.full-image.full-image { 37 | border: none; 38 | max-width: 100%; 39 | width: auto; 40 | margin: 0; 41 | +desktop() { 42 | max-width: none; 43 | width: 126%; 44 | margin: 0 -13%; 45 | } 46 | } 47 | 48 | 49 | .use-motion .motion-element { opacity: 0; } 50 | -------------------------------------------------------------------------------- /themes/nextNew/source/css/_common/_core/scaffolding.styl: -------------------------------------------------------------------------------- 1 | // 2 | // Scaffolding 3 | // ================================================= 4 | 5 | 6 | ::selection { 7 | background: $blue-deep; 8 | color: white; 9 | } 10 | 11 | body { 12 | position: relative; // Required by scrollspy 13 | font-family: $font-family-base; 14 | font-size: $font-size-base; 15 | line-height: $line-height-base; 16 | color: $text-color; 17 | background: $body-bg-color; 18 | 19 | +mobile() { padding-right: 0 !important; } 20 | +tablet() { padding-right: 0 !important; } 21 | +desktop-large() { font-size: $font-size-large; } 22 | } 23 | 24 | h1, h2, h3, h4, h5, h6 { 25 | margin: 0; 26 | padding: 0; 27 | font-weight: bold; 28 | line-height: 1; 29 | font-family: $font-family-headings; 30 | } 31 | 32 | 33 | for headline in (1..6) { 34 | h{headline} { 35 | font-size: $font-size-headings-base - $font-size-headings-step * headline; 36 | } 37 | 38 | +mobile() { 39 | h{headline} { 40 | font-size: $font-size-headings-base - $font-size-headings-step * headline - 4px; 41 | } 42 | } 43 | } 44 | 45 | p { margin: 0 0 25px 0; } 46 | 47 | a { 48 | color: $link-color; 49 | text-decoration: none; 50 | border-bottom: 1px solid $grey-dark; 51 | 52 | &:hover { 53 | color: $link-hover-color; 54 | border-bottom-color: $link-decoration-hover-color; 55 | } 56 | } 57 | 58 | ul { list-style: none; } 59 | 60 | blockquote { 61 | margin: 0; 62 | padding: 0; 63 | } 64 | 65 | img { 66 | display: block; 67 | margin: auto 0; 68 | max-width: 100%; 69 | height: auto; 70 | } 71 | -------------------------------------------------------------------------------- /themes/nextNew/source/css/_common/_core/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 | } 9 | table>tbody>tr { 10 | &:nth-of-type(odd) { background-color: $table-row-odd-bg-color; } 11 | &:hover { background-color: $table-row-hover-bg-color; } 12 | } 13 | 14 | caption, th, td { 15 | padding: $table-cell-padding; 16 | text-align: $table-content-alignment; 17 | vertical-align: $table-content-vertical; 18 | font-weight: normal; 19 | } 20 | 21 | th, td { 22 | border-bottom: 3px solid $table-cell-border-bottom-color; 23 | border-right: 1px solid $table-cell-border-right-color; 24 | } 25 | 26 | th { 27 | padding-bottom: 10px; 28 | font-weight: $table-th-font-weight; 29 | } 30 | 31 | td { border-bottom-width: 1px; } 32 | -------------------------------------------------------------------------------- /themes/nextNew/source/css/_common/_fonts/icon-default.styl: -------------------------------------------------------------------------------- 1 | // FONT-SIZE FOR default ICON SET. 2 | // Duplicate class name to improve priority. 3 | 4 | // Icons from IcoMoon 5 | 6 | .icon-storage:before { 7 | content: "\e0bc"; 8 | } 9 | .icon-insert_emoticon:before { 10 | content: "\e0e8"; 11 | } 12 | .icon-brightness_4:before { 13 | content: "\e13e"; 14 | } 15 | .icon-whatshot:before { 16 | content: "\e25b"; 17 | } 18 | .icon-bookmark:before { 19 | content: "\e27b"; 20 | } 21 | .icon-favorite_outline:before { 22 | content: "\e292"; 23 | } 24 | .icon-home:before { 25 | content: "\e29e"; 26 | } 27 | .icon-open_in_new:before { 28 | content: "\e2b2"; 29 | } 30 | .icon-search:before { 31 | content: "\e2ca"; 32 | } 33 | .icon-view_carousel:before { 34 | content: "\e2fd"; 35 | } 36 | 37 | 38 | 39 | // Icons name used in NexT 40 | 41 | .icon-next-logo:before { 42 | @extend .icon-brightness_4:before; 43 | } 44 | 45 | .icon-next-home:before { 46 | @extend .icon-home:before; 47 | } 48 | 49 | .icon-next-categories:before { 50 | @extend .icon-storage:before; 51 | } 52 | 53 | .icon-next-archives:before { 54 | @extend .icon-view_carousel:before; 55 | } 56 | 57 | .icon-next-about:before { 58 | @extend .icon-insert_emoticon:before; 59 | } 60 | 61 | .icon-next-heart:before { 62 | @extend .icon-favorite_outline:before; 63 | } 64 | 65 | .icon-next-feed:before { 66 | @extend .icon-whatshot:before; 67 | } 68 | 69 | .icon-next-tags:before { 70 | @extend .icon-bookmark:before; 71 | } 72 | 73 | .icon-next-external-link:before { 74 | @extend .icon-open_in_new:before; 75 | } 76 | 77 | .icon-next-search:before { 78 | @extend .icon-search:before; 79 | } 80 | -------------------------------------------------------------------------------- /themes/nextNew/source/css/_common/_fonts/icon-feather.styl: -------------------------------------------------------------------------------- 1 | // FONT-SIZE FOR default ICON SET. 2 | // Duplicate class name to improve priority. 3 | 4 | .menu-item-icon.menu-item-icon.menu-item-icon { font-size: 18px; } 5 | 6 | // Icons from IcoMoon 7 | 8 | .icon-ribbon:before { 9 | content: "\e009"; 10 | } 11 | .icon-signal:before { 12 | content: "\e011"; 13 | } 14 | .icon-server:before { 15 | content: "\e022"; 16 | } 17 | .icon-heart:before { 18 | content: "\e024"; 19 | } 20 | .icon-layers:before { 21 | content: "\e031"; 22 | } 23 | .icon-search:before { 24 | content: "\e036"; 25 | } 26 | .icon-drop:before { 27 | content: "\e063"; 28 | } 29 | .icon-head:before { 30 | content: "\e074"; 31 | } 32 | .icon-flag:before { 33 | content: "\e108"; 34 | } 35 | .icon-open:before { 36 | content: "\e128"; 37 | } 38 | 39 | 40 | // Icons name used in NexT 41 | 42 | .icon-next-logo:before { 43 | @extend .icon-drop:before; 44 | } 45 | 46 | .icon-next-home:before { 47 | @extend .icon-flag:before; 48 | } 49 | 50 | .icon-next-categories:before { 51 | @extend .icon-layers:before; 52 | } 53 | 54 | .icon-next-archives:before { 55 | @extend .icon-server:before; 56 | } 57 | 58 | .icon-next-about:before { 59 | @extend .icon-head:before; 60 | } 61 | 62 | .icon-next-heart:before { 63 | @extend .icon-heart:before; 64 | } 65 | 66 | .icon-next-feed:before { 67 | @extend .icon-signal:before; 68 | } 69 | 70 | .icon-next-tags:before { 71 | @extend .icon-ribbon:before; 72 | } 73 | 74 | .icon-next-external-link:before { 75 | @extend .icon-open:before; 76 | } 77 | 78 | .icon-next-search:before { 79 | @extend .icon-search:before; 80 | } 81 | -------------------------------------------------------------------------------- /themes/nextNew/source/css/_common/_fonts/icon-fifty-shades.styl: -------------------------------------------------------------------------------- 1 | // FONT-SIZE FOR default ICON SET. 2 | // Duplicate class name to improve priority. 3 | 4 | .icon-logo.icon-logo { font-size: 18px; } 5 | 6 | .menu-item-icon.menu-item-icon.menu-item-icon { font-size: 16px; } 7 | 8 | 9 | // Icons from IcoMoon 10 | 11 | .icon-out:before { 12 | content: "\e600"; 13 | } 14 | .icon-home:before { 15 | content: "\e601"; 16 | } 17 | .icon-lightbulb:before { 18 | content: "\e602"; 19 | } 20 | .icon-feather:before { 21 | content: "\e603"; 22 | } 23 | .icon-search:before { 24 | content: "\e604"; 25 | } 26 | .icon-book:before { 27 | content: "\e605"; 28 | } 29 | .icon-compose:before { 30 | content: "\e606"; 31 | } 32 | .icon-grid:before { 33 | content: "\e607"; 34 | } 35 | .icon-user:before { 36 | content: "\e608"; 37 | } 38 | .icon-heart:before { 39 | content: "\e609"; 40 | } 41 | 42 | 43 | 44 | // Icons name used in NexT 45 | 46 | .icon-next-logo:before { 47 | @extend .icon-compose:before; 48 | } 49 | 50 | .icon-next-home:before { 51 | @extend .icon-home:before; 52 | } 53 | 54 | .icon-next-categories:before { 55 | @extend .icon-grid:before; 56 | } 57 | 58 | .icon-next-archives:before { 59 | @extend .icon-book:before; 60 | } 61 | 62 | .icon-next-about:before { 63 | @extend .icon-user:before; 64 | } 65 | 66 | .icon-next-heart:before { 67 | @extend .icon-heart:before; 68 | } 69 | 70 | .icon-next-feed:before { 71 | @extend .icon-lightbulb:before; 72 | } 73 | 74 | .icon-next-tags:before { 75 | @extend .icon-feather:before; 76 | } 77 | 78 | .icon-next-external-link:before { 79 | @extend .icon-out:before; 80 | } 81 | 82 | .icon-next-search:before { 83 | @extend .icon-search:before; 84 | } 85 | -------------------------------------------------------------------------------- /themes/nextNew/source/css/_common/_fonts/icon-font.styl: -------------------------------------------------------------------------------- 1 | $iconFontPrefix = '../fonts/icon-' + hexo-config('icon_font') + '/icomoon'; 2 | $iconFontFamily = hexo-config('icon_font'); 3 | $icon-font-version = '9394c0'; 4 | 5 | @font-face { 6 | font-family: $iconFontFamily; 7 | src:url($iconFontPrefix + '.eot?-' + $icon-font-version); 8 | src:url($iconFontPrefix + '.eot?#iefix-' + $icon-font-version) format('embedded-opentype'), 9 | url($iconFontPrefix + '.woff?-' + $icon-font-version) format('woff'), 10 | url($iconFontPrefix + '.ttf?-' + $icon-font-version) format('truetype'), 11 | url($iconFontPrefix + '.svg?-' + $icon-font-version + '#' + $iconFontFamily) format('svg'); 12 | font-weight: normal; 13 | font-style: normal; 14 | } 15 | 16 | [class^="icon-"], [class*=" icon-"] { 17 | font-family: $iconFontFamily; 18 | speak: none; 19 | font-style: normal; 20 | font-weight: normal; 21 | font-variant: normal; 22 | text-transform: none; 23 | line-height: 1; 24 | 25 | /* Better Font Rendering =========== */ 26 | -webkit-font-smoothing: antialiased; 27 | -moz-osx-font-smoothing: grayscale; 28 | } 29 | 30 | // ==== Default font-size/color for icons. 31 | 32 | .icon-next-logo { 33 | font-size: 24px; 34 | color: white; 35 | } 36 | 37 | // Menu icons 38 | .icon-next-home, 39 | .icon-next-categories, 40 | .icon-next-archives, 41 | .icon-next-tags, 42 | .icon-next-about, 43 | .icon-next-feed, 44 | .icon-next-search { 45 | font-size: 24px; 46 | color: black; 47 | } 48 | 49 | .icon-next-external-link { font-size: 14px; } 50 | 51 | .icon-next-heart { font-size: 14px; } 52 | -------------------------------------------------------------------------------- /themes/nextNew/source/css/_common/_fonts/icon-linecons.styl: -------------------------------------------------------------------------------- 1 | // FONT-SIZE FOR default ICON SET. 2 | // Duplicate class name to improve priority. 3 | 4 | .menu-item-icon.menu-item-icon.menu-item-icon { 5 | font-size: 20px; 6 | } 7 | 8 | 9 | .icon-external-link { 10 | font-size: 14px; 11 | } 12 | 13 | 14 | // REQUIRED ICONS 15 | 16 | .icon-heart:before { 17 | content: "\e600"; 18 | } 19 | .icon-star:before { 20 | content: "\e602"; 21 | } 22 | .icon-user:before { 23 | content: "\e607"; 24 | } 25 | .icon-search:before { 26 | content: "\e609"; 27 | } 28 | .icon-tag:before { 29 | content: "\e60c"; 30 | } 31 | .icon-bulb:before { 32 | content: "\e60e"; 33 | } 34 | .icon-news:before { 35 | content: "\e618"; 36 | } 37 | .icon-paperplane:before { 38 | content: "\e61e"; 39 | } 40 | .icon-lab:before { 41 | content: "\e625"; 42 | } 43 | .icon-shop:before { 44 | content: "\e62a"; 45 | } 46 | 47 | // Icons name used in NexT 48 | 49 | .icon-next-logo:before { 50 | @extend .icon-lab:before; 51 | } 52 | 53 | .icon-next-home:before { 54 | @extend .icon-shop:before; 55 | } 56 | 57 | .icon-next-categories:before { 58 | @extend .icon-star:before; 59 | } 60 | 61 | .icon-next-archives:before { 62 | @extend .icon-news:before; 63 | } 64 | 65 | .icon-next-about:before { 66 | @extend .icon-user:before; 67 | } 68 | 69 | .icon-next-heart:before { 70 | @extend .icon-heart:before; 71 | } 72 | 73 | .icon-next-feed:before { 74 | @extend .icon-bulb:before; 75 | } 76 | 77 | .icon-next-tags:before { 78 | @extend .icon-tag:before; 79 | } 80 | 81 | .icon-next-external-link:before { 82 | @extend .icon-paperplane:before; 83 | } 84 | 85 | .icon-next-search:before { 86 | @extend .icon-search:before; 87 | } 88 | -------------------------------------------------------------------------------- /themes/nextNew/source/css/_common/_page/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 | position: relative; 19 | 20 | &::after { 21 | top: 20px; 22 | left: 0; 23 | margin-left: -2px; 24 | width: 4px; 25 | height: 100%; 26 | background: $whitesmoke; 27 | z-index: $zindex-bottom; 28 | } 29 | 30 | .archive-move-on { 31 | position: absolute; 32 | top: 11px; 33 | left: 0; 34 | margin-left: -6px; 35 | width: 10px; 36 | height: 10px; 37 | opacity: 0.5; 38 | background: $black-light; 39 | border: 1px solid white; 40 | 41 | circle(); 42 | } 43 | 44 | &::before, &::after { 45 | content: " "; 46 | position: absolute; 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /themes/nextNew/source/css/_common/_page/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 { 13 | display: inline-block; 14 | margin: 10px; 15 | } 16 | 17 | .category-list-count { 18 | color: $grey; 19 | &:before { 20 | display: inline; 21 | content: " (" 22 | } 23 | &:after { 24 | display: inline; 25 | content: ") " 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /themes/nextNew/source/css/_common/_page/home.styl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhangjh/hello-blog/a0fffc86c231ed109203492e8cfdd5098db58e66/themes/nextNew/source/css/_common/_page/home.styl -------------------------------------------------------------------------------- /themes/nextNew/source/css/_common/_page/post-detail.styl: -------------------------------------------------------------------------------- 1 | .page-post-detail { 2 | 3 | .sidebar-toggle-line { background: $sidebar-highlight; } 4 | 5 | .comments { overflow: hidden; } 6 | } 7 | 8 | /*底部广告居中*/ 9 | #bottom_ads { 10 | text-align: center; 11 | } 12 | -------------------------------------------------------------------------------- /themes/nextNew/source/css/_common/_section/body.styl: -------------------------------------------------------------------------------- 1 | 2 | .translation { 3 | margin-top: -20px; 4 | font-size: 14px; 5 | color: $grey-dark; 6 | } 7 | 8 | .post:last-child { 9 | .post-eof.post-eof.post-eof { 10 | display: none; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /themes/nextNew/source/css/_common/_section/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 | .ba-info,{ 17 | display: inline-block; 18 | font-size: small; 19 | } 20 | 21 | .powered-by, 22 | .ba-info { 23 | margin-right: 10px; 24 | 25 | &::after { 26 | content: "|"; 27 | padding-left: 10px; 28 | } 29 | } 30 | 31 | .powered-by:last-child, 32 | .ba-info:last-child { 33 | &::after { 34 | display: none; 35 | } 36 | } 37 | 38 | .powered-by-noline { 39 | display: inline-block; 40 | font-size: small; 41 | } 42 | 43 | .cc-license { 44 | margin-top: 10px; 45 | text-align: center; 46 | 47 | .cc-opacity { 48 | opacity: 0.7; 49 | border-bottom: none; 50 | 51 | &:hover { opacity: 0.9; } 52 | } 53 | 54 | img { display: inline-block; } 55 | } 56 | -------------------------------------------------------------------------------- /themes/nextNew/source/css/_common/_section/layout.styl: -------------------------------------------------------------------------------- 1 | // 2 | // Layout 3 | // ================================================= 4 | 5 | 6 | html, body { height: 100%; } 7 | 8 | .container { 9 | position: relative; 10 | min-height: 100%; 11 | } 12 | 13 | 14 | // Header Section 15 | // -------------------------------------------------- 16 | .header-inner { 17 | margin: 0 auto; 18 | padding: 100px 0 70px; 19 | width: $main-desktop; 20 | 21 | .one-column & { width: $content-desktop; } 22 | +desktop-large() { 23 | .one-column & { width: $content-desktop-large; } 24 | } 25 | } 26 | 27 | // Main Section 28 | // -------------------------------------------------- 29 | .main { padding-bottom: $footer-height + $gap-between-main-and-footer; } 30 | .main { 31 | padding-bottom: 0; 32 | } 33 | .main-inner { 34 | margin: 0 auto; 35 | width: $main-desktop; 36 | 37 | .one-column & { width: $content-desktop; } 38 | +desktop-large() { 39 | .one-column & { width: $content-desktop-large; } 40 | } 41 | } 42 | 43 | 44 | // Footer Section 45 | // -------------------------------------------------- 46 | .footer { 47 | position: absolute; 48 | left: 0; 49 | //bottom: 0; 50 | width: 100%; 51 | min-height: $footer-height; 52 | } 53 | .footer-inner { 54 | margin: 20px auto; 55 | width: $main-desktop; 56 | 57 | .one-column & { width: $content-desktop; } 58 | +desktop-large() { 59 | .one-column & { width: $content-desktop-large; } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /themes/nextNew/source/css/_common/_section/media.styl: -------------------------------------------------------------------------------- 1 | @media (max-width: 767px) 2 | body { 3 | font-size: 14px; 4 | } 5 | 6 | .header-inner, 7 | .one-column .header-inner, 8 | .main-inner, 9 | .one-column .main-inner, 10 | .main-inner .content, 11 | .footer-inner, 12 | .one-column .footer-inner{ 13 | width: auto; 14 | } 15 | 16 | 17 | .main-inner { 18 | margin: 20px auto 0; 19 | } 20 | 21 | 22 | .footer-inner { 23 | padding: 0 10px; 24 | } -------------------------------------------------------------------------------- /themes/nextNew/source/css/_mixins/Mist.styl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhangjh/hello-blog/a0fffc86c231ed109203492e8cfdd5098db58e66/themes/nextNew/source/css/_mixins/Mist.styl -------------------------------------------------------------------------------- /themes/nextNew/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 | random-color($min, $max) { 36 | return floor(math(0, 'random') * ($max - $min + 1) + $min); 37 | } 38 | 39 | // Clearfix. http://nicolasgallagher.com/micro-clearfix-hack/ 40 | clearfix() { 41 | &:before, 42 | &:after { 43 | content: " "; 44 | display: table; 45 | } 46 | &:after { clear: both; } 47 | } 48 | -------------------------------------------------------------------------------- /themes/nextNew/source/css/_mixins/custom.styl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhangjh/hello-blog/a0fffc86c231ed109203492e8cfdd5098db58e66/themes/nextNew/source/css/_mixins/custom.styl -------------------------------------------------------------------------------- /themes/nextNew/source/css/_mixins/default.styl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhangjh/hello-blog/a0fffc86c231ed109203492e8cfdd5098db58e66/themes/nextNew/source/css/_mixins/default.styl -------------------------------------------------------------------------------- /themes/nextNew/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 | 14 | ul li { list-style: circle; } 15 | -------------------------------------------------------------------------------- /themes/nextNew/source/css/_schemes/Mist/_header.styl: -------------------------------------------------------------------------------- 1 | // Header 2 | // -------------------------------------------------- 3 | .header { background: $whitesmoke; } 4 | .header-inner { 5 | margin-bottom: 80px; 6 | padding: 40px 0; 7 | clearfix(); 8 | 9 | +mobile() { 10 | margin-bottom: 50px; 11 | padding: 10px; 12 | } 13 | } 14 | 15 | .site-meta { 16 | float: left; 17 | margin-left: -20px; 18 | 19 | +mobile() { 20 | margin-left: 10px; 21 | } 22 | 23 | .brand { 24 | padding: 2px 1px; 25 | background: none; 26 | 27 | +mobile() { display: block; } 28 | } 29 | 30 | .logo { display: none; } 31 | 32 | .site-title { 33 | font-size: 22px; 34 | font-weight: bolder; 35 | 36 | +mobile() { line-height: 34px; } 37 | } 38 | } 39 | 40 | 41 | .logo-line-before, 42 | .logo-line-after { 43 | display: block; 44 | overflow: hidden; 45 | margin: 0 auto; 46 | width: 75%; 47 | 48 | +mobile() { display: none; } 49 | 50 | i { 51 | position: relative; 52 | display: block; 53 | height: 2px; 54 | background: $black-deep; 55 | +mobile() { height: 3px; } 56 | } 57 | } 58 | 59 | .use-motion { 60 | .logo-line-before i { left: -100%; } 61 | .logo-line-after i { right: -100%; } 62 | } 63 | -------------------------------------------------------------------------------- /themes/nextNew/source/css/_schemes/Mist/_logo.styl: -------------------------------------------------------------------------------- 1 | .site-subtitle { display: none; } 2 | -------------------------------------------------------------------------------- /themes/nextNew/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 20px; 12 | padding: 0 20px; 13 | 14 | +mobile() { 15 | margin: 0; 16 | padding: 0; 17 | } 18 | 19 | br { display: none; } 20 | 21 | .menu-item { 22 | margin: 0; 23 | +mobile() { display: block; } 24 | } 25 | 26 | .menu-item a { 27 | padding: 5px 10px; 28 | background: none; 29 | border: none; 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 | 48 | .menu-left { 49 | float: left; 50 | +mobile() { float: none; } 51 | } 52 | 53 | .menu-item-icon { display: none; } 54 | -------------------------------------------------------------------------------- /themes/nextNew/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-more-link { 45 | margin-top: 20px; 46 | text-align: left; 47 | 48 | a { 49 | padding: 0; 50 | font-size: $font-size-base; 51 | color: $grey-dim; 52 | background: none; 53 | border: none; 54 | border-bottom: 2px solid $grey-dim; 55 | transition-property: border; 56 | 57 | +mobile() { font-size: $font-size-small; } 58 | +desktop-large() { font-size: $font-size-large; } 59 | 60 | 61 | &:hover { border-bottom-color: $black-deep; } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /themes/nextNew/source/css/_schemes/Mist/index.styl: -------------------------------------------------------------------------------- 1 | // 2 | // Mist scheme 3 | // ================================================= 4 | 5 | @import "_base"; 6 | @import "_header"; 7 | @import "_logo"; 8 | @import "_menu"; 9 | @import "_posts-expanded"; 10 | 11 | 12 | // Components 13 | // -------------------------------------------------- 14 | .btn { 15 | padding: 0 10px; 16 | border-width: 2px; 17 | border-radius: 0; 18 | } 19 | 20 | .headband { display: none; } 21 | 22 | 23 | // Search 24 | // -------------------------------------------------- 25 | .site-search { 26 | float: right; 27 | margin-top: 8px; 28 | 29 | +mobile() { 30 | float: none; 31 | padding: 0 10px; 32 | } 33 | 34 | input { 35 | padding: 3px; 36 | border: none; 37 | padding-left: 18px; 38 | border-radius: 0; 39 | width: 140px; 40 | background: url($search-icon) no-repeat 0 50%; 41 | background-size: 12px 12px; 42 | outline: none; 43 | border-bottom: 1px solid $grey-dark; 44 | opacity: 0.5; 45 | &:focus { opacity: 1; } 46 | } 47 | } 48 | 49 | 50 | // Page - Post details 51 | // -------------------------------------------------- 52 | .page-post-detail { 53 | .post-title, 54 | .post-meta { text-align: center; } 55 | 56 | .post-title:before { display: none; } 57 | 58 | .post-meta { margin-bottom: 60px; } 59 | } 60 | 61 | 62 | // Pagination 63 | // -------------------------------------------------- 64 | .pagination { 65 | margin: 120px 0 0; 66 | text-align: left; 67 | 68 | +mobile() { 69 | margin: 80px 10px 0; 70 | text-align: center; 71 | } 72 | } 73 | 74 | // Footer 75 | // -------------------------------------------------- 76 | .footer { 77 | margin-top: 80px; 78 | padding: 10px 0; 79 | background: $whitesmoke; 80 | color: $grey-dim; 81 | } 82 | .footer-inner { 83 | margin: 0 auto; 84 | text-align: left; 85 | 86 | +mobile() { text-align: center; } 87 | } 88 | 89 | // Helpers 90 | // -------------------------------------------------- 91 | -------------------------------------------------------------------------------- /themes/nextNew/source/css/_schemes/default/_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/nextNew/source/css/_schemes/default/_menu.styl: -------------------------------------------------------------------------------- 1 | .site-nav { 2 | +mobile() { 3 | position: absolute; 4 | left: 0; 5 | top: 52px; 6 | margin: 0; 7 | width: 100%; 8 | background: white; 9 | border-bottom: 1px solid $gray-lighter; 10 | } 11 | } 12 | 13 | .menu { 14 | +mobile() { text-align: left; } 15 | } 16 | .menu .menu-item { 17 | +mobile() { 18 | display: block; 19 | margin-left: 0; 20 | vertical-align: top; 21 | } 22 | 23 | br { 24 | +mobile() { display: none; } 25 | } 26 | } 27 | 28 | .menu .menu-item-icon { 29 | +mobile() { 30 | font-size: 15px; 31 | } 32 | } -------------------------------------------------------------------------------- /themes/nextNew/source/css/_schemes/default/_search.styl: -------------------------------------------------------------------------------- 1 | // Search 2 | // -------------------------------------------------- 3 | .site-search { 4 | position: absolute; 5 | top: 0; 6 | right: 0; 7 | font-size: 0; 8 | 9 | +mobile() { position: static; } 10 | } 11 | 12 | .site-search form { 13 | position: relative; 14 | vertical-align: top; 15 | background: $black-deep; 16 | height: 30px; 17 | z-index: 10; 18 | 19 | +mobile() { 20 | background: none; 21 | } 22 | 23 | input { 24 | border: none; 25 | color: $grey-light; 26 | background: transparent url(/images/searchicon.png) no-repeat 10px 40%; 27 | background-size: 15px 15px; 28 | 29 | +mobile() { color: $black-deep; } 30 | } 31 | } 32 | 33 | .use-motion .site-search form { 34 | top: -50px; 35 | +mobile() { top: 0 !important; } 36 | } 37 | -------------------------------------------------------------------------------- /themes/nextNew/source/css/_schemes/default/index.styl: -------------------------------------------------------------------------------- 1 | @import "_logo.styl"; 2 | @import "_menu.styl"; 3 | @import "_search.styl"; 4 | -------------------------------------------------------------------------------- /themes/nextNew/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 | -------------------------------------------------------------------------------- /themes/nextNew/source/css/_variables/custom.styl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhangjh/hello-blog/a0fffc86c231ed109203492e8cfdd5098db58e66/themes/nextNew/source/css/_variables/custom.styl -------------------------------------------------------------------------------- /themes/nextNew/source/css/_variables/default.styl: -------------------------------------------------------------------------------- 1 | // .post-expand .post-eof 2 | // In the default scheme, margin above and below the post separator 3 | $post-eof-margin-top = 80px // or 160px for more white space 4 | $post-eof-margin-bottom = 60px // or 120px for less white space 5 | -------------------------------------------------------------------------------- /themes/nextNew/source/css/main.styl: -------------------------------------------------------------------------------- 1 | // CSS Style Guide: http://codeguide.co/#css 2 | 3 | 4 | 5 | $scheme = hexo-config('scheme') ? hexo-config('scheme') : 'default'; 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 | 28 | // Reset using normalize. 29 | @import "_common/_core/normalize"; 30 | 31 | 32 | // Core CSS 33 | @import "_common/_core/scaffolding"; 34 | @import "_common/_core/base"; 35 | @import "_common/_core/tables"; 36 | @import "_common/_core/helpers"; 37 | 38 | 39 | 40 | // Vendors 41 | @import "_common/_vendor/highlight/highlight"; 42 | 43 | 44 | // Sections 45 | @import "_common/_section/layout"; 46 | @import "_common/_section/header"; 47 | @import "_common/_section/body"; 48 | @import "_common/_section/sidebar"; 49 | @import "_common/_section/footer"; 50 | @import "_common/_section/media"; 51 | 52 | 53 | // Components 54 | @import "_common/_component/blockquote-center"; 55 | @import "_common/_component/buttons"; 56 | @import "_common/_component/posts"; 57 | @import "_common/_component/posts-expand"; 58 | @import "_common/_component/posts-collapse"; 59 | @import "_common/_component/posts-type"; 60 | @import "_common/_component/pagination"; 61 | @import "_common/_component/comments"; 62 | @import "_common/_component/tag-cloud"; 63 | @import "_common/_component/gallery"; 64 | @import "_common/_component/group-pictures"; 65 | @import "_common/_component/back-to-top"; 66 | @import "_common/_component/duoshuo"; 67 | @import "_common/_component/jiathis"; 68 | 69 | 70 | 71 | // Page specific styles 72 | @import "_common/_page/home"; 73 | @import "_common/_page/archive"; 74 | @import "_common/_page/post-detail"; 75 | @import "_common/_page/categories"; 76 | 77 | 78 | 79 | // Schemes Layer 80 | // -------------------------------------------------- 81 | @import "_schemes/" + $scheme; 82 | 83 | 84 | 85 | // Custom Layer 86 | // -------------------------------------------------- 87 | @import "_custom/custom"; 88 | -------------------------------------------------------------------------------- /themes/nextNew/source/css/search.css: -------------------------------------------------------------------------------- 1 | * { 2 | line-height: normal; 3 | box-sizing: initial; 4 | -webkit-box-sizing: initial; 5 | } 6 | img#logo ,h1{ 7 | display: inline; 8 | } 9 | img#logo { 10 | width: 80px; 11 | margin: 10px; 12 | } 13 | #gsc-iw-id1 { 14 | height: 60px; 15 | } 16 | .gsc-input-box ,.gsib_a { 17 | height: 60px; 18 | } 19 | 20 | input.gsc-search-button-v2 { 21 | height: 48px !important; 22 | width: 48px !important; 23 | } 24 | /* .gsc-control-cse { 25 | width: 700px !important; 26 | } */ 27 | .gsc-control-wrapper-cse,.gsc-search-box,.gsc-input { 28 | width: 100% !important; 29 | } 30 | 31 | #title { 32 | margin-top: 5%; 33 | margin-bottom: 3%; 34 | } 35 | 36 | #des { 37 | margin-left: 30px; 38 | } 39 | 40 | #desBtn { 41 | cursor: pointer; 42 | width: 50px; 43 | } 44 | 45 | #des #content { 46 | display: none; 47 | margin-top: 20px; 48 | color: blueviolet; 49 | } 50 | 51 | .tips { 52 | display: none; 53 | position: absolute; 54 | top: 54px; 55 | right: 10px; 56 | width: 220px; 57 | height: 78px; 58 | border: 1px solid #e3e3e3; 59 | background: white; 60 | box-shadow: 1px 2px 1px rgba(0,0,0,0.072); 61 | -webkit-box-shadow: 1px 2px 1px rgba(0,0,0,0.072); 62 | } 63 | 64 | a#close { 65 | position: absolute; 66 | right: 8px; 67 | top: 8px; 68 | width: 9px; 69 | height: 9px; 70 | color: black; 71 | } 72 | 73 | .tips > img { 74 | vertical-align: middle; 75 | width: 56px; 76 | height: 56px; 77 | position: absolute; 78 | left: 10px; 79 | top: 10px; 80 | } 81 | 82 | .tips_info { 83 | text-align:center; 84 | width: 44px; 85 | height: 46px; 86 | position: absolute; 87 | left: 76px; 88 | top: 15px; 89 | } 90 | 91 | .tips_info > a { 92 | margin: 5px 0 0 5px; 93 | } 94 | 95 | #footer { 96 | background: #f5f5f5; 97 | padding: 10px 0; 98 | color: #666; 99 | font-size: 14px; 100 | position: fixed; 101 | left: 0; 102 | bottom: 0; 103 | width: 100%; 104 | min-height: 50px; 105 | text-align: center; 106 | } 107 | 108 | #footer a { 109 | border-bottom: 1px solid #999; 110 | color: #555; 111 | text-decoration: none; 112 | } 113 | 114 | #footer div { 115 | margin: 5px 0; 116 | } 117 | -------------------------------------------------------------------------------- /themes/nextNew/source/fonts/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhangjh/hello-blog/a0fffc86c231ed109203492e8cfdd5098db58e66/themes/nextNew/source/fonts/.gitkeep -------------------------------------------------------------------------------- /themes/nextNew/source/fonts/iconfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhangjh/hello-blog/a0fffc86c231ed109203492e8cfdd5098db58e66/themes/nextNew/source/fonts/iconfont.eot -------------------------------------------------------------------------------- /themes/nextNew/source/fonts/iconfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhangjh/hello-blog/a0fffc86c231ed109203492e8cfdd5098db58e66/themes/nextNew/source/fonts/iconfont.ttf -------------------------------------------------------------------------------- /themes/nextNew/source/fonts/iconfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhangjh/hello-blog/a0fffc86c231ed109203492e8cfdd5098db58e66/themes/nextNew/source/fonts/iconfont.woff -------------------------------------------------------------------------------- /themes/nextNew/source/images/beian.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhangjh/hello-blog/a0fffc86c231ed109203492e8cfdd5098db58e66/themes/nextNew/source/images/beian.png -------------------------------------------------------------------------------- /themes/nextNew/source/images/default_avatar.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhangjh/hello-blog/a0fffc86c231ed109203492e8cfdd5098db58e66/themes/nextNew/source/images/default_avatar.jpg -------------------------------------------------------------------------------- /themes/nextNew/source/images/loading.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhangjh/hello-blog/a0fffc86c231ed109203492e8cfdd5098db58e66/themes/nextNew/source/images/loading.gif -------------------------------------------------------------------------------- /themes/nextNew/source/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhangjh/hello-blog/a0fffc86c231ed109203492e8cfdd5098db58e66/themes/nextNew/source/images/logo.png -------------------------------------------------------------------------------- /themes/nextNew/source/images/placeholder.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhangjh/hello-blog/a0fffc86c231ed109203492e8cfdd5098db58e66/themes/nextNew/source/images/placeholder.gif -------------------------------------------------------------------------------- /themes/nextNew/source/images/quote-l.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 8 | 13 | 14 | -------------------------------------------------------------------------------- /themes/nextNew/source/images/quote-r.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 8 | 12 | 13 | -------------------------------------------------------------------------------- /themes/nextNew/source/images/search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhangjh/hello-blog/a0fffc86c231ed109203492e8cfdd5098db58e66/themes/nextNew/source/images/search.png -------------------------------------------------------------------------------- /themes/nextNew/source/images/searchicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhangjh/hello-blog/a0fffc86c231ed109203492e8cfdd5098db58e66/themes/nextNew/source/images/searchicon.png -------------------------------------------------------------------------------- /themes/nextNew/source/images/zfb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhangjh/hello-blog/a0fffc86c231ed109203492e8cfdd5098db58e66/themes/nextNew/source/images/zfb.png -------------------------------------------------------------------------------- /themes/nextNew/source/js/bootstrap.js: -------------------------------------------------------------------------------- 1 | $(document).ready(function () { 2 | 3 | isMobile() && FastClick.attach(document.body); 4 | 5 | $("#posts").find('img').lazyload({ 6 | placeholder: "{{ url_for(theme.images) }}/loading.gif", 7 | effect: "fadeIn" 8 | }); 9 | 10 | $('.back-to-top').on('click', function () { 11 | $('body').velocity('scroll'); 12 | }); 13 | 14 | $('.site-nav-toggle button').on('click', function () { 15 | var $siteNav = $('.site-nav'); 16 | var ON_CLASS_NAME = 'site-nav-on'; 17 | var isSiteNavOn = $siteNav.hasClass(ON_CLASS_NAME); 18 | var animateAction = isSiteNavOn ? 'slideUp' : 'slideDown'; 19 | var animateCallback = isSiteNavOn ? 'removeClass' : 'addClass'; 20 | 21 | $siteNav.stop()[animateAction]('fast', function () { 22 | $siteNav[animateCallback](ON_CLASS_NAME); 23 | }); 24 | }); 25 | 26 | // Define Motion Sequence. 27 | motionIntegrator 28 | .add(motionMiddleWares.logo) 29 | .add(motionMiddleWares.menu) 30 | .add(motionMiddleWares.postList) 31 | .add(motionMiddleWares.sidebar); 32 | 33 | // Bootstrap Motion. 34 | CONFIG.motion && motionIntegrator.bootstrap(); 35 | }); 36 | -------------------------------------------------------------------------------- /themes/nextNew/source/js/fancy-box.js: -------------------------------------------------------------------------------- 1 | $(document).ready(function() { 2 | $('.content img').not('.group-picture img').each(function () { 3 | 4 | var $image = $(this); 5 | var imageTitle = $image.attr('title'); 6 | var $imageWrapLink = $image.parent('a'); 7 | 8 | if ($imageWrapLink.size() < 1) { 9 | $imageWrapLink = $image.wrap('').parent('a'); 10 | } 11 | 12 | $imageWrapLink.addClass('fancybox'); 13 | $imageWrapLink.attr('rel', 'group'); 14 | 15 | if (imageTitle) { 16 | $imageWrapLink.append('

' + imageTitle + '

'); 17 | $imageWrapLink.attr("title", imageTitle); //make sure img title tag will show correctly in fancybox 18 | } 19 | }); 20 | }); 21 | 22 | $('.fancybox').fancybox({ 23 | helpers: { 24 | overlay: { 25 | locked: false 26 | } 27 | } 28 | }); 29 | 30 | 31 | -------------------------------------------------------------------------------- /themes/nextNew/source/js/helpers.js: -------------------------------------------------------------------------------- 1 | function hasMobileUA () { 2 | var nav = window.navigator; 3 | var ua = nav.userAgent; 4 | var pa = /iPad|iPhone|Android|Opera Mini|BlackBerry|webOS|UCWEB|Blazer|PSP|IEMobile|Symbian/g; 5 | 6 | return pa.test(ua); 7 | } 8 | 9 | function isDesktop () { 10 | return screen.width > 991 && !hasMobileUA(); 11 | } 12 | 13 | function isTablet () { 14 | return screen.width < 992 && screen.width > 767 && hasMobileUA(); 15 | } 16 | 17 | function isMobile () { 18 | return screen.width < 767 && hasMobileUA(); 19 | } 20 | 21 | function escapeSelector (selector) { 22 | return selector.replace(/[!"$%&'()*+,.\/:;<=>?@[\\\]^`{|}~]/g, "\\$&") 23 | } 24 | 25 | function displaySidebar () { 26 | if (!isDesktop()) { 27 | return; 28 | } 29 | $('.sidebar-toggle').trigger('click'); 30 | } 31 | 32 | function isMist () { 33 | return CONFIG.scheme === 'Mist'; 34 | } 35 | -------------------------------------------------------------------------------- /themes/nextNew/source/js/search.js: -------------------------------------------------------------------------------- 1 | /* 2 | Des:网盘搜索工具的js文件 3 | Date:3.25 2016 4 | */ 5 | var closeE = $("#close"); 6 | var tipsE = $(".tips"); 7 | var desBtn = $("#desBtn"); 8 | 9 | function showTips (argument) { 10 | var cookie = document.cookie.split(";"); 11 | var i=0,len=cookie.length; 12 | for(;i screen.availWidth){ 55 | $("#title h1").css({"font-size":"20px"}); 56 | } 57 | -------------------------------------------------------------------------------- /themes/nextNew/source/robots.txt: -------------------------------------------------------------------------------- 1 | User-agent:* 2 | Disallow: /%E7%BB%93%E5%A9%9A%E7%85%A7.html 3 | Disallow: /结婚照.html 4 | Disallow: /2015/12/09/wedding/ 5 | Disallow: /about 6 | -------------------------------------------------------------------------------- /themes/nextNew/source/vendors/bootstrap/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhangjh/hello-blog/a0fffc86c231ed109203492e8cfdd5098db58e66/themes/nextNew/source/vendors/bootstrap/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /themes/nextNew/source/vendors/bootstrap/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhangjh/hello-blog/a0fffc86c231ed109203492e8cfdd5098db58e66/themes/nextNew/source/vendors/bootstrap/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /themes/nextNew/source/vendors/bootstrap/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhangjh/hello-blog/a0fffc86c231ed109203492e8cfdd5098db58e66/themes/nextNew/source/vendors/bootstrap/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /themes/nextNew/source/vendors/bootstrap/fonts/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhangjh/hello-blog/a0fffc86c231ed109203492e8cfdd5098db58e66/themes/nextNew/source/vendors/bootstrap/fonts/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /themes/nextNew/source/vendors/fancybox/source/blank.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhangjh/hello-blog/a0fffc86c231ed109203492e8cfdd5098db58e66/themes/nextNew/source/vendors/fancybox/source/blank.gif -------------------------------------------------------------------------------- /themes/nextNew/source/vendors/fancybox/source/fancybox_loading.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhangjh/hello-blog/a0fffc86c231ed109203492e8cfdd5098db58e66/themes/nextNew/source/vendors/fancybox/source/fancybox_loading.gif -------------------------------------------------------------------------------- /themes/nextNew/source/vendors/fancybox/source/fancybox_loading@2x.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhangjh/hello-blog/a0fffc86c231ed109203492e8cfdd5098db58e66/themes/nextNew/source/vendors/fancybox/source/fancybox_loading@2x.gif -------------------------------------------------------------------------------- /themes/nextNew/source/vendors/fancybox/source/fancybox_overlay.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhangjh/hello-blog/a0fffc86c231ed109203492e8cfdd5098db58e66/themes/nextNew/source/vendors/fancybox/source/fancybox_overlay.png -------------------------------------------------------------------------------- /themes/nextNew/source/vendors/fancybox/source/fancybox_sprite.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhangjh/hello-blog/a0fffc86c231ed109203492e8cfdd5098db58e66/themes/nextNew/source/vendors/fancybox/source/fancybox_sprite.png -------------------------------------------------------------------------------- /themes/nextNew/source/vendors/fancybox/source/fancybox_sprite@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhangjh/hello-blog/a0fffc86c231ed109203492e8cfdd5098db58e66/themes/nextNew/source/vendors/fancybox/source/fancybox_sprite@2x.png -------------------------------------------------------------------------------- /themes/nextNew/source/vendors/fancybox/source/helpers/fancybox_buttons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhangjh/hello-blog/a0fffc86c231ed109203492e8cfdd5098db58e66/themes/nextNew/source/vendors/fancybox/source/helpers/fancybox_buttons.png -------------------------------------------------------------------------------- /themes/nextNew/source/vendors/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/nextNew/source/vendors/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/nextNew/source/vendors/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/nextNew/source/vendors/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/nextNew/source/vendors/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.4.0", 27 | "_release": "4.4.0", 28 | "_resolution": { 29 | "type": "version", 30 | "tag": "v4.4.0", 31 | "commit": "f2cc73da12f0e6d828bc2daaa72bff457067bf39" 32 | }, 33 | "_source": "git://github.com/FortAwesome/Font-Awesome.git", 34 | "_target": "~4.4.0", 35 | "_originalSource": "fontawesome", 36 | "_direct": true 37 | } -------------------------------------------------------------------------------- /themes/nextNew/source/vendors/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/nextNew/source/vendors/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 | -------------------------------------------------------------------------------- /themes/nextNew/source/vendors/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 | Fonticons (https://fonticons.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/nextNew/source/vendors/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/nextNew/source/vendors/font-awesome/fonts/FontAwesome.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhangjh/hello-blog/a0fffc86c231ed109203492e8cfdd5098db58e66/themes/nextNew/source/vendors/font-awesome/fonts/FontAwesome.otf -------------------------------------------------------------------------------- /themes/nextNew/source/vendors/font-awesome/fonts/fontawesome-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhangjh/hello-blog/a0fffc86c231ed109203492e8cfdd5098db58e66/themes/nextNew/source/vendors/font-awesome/fonts/fontawesome-webfont.eot -------------------------------------------------------------------------------- /themes/nextNew/source/vendors/font-awesome/fonts/fontawesome-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhangjh/hello-blog/a0fffc86c231ed109203492e8cfdd5098db58e66/themes/nextNew/source/vendors/font-awesome/fonts/fontawesome-webfont.ttf -------------------------------------------------------------------------------- /themes/nextNew/source/vendors/font-awesome/fonts/fontawesome-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhangjh/hello-blog/a0fffc86c231ed109203492e8cfdd5098db58e66/themes/nextNew/source/vendors/font-awesome/fonts/fontawesome-webfont.woff -------------------------------------------------------------------------------- /themes/nextNew/source/vendors/font-awesome/fonts/fontawesome-webfont.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhangjh/hello-blog/a0fffc86c231ed109203492e8cfdd5098db58e66/themes/nextNew/source/vendors/font-awesome/fonts/fontawesome-webfont.woff2 -------------------------------------------------------------------------------- /themes/nextNew/source/vendors/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/nextNew/source/vendors/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/nextNew/source/vendors/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/nextNew/source/vendors/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/nextNew/source/vendors/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/nextNew/source/vendors/notie/notie.min.css: -------------------------------------------------------------------------------- 1 | .notie-container{font-size:1.6rem;height:auto;left:0;position:fixed;text-align:center;width:100%;z-index:2;box-sizing:border-box;-o-box-shadow:0 0 5px 0 rgba(0,0,0,.5);-ms-box-shadow:0 0 5px 0 rgba(0,0,0,.5);box-shadow:0 0 5px 0 rgba(0,0,0,.5)}@media screen and (max-width:900px){.notie-container{font-size:1.4rem}}@media screen and (max-width:750px){.notie-container{font-size:1.2rem}}@media screen and (max-width:400px){.notie-container{font-size:1rem}}.notie-background-success{background-color:#57bf57}.notie-background-warning{background-color:#d6a14d}.notie-background-error{background-color:#e1715b}.notie-background-info{background-color:#4d82d6}.notie-background-neutral{background-color:#a0a0a0}.notie-background-overlay{background-color:#fff}.notie-textbox{color:#fff;padding:20px}.notie-textbox-inner{margin:0 auto;max-width:900px}.notie-overlay{height:100%;left:0;opacity:0;position:fixed;top:0;width:100%;z-index:1}.notie-button{cursor:pointer}.notie-button,.notie-element{color:#fff;padding:10px}.notie-element-half{width:50%}.notie-element-half,.notie-element-third{display:inline-block;box-sizing:border-box}.notie-element-third{width:33.3333%}.notie-alert{cursor:pointer}.notie-input-field{background-color:#fff;border:0;font-family:inherit;font-size:inherit;outline:0;padding:10px;text-align:center;width:100%;box-sizing:border-box}.notie-select-choice-repeated{border-bottom:1px solid hsla(0,0%,100%,.2);box-sizing:border-box}.notie-date-selector-inner{margin:0 auto;max-width:900px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;-o-user-select:none;user-select:none}.notie-date-selector-inner [contenteditable],.notie-date-selector-inner [contenteditable]:focus{outline:0 solid transparent}.notie-date-selector-up{transform:rotate(180deg)} -------------------------------------------------------------------------------- /themes/nextNew/source/vendors/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/nextNew/source/vendors/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/nextNew/test/.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "curly": true, 3 | "eqnull": true, 4 | "eqeqeq": true, 5 | "undef": true, 6 | "newcap": true, 7 | "undef": true, 8 | "unused": true, 9 | "laxcomma": false, 10 | "asi": false, 11 | "expr": true, 12 | "loopfunc": false, 13 | "strict": false, 14 | 15 | "globals": { 16 | "define": true, 17 | "require": true, 18 | "it": true, 19 | "module": true, 20 | "describe": true, 21 | "window": true, 22 | "$": true 23 | } 24 | } 25 | --------------------------------------------------------------------------------