diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ba74660 --- /dev/null +++ b/.gitignore @@ -0,0 +1,57 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] + +# C extensions +*.so + +# Distribution / packaging +.Python +env/ +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +*.egg-info/ +.installed.cfg +*.egg + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*,cover + +# Translations +*.mo +*.pot + +# Django stuff: +*.log + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..9a9be4d --- /dev/null +++ b/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2015 python-cn + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + diff --git a/README.md b/README.md new file mode 100644 index 0000000..6c7c6e5 --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +# guide +Python-cn guidebook diff --git a/index.html b/index.html index cba1b64..d145d8f 100644 --- a/index.html +++ b/index.html @@ -13,24 +13,24 @@ + + + diff --git a/params.json b/params.json deleted file mode 100644 index d0e508c..0000000 --- a/params.json +++ /dev/null @@ -1 +0,0 @@ -{"name":"Guide","tagline":"Python-cn guidebook","body":"### Welcome to GitHub Pages.\r\nThis automatic page generator is the easiest way to create beautiful pages for all of your projects. Author your page content here using GitHub Flavored Markdown, select a template crafted by a designer, and publish. After your page is generated, you can check out the new branch:\r\n\r\n```\r\n$ cd your_repo_root/repo_name\r\n$ git fetch origin\r\n$ git checkout gh-pages\r\n```\r\n\r\nIf you're using the GitHub for Mac, simply sync your repository and you'll see the new branch.\r\n\r\n### Designer Templates\r\nWe've crafted some handsome templates for you to use. Go ahead and continue to layouts to browse through them. You can easily go back to edit your page before publishing. After publishing your page, you can revisit the page generator and switch to another theme. Your Page content will be preserved if it remained markdown format.\r\n\r\n### Rather Drive Stick?\r\nIf you prefer to not use the automatic generator, push a branch named `gh-pages` to your repository to create a page manually. In addition to supporting regular HTML content, GitHub Pages support Jekyll, a simple, blog aware static site generator written by our own Tom Preston-Werner. Jekyll makes it easy to create site-wide headers and footers without having to copy them across every page. It also offers intelligent blog support and other advanced templating features.\r\n\r\n### Authors and Contributors\r\nYou can @mention a GitHub username to generate a link to their profile. The resulting `` element will link to the contributor's GitHub Profile. For example: In 2007, Chris Wanstrath (@defunkt), PJ Hyett (@pjhyett), and Tom Preston-Werner (@mojombo) founded GitHub.\r\n\r\n### Support or Contact\r\nHaving trouble with Pages? Check out the documentation at https://help.github.com/pages or contact support@github.com and we’ll help you sort it out.\r\n","google":"","note":"Don't delete this file! It's used internally to help with page regeneration."} \ No newline at end of file diff --git a/posts/flow-and-standards.md b/posts/flow-and-standards.md index ebe4377..8b13789 100644 --- a/posts/flow-and-standards.md +++ b/posts/flow-and-standards.md @@ -1,155 +1 @@ -title: 开发流程&代码规范 -------------------------- -假如你想参与firefly的开发, 请详细阅读此文. - -### 开发流程 - -我们使用github做代码托管, code-review, 提交Issue等. - -原则: - -1. 任何人都可以fork项目. 提交pull requests. -2. 任何人都可以做code-review, 提交评价意见. 共同学习和进步 -3. 如无特殊原因, pr(pull requests)都会在3天得到回复. - -流程: - -##### fork - -从firelfly项目fork一份副本到本人项目地址下. -比如用户test fork了一个项目. 应该在https://github.com/test/firefly - -实际的URL应该是: https://github.com/python-cn/firefly#fork-destination-box - -##### clone - -clone代码到本地: - -```bash -git clone https://github.com/xxx/firefly ### xxx表示你在github的用户名 -cd firefly -``` - -##### rebase - -**这点很重要** - -所有人都不要用merge!! 会乱. 只有在github上合并别人提交的分支使用merge.个人开发都使用rebase. 具体如下 - -``` -$git remote add upstream https://github.com/python-cn/firefly # 加一个源, 就是原始地址, 以后的rebase都要和它同步 -$git pull --rebase upstream master # 这条非常重要, 每次创建新的分支, 或者在最终push之前都要执行一次. 保证你的分支和远程的库的master分支保持一致 -``` - -##### 创建分支 - -不要求git-flow之类的用法. 个人随意. 最好不要用master分支 - -``` -$git checkout -b travis-pep # 创建一个叫做travis-pep的分支 -``` - -##### 开始写代码 - -可以增加新功能/特性, 可以fix typo, 可以改bug. 要cool! - -可能有多次commit. - -``` -$git commit -am '' # 使用-a要谨慎, 你要对git很熟悉知道你在做什么, 否则还是不要加-a.使用 `git add` -``` - -##### 提交代码 - -``` -$git push origin travis-pep # 提交你的代码到你自己的仓库(origin) -``` - -##### 你觉得没有问题后,可以给项目提个pr - -但是为了保证项目质量, 要满足以下几条. 请好好看这篇文章[如何写就完美 Pull Request](http://segmentfault.com/a/1190000002575050). 简单的说: - -提交pr的时候, 如果是修改其他的人的代码, 甚至可以直接@到对方 - -1. commit massage里面要对你做的事情有描述, 多个commit的原因是**出现问题我能对你的单个commit revert** -2. commit massage不能有无聊的信息, 比如 `test`, `1`, `qwert` 这些. 请仔细写 -3. pr的描述请说的详细些, 比如介绍你本次修改要解决的问题, 最好有bug的前因后果等等. 方便别人review. 也方便一段时候后排错(你设想下, 假如是你维护一个pr写的很烂,commit很乱不知所云的人会怎么样) -4. 一个pr请只关于解决一个问题. 不要一个pr带几百行甚至更多的代码(包含三方库代码的不计入其中), review会很痛苦 -5. 请不要把commit变多, 提交前可以rebase修改下提交的记录. - -PS: 假如你的代码没有过travis是不可能会被合并的. 你能在创建好的pr页面, 最后一个commit的右边看到这个小标示. 如果绿色, 恭喜你. 如果红色, 请赶快看看为什么, 谨防被人吐槽啦 - -##### code-review - -code review其实是一个学习和提高的过程. 你可以通过review代码了解这个项目的发展. 对我经常review一些知名开源项目的pr. 但是不做评论. 只是学习. - -你可以学到更奇葩/更有效率/更漂亮的用法. 当然忍不住就要吐槽你觉得烂得用法. 但是请注意用词. 尊重别人是社区的底线了. - -我觉得可以从以下几个方面做评论: - -1. 代码不符合flake8标准 -2. 可以更漂亮的用法, 这个漂亮不是用函数式编程来炫技, 而是被大家都能看懂, 认可的用法. 比如这个功能标准库已经实现了, 可以使用python自带的一些属性让它更直观 -3. 代码性能有问题 -4. 不符合代码规范(下面会说) -5. 逻辑可以抽象 -6. 代码结构/设计模式 -... - -PS: 大家注意不要强加你认为正确地方式给别人, 有些东西属于很主观的, 没有读错的点, 能接受就好了 - -这个期间提交pr的人比较惨. 尤其是团队初期, 没有了解大家的胃口的时候, 做好足够的心理素质. 这不是在故意针对. -这些东西在你以后会产生非常好的影响, 给你养成非常好的代码习惯. 这比看书看别人的东西来的容易, 写的容易哦 - -##### 合并/拒绝代码 - -我们没有暂缓搁置这个方式. 要不然会merge到master,要不然给出理由拒绝. -为了保证社区初期的基调, 目前权限只有我一个人, 未来在看到大家能热情和能力之后我会放开. - -假如你的代码被合并了, 恭喜你成为社区贡献者的一员. 在未来说不定会有些特权或者优先提要或者参与活动会发通知之类的事情. -假如你的代码被拒绝了. 请不要气馁. 我在给其他知名项目和python标准库贡献代码的时候其实被吐槽多次, 也被拒绝/搁置了很多, 说起来一把辛酸一把泪. -我现在还经常给总是喜欢拒绝我的某些项目处理issue. 其实这属于一种程序员的特性, 但是你做的我们都会看到,我们也会记得. - - -### 关于使用第三方库 - -* 这个第三方库被star的不能太少, 除非有成员读过它的代码 -* 这个项目近期都还在维护, 我们需要它一直成长 -* 这个项目不能依赖的太多和项目无关的另外的三方库 -* 这个项目有一些功能是能被我们利用的, 而不是1,2个地方而已. 我们要统一整个项目对这样内容的处理 -* 这个项目是某领域最早出现, 我们又不可或缺的(自己实现会造很多轮子) - -但是我个人还是希望尽量不增加额外的库. - -假如满足的不超过一半, 肯定是不会被通过, 因为你可能会让大家都得适用这个模块 - -### 关于文档和注释 - -* 首先肯定要符合PEP8的要求 -* 不要写中文的注释, doc. 既然是开源的就要听取全世界的吐槽的鲜花 -* 过去有一些commit message是中文, 以后请大家不要写中文的commit信息 -* 当某段代码有很多计算或者写的逻辑很复杂, 请在这段代码简要介绍下用途, -让其他开发者不需要了解这段代码就知道它的输入和输出(就算是维护这段代码也能有个大概的了解意图) - -### 代码规范 - -「无规矩不成方圆!」 - -我坚信一个健康成长的社区,需要一帮有自己品位, 态度的维护者和开发者. 为了保证社区代码的质量, 我希望每个开发者都能遵守以下一些准则 - -#### CSS - -项目使用scss, 不能直接修改css. 这样的代码修改是不会被merge的 - -#### javascript - -请参照 [https://github.com/airbnb/javascript](https://github.com/airbnb/javascript) - -#### python - -1. 符合pep8标准 -2. http://python.net/~goodger/projects/pycon/2007/idiomatic/handout.html -3. https://google-styleguide.googlecode.com/svn/trunk/pyguide.html -4. http://www.pocoo.org/internal/styleguide/ - -更多资源请关注: http://python-cn.github.io/guide/#/post/material.md diff --git a/posts/list.md b/posts/list.md index f80b8ec..bb12863 100644 --- a/posts/list.md +++ b/posts/list.md @@ -10,9 +10,9 @@ url: new.md title: 开发流程&代码规范 url: flow-and-standards.md ------- -title: python学习之路 -url: material.md -------- title: 一个程序员的情怀(选读) url: pythonista.md ------- +title: python学习资料 +url: material.md +------- diff --git a/posts/material.md b/posts/material.md deleted file mode 100644 index 3080b47..0000000 --- a/posts/material.md +++ /dev/null @@ -1,60 +0,0 @@ -title: python学习之路 -------------------------- - -本文从初学python到高级python的一些资料和经验的汇总. - -### 初学python - -1. 《python学习手册》 -2. 《python核心编程2》 - 这本书看起来很老了, 《python核心编程3》还没有中文版. 但是对于python初学者我觉得还是有很大意义的 - -网上有些学习的手册, 因为没有看过, 不做评价. - -1. http://learnpythonthehardway.org/ -2. http://www.swaroopch.com/notes/python/ -3. http://www.slideshare.net/MattHarrison4/learn-90 - -个人建议, 先看作者python的实力. 再决定要不要读他的作品. - -初学者是最痛苦的阶段. 尤其是以前受过其他语言的熏陶. - -### 可以写一些代码片段/小程序的pythonista - -1. 《python高级编程》 - 我严重推荐 -2. http://www.slideshare.net/hongqn/python-9915982?qid=e166e94d-5f2d-458e-8052-75c4375faa4d&v=qf1&b=&from_search=15 -3. http://www.slideshare.net/vishnukraj/advanced-python-programming?qid=ecab429a-644c-4697-bc1c-be9e5f0ed0f5&v=qf1&b=&from_search=1 -3. http://python.net/~goodger/projects/pycon/2007/idiomatic/handout.html -4. 需要经常地去看python官方文档, 例子. -6. 通读http://docs.python-guide.org/ - -### 已经能利用python工作, 写过独立的python项目 - -1. 要去看看https://github.com/vinta/awesome-python和它里面的库/项目 -2. 我的一个高级编程的分享: http://www.dongwm.com/archives/fen-xiang-%5B%3F%5D-ge-zhun-bei-gei-gong-si-jiang-pythongao-ji-bian-cheng-de-slide/ -3. 应该开始读一些开源项目的代码, 比如工作中用到的. 用的更深入些. - -以下项目不错: - -1. https://github.com/kennethreitz/requests -2. https://github.com/jakubroztocil/httpie -3. https://github.com/mitsuhiko/flask -4. https://github.com/celery/celery -5. https://github.com/docopt/docopt -6. https://github.com/boto/boto -7. https://github.com/faif/python-patterns -8. https://github.com/tweepy/tweepy -9. https://github.com/avanov/Plim -10. https://github.com/getsentry/sentry # 这个和以下我都是只粗略得读过. -11. https://github.com/mitsuhiko/babel -12. https://github.com/mitsuhiko/click - -#### 再进阶(我也只是这步) - -1. 读python的标准库源代码 -2. 给python标准库贡献代码 -3. 给一些开源项目贡献代码 -4. 有能力把自己的想法实现出来 - -#### 其他资源 - -欢迎Issue. diff --git a/posts/new.md b/posts/new.md index ba1dc33..8b13789 100644 --- a/posts/new.md +++ b/posts/new.md @@ -1,61 +1 @@ -title: firefly新手引导 -------------------------- -假如你想参与firefly的开发, 请详细阅读此文. - -#### 配置环境 - -目前还没有做python3的支持, 所以需要有Python2. 个人建议使用python2.7, -因为他有更多标准库, 支持更多的语法(比如字典解析). - -开发之前需要一些依赖: - -```python -$sudo easy_install setuptools # 它里面有pip, 假如系统已经包含pip, 忽略这步 -$pip install --user virtualenv # 安装virtualenv - -PS: virtualenv是一个虚拟环境, 主要解决多python环境下依赖不相互影响的问题. -``` - -#### 初始化firfly的开发环境 - -```python -$git clone https://github.com/python-cn/firefly # 克隆代码到本地 -$cd firefly -$cp firefly/local_settings.py.example firefly/local_settings.py # local_settings.py是本地配置, 包含数据库, oauth2等不适合放入版本库敏感数据,以及对一些配置项的自定义 -$virtualenv venv # 在当前目录下生成一个venv目录, 这个目录就是你的虚拟环境 -$source venv/bin/activate # 激活环境, 如果你想从这个环境中离开, 可以执行`deactivate` -$pip install -r requirements.txt # 安装firefly的python依赖 -$pip install -r dev-requirements.txt # 安装开发依赖 -$pre-commit install -t pre-push # 假如你希望对flake8做本地检查可以安装这个git-hook. 以后每次你的push都会跑一遍对当前提交代码中的检查 -``` - -PS: pre-commit请放心使用, 代码是我写的. - -#### 前端开发 - -假如你希望能够自己向全栈方向, 或者是前端工程师或者喜欢想尝试做一些前端的开发. 建议配置本开发环境(这属于增强功能不强制) - -这个环境帮你做的: - -1. 发现目录下文件改变自动重载页面 -2. 自动根据scss文件生成css(目前是开发阶段, 没有压缩) - -环境配置 - -1. 首先需要安装node(我们会使用npm), 可以到官网 https://nodejs.org/ 下载安装 -2. 其次需要安装ruby(我们会使用gem), 可以到官网 https://www.ruby-lang.org/ 下载安装 -3. 配置firefly的开发环境 - - cd firefly/static - sudo gem install sass - npm install - node_modules/grunt-cli/bin/grunt # 如果你不喜欢占用一个终端, 可以使用tmux或者screen - -#### 启动firefly - -```python -$python manage.py runserver -p PORT # 跑在本机的PORT端口下 -## 调试model可以使用 -$python manage.py shell -``` diff --git a/posts/pythonista.md b/posts/pythonista.md index ff08c84..8b13789 100644 --- a/posts/pythonista.md +++ b/posts/pythonista.md @@ -1,74 +1 @@ -title: 一个程序员的情怀 -------------------------- -> 情怀就是以心灵的满足而不是功利的得失作为自己的行为标准的一种品质。 -> 一件没什么用的事,还是要去做,也许只因为我喜欢,也许只因为它看起来很美 -- 知乎[@宋老末](http://www.zhihu.com/people/song-lao-mo) - -「我坚信程序员都是有情怀的. 」 - -我是小明(对, 就是这个完全没有气场的昵称). 我来解释为什么想做这个社区. - -2013年5月. 我看到我的github的timeline出现[lepture](https://github.com/lepture)启动了[june](https://github.com/lepture/june)项目. 也就是现在的[python-china](http://python-china.org). -那个时候我还是一个运维. 写python一年多. 但是python只是我的部分工作语言. 那个时候我和95%的人一样, 不知道未来的路. 我不知道日后会到中国最好的用python的公司做产品开发. -我不知道我能给一些知名开源项目贡献代码. 我也无法预见到现在的自己. 当时觉得社区离我好远. 我即没有能力去做一个开发者, 也没有能力解答别人python相关的问题. - -python-china现在还是很冷清, 远没有ruby-china和cnodejs这些社区的氛围. 我发现去招聘网站上看python的相关职位, 数量确实在涨, 说明它被越来越多的人接受. -想想2013年的时候, 还大多是BAT这样的大公司可以提供python的职位. python也很受创业公司青睐, 但是不止一个创业者和我说, 其实他们不怎么想用python作为初创的语言, -原因很简单, 相同性价比下人太难招了. 我记得有一天, 一个猎头找我, 聊得过程中发现她对python有很多偏见, 它觉得中国搞python的人也就那几百个.. -虽然是个特例, 还是让我很有感触. 来豆瓣之前, 上一家公司有十多个产品线, python只有2-3个. 我都要离职了才发现, 好几个人竟然一直以为我是做ruby的. 囧 - -不记得在哪里看过, 程序员有三种表白: - -1. 拿钱干活, 不爽就换 - 程序员只是一份工作 -2. 只要能实现功能就好, 学习进步太累了. 这年代做技术没有管理挣钱多, 技术搞得再好有什么用? 还不是买不起房. 这年代关键是你认识多少人. 能不能唬住粉丝儿和投资人 -3. 热爱程序本身的人, 这些人可能只有1%, 他们有目标的写程序, 他们愿意思考, 愿意听取正确地/更好的方法, 他们会热爱学习新的东西 - Geek - -人们都会把大部分的功劳交给产品, 销售和管理者. 只是程序员这个职业情况相对还好. 虽然架构师这个位置来说, 第二种人反而更多. - -再说2个例子吧. - -1. 最开始我是做运维的, 当时在学perl, 有个经验很丰富的c++同事看我痛苦的啃那一千一百多页的<大骆驼>, 善意的告诉我: `你只是用这个语言的20%去完成80%的工作, -等你需要的时候再去查吧.` 虽然我没有听他的, 还是完整的看完了一遍这本书. 但这些年来了. 各种现实告诉我, 确实是这样的. 大量的程序员停留在被工作驾驭的阶段(也就是码农), -有时候看他们意淫扯淡, 感觉特别悲哀. 而我, 还执拗的用我的原则: 因为那80%在职场完全没有竞争力, 尤其是python这种入门很容易的语言. - -2. 还是做运维的时候, 部门4个人决定一起学python. 买了书, 立了计划. 但是最后只有我一个人学成了python, 并且现在以它为生. -我的同事们, 一个在要倒闭的公司坐着运维总监; 一个在某知名视频企业坐着高级运维工程师,上段时间说要学习java, 圈子不大, 据说有几次和他的同事指着我的网站说, 小明当年是我同事...现在python老厉害了. -还有一个离开了IT界, 回老家做建材了. - -我为一些刚入行的新同学, 和在大学时代踌踌满志的未来的新同学感到悲哀. 他们身边有大量这样的人. 人最怕的是什么,是习惯, 人是最容易产生依赖, 最容易懒惰的动物. -有时候我会和我老婆感叹, 这些年那些昔日的同事就因为类似的原因, 距离我越来越远. 但你要问我技术这条路能走多远, 能走成一个什么样的路? 我也不好说. - -我刚步入社会时候, 极为谨慎, 感觉身边的人都好厉害, 离我好远的样子. 我得慢慢地追上, 还得防止别人追上我. 一些神秘感就渐渐的没有了. -我对原来的组长说, 你看xxx写了一本书. 好Nb的样子. 我的老大特别不屑的说了一句让我铭记到现在的话: - -``` -真正技术NB的人忙着数钱, 忙着设计/改进架构, 忙着学习. 根本没空写本书 -``` - -我自己没写过太多的大型的开源项目, 尽是读人家的代码, 写人家能接受, 能认可的代码, 了解项目作者的心理, 去了解项目团队的风格. 但是其实我有自己的感想. -我经常思考, 为什么flask会火? 为什么ipython虽然star数量不高但是issue却是python项目里最高的? 为什么django的贡献者那么多? 为什么其他的社区氛围会那么好?等等. -这些答案是在你伴随一个个优秀的开源项目的开发周期, 关注了所有的pr, 讨论的过程中渐渐产生的(但是非常有可能是我自己的主观). - -早先我希望做个[ask](https://github.com/ask)(celery作者)或者[bitprophet](https://github.com/bitprophet)(fabric的作者)的人, 能力大到一个人搞定一个产品线, 一个人覆盖整个项目和他的依赖库. -但是现在我更崇拜[kennethreitz](https://github.com/kennethreitz/)(requests作者), [mitsuhiko](https://github.com/mitsuhiko)(flask作者), 有能力做这样优秀的开源项目, 带领一个社区. 而说到这里, 自认为我是个资质平庸, -只是愿意花更多的时间来对待程序员这个情怀上. 我要努力的还很多, 我虽然读过一些优秀开源项目的源码, 贡献了代码, 甚至给python标准库贡献了代码了. 但是越学习就越发现自己懂的太少, 能力有限. - -我也不希望这个社区变成我一个人, 或者一个圈子的舞台. 我希望它和豆瓣一样, 在一些人心中有一个不可或缺的位置, 给这些有能力帮助新人的人, -需要帮助的新人一个我们pythonista的豆瓣. - -做这个社区源于QQ群的随意一说. 在这里我不想讨论june的失败原因. 毕竟片面. 我这个社区其实想想也是带有很浓厚的个人情怀. 未来怎么样, 我也没有底. -我愿意尽我的能力做好. 我很愿意帮助任何python路上的同学, 我也是从`hello world`开始. 我想假如在我初学python, 进阶的时候能有这样的社区, 我会少走很多弯路, 会少很多不良的变成习惯, -更深的对python的理解. 这就是我的初衷. - -有人问我, 是什么支撑你的情怀? - -> 除了眼前的苟且,还有诗和远方 - 知乎[@戴晓溪](http://www.zhihu.com/people/dai-xiao-xi-70) - -1. 我不希望明年的今天我还写一样的代码, 唯一不一样的是我老了一岁. -2. 我不想和无知庸碌的人为伍,我不愿跟审美低下的人同行,我不能与道德缺失的人作伴.所以就得往前冲,没法停,也不会习惯停. - -我年龄越来越大, 拥有的情怀却没有褪去. - -大家一起努力吧. - -2015-04-14 diff --git a/posts/used.md b/posts/used.md index 2dd83a9..5c82405 100644 --- a/posts/used.md +++ b/posts/used.md @@ -1,95 +1,94 @@ -title: firefly用到的库/框架 +title: 基于知乎的topic树对关键词提取的简单优化 +description: +category: python +tag: python "machine learn" ------------------------- +关键词提取:即给定一个网页,一般里面是一篇文章,计算出这个页面的关键词 +可以参考这个网站:http://www.tuicool.com/ 这是一个完全由爬虫驱动的IT文章阅读网站,里面的文章来自于 +众多网站http://www.tuicool.com/sites/hot , 然后自动按照用户关注的主题推荐给用户, 整个过按官方所述是几乎全部由程序得出,几乎没有人工干预. -这篇主题就是介绍firefly用到的库/框架. 以及使用它们的原因. +jieba是pytho的一个中文分词库, 里面自带关键词提取功能,基于TextRank算法. +https://github.com/fxsjy/jieba/#3-%E5%85%B3%E9%94%AE%E8%AF%8D%E6%8F%90%E5%8F%96 -### python的 - -#### Flask - -[flask](https://github.com/mitsuhiko/flask)是社区的web框架. 我觉得django是一个很好地框架, 适合于企业级的应用, 对于社区实在太重. 其他框架需要实现的功能太多, -就没必要造轮子了(也不一定比flask已有的好). flask越来越被接受(虽然有随波逐流的人), 我来说下我的理解: - -1. [pocoo](http://www.pocoo.org/)团队是一个伟大的团队, 它的作品还包括Jinja2, Pygments, Sphinx, Werkzeug. -这实力和社区可让你让你放心使用flask. -2. flask的三方插件系统生态非常好, 每个插件代码都不多. 就算看源码也不会太浪费时间 -3. flask自带了很多有用的函数, cached_property. 它对于web开发需要做的都覆盖到了 -4. flask源码值得一读, 它的设计其实可以被借用到自己的业务里面 - 但是flask有明显的风格 - -#### MongoDB - -firefly的数据库. 选择Mongodb就是因为社区在早期可能功能特性有较大的更改, 用SQL对表结构要求太高. 而且mongodb的性能很好. - -#### mongoengine - -在使用ORM这个问题上一直有很大的争议. 我以前试验过, 使用ORM会减低3-5%的性能. 但是能让代码好看简单很多. -出现问题也很容易定位. 给想学想用它的人作为一个范例吧. - -#### plim - -firefly的模板, plim我个人觉得是一个被严重低估的基于mako的模板. 这里用它其实是示范原因. 给想用plim的人一个范例. - -#### pygments - -[pygments](https://bitbucket.org/birkenfeld/pygments-main)也是[pocoo](http://www.pocoo.org/)团队的作品, 提供各种语言的语法高亮, 他是基本所有python开源项目做语法高亮的底层库. 它有非常好的文档 -很容易自定义词法分析和格式. 他的源码也值得一读 - -它是firefly里用来配合mistune根据markdown内容渲染成带语法的html. - -#### mistune - -[mistune](https://github.com/lepture/mistune)是[lepture](https://github.com/lepture)写的markdown解析工具. 支持国货 - -### 前端的 - -#### grunt -[grunt](https://github.com/gruntjs/grunt)是一个javascript的任务处理器(用了才知道). -firefly用来做代码更改自动执行sass, 重载页面, 代码压缩等 - -#### RequireJS - -[RequireJS](http://requirejs.org)是一个用于模块/文件加载的库, 主要是大型项目中管理代码加载的库, 具体的可以看[阮一峰的介绍](http://www.ruanyifeng.com/blog/2012/11/require_js.html) - -firefly用他来管理js. - -#### CodeMirror - -[CodeMirror](https://github.com/codemirror/CodeMirror)让你可以在浏览器里面编辑代码, 支持语法高亮. -它也是ipython notebook用的库(因为对ipython notebook源码比较熟, 选择了它) - -#### highlightjs - -[highlightjs](https://highlightjs.org)是我个人博客也用到的前端语法高亮的库. -它主要用于firefly实时预览markdown编辑的文章. - - -### 以下是一些我推荐的可选的开发工具 - -#### IPython - -[IPython](https://github.com/ipython/ipython)是一个增强的python交互解释器. 它的特点我之前说过: +然后下面这个地址可以找知乎的话题列表, +http://www.zhihu.com/topic/19776749/organize/entire#anchor-children-topic +然后写个爬虫可以很轻松把所有主题下载下来,结果有几十万个 +结巴的关键词提取语料库是extra_dict/idf.txt.big 用记事本打开直接可以看到内容,格式如下 ``` -ipython notebook - 一个可以跑的在线可编辑可运行的笔记. 可以测试程序, 执行代码, 当做说明文档, 能帮助不擅长web开发的同学做出很多页面的效果, 支持markdown语法等 -自动补全 - 当我import xx的时候 我可以像用zsh一样使用Tab自动补全对应的模块/方法的名字 -magic - 它提供很很多magic的函数命令, 比如你可以直接执行ls, pwd等. 还能使用其他shell命令, 调用编辑器等 -它能通过?或者??帮我查看代码的注释, 接口参数等等. -它提供很多的配置选择, 可以使用内置/外部插件达到一些其他的功能, 比如autoreload - 你不需要退出ipython就能获得你已经import之后的代码修改后的效果. -它在分布计算, 数据分析上又很好的支持, ipython非常大的使用群体是科学家和算法工程师 +潛行 10.7226238216 +作案 9.19114745066 +化学剥蚀 12.5143832909 +化學剝蝕 12.5143832909 +呼拉尔 12.1089181827 +呼拉爾 12.1089181827 +赵弘殷 13.2075304714 +趙弘殷 13.2075304714 +王力宏 13.900677652 +排起来 13.2075304714 +排起來 13.2075304714 +载体 8.28390655431 +載體 8.28390655431 +眼科 8.0600359946 +厘订 11.598092559 +釐訂 11.598092559 +责任意识 10.2897597393 +責任意識 10.2897597393 +三派 11.3357282945 +风水先生 10.8096351986 +風水先生 10.8096351986 +易释文 13.2075304714 +易釋文 13.2075304714 +灵渠 10.3171587135 +靈渠 10.3171587135 +游艺厅 13.2075304714 +游藝廳 13.2075304714 +赌徒 9.85762638414 +賭徒 9.85762638414 +油苗 13.900677652 +斯泰因 11.598 ``` +这是一个IDF表(词频-逆文档频表) +每行后面代表该词的概率. 该概率的计算基于以下理论: +对区别文档最有意义的词语应该是那些在文档中出现频率高、而在整个语料库中的其他文档中出现频率少的词语。 +具体可以参考:[TF-IDF模型的概率解释](http://coolshell.cn/articles/8422.html) +这个值越高,代表这个词在某篇文章出现了并越能反映这篇文章的主题. +然后我们就想办法把知乎的这个主题表利用起来. + +可以简单的按照每个话题的级别指定概率,处于话题树的最底层,应该给予的概率越高。为了是结果明显,我给出的范围10-25, 意味着知乎大部分的话题概率都比结巴自带词库的高。 +我写了一个简单的爬虫爬下来新浪的几篇博客(http://git.oschina.net/wkc/lda-learn/blob/master/sina-blog-download.py), +然后这是用结巴自带词库的结果: http://git.oschina.net/wkc/lda-learn/blob/master/result_origin.txt +然后这是用知乎话题库的结果: +http://git.oschina.net/wkc/lda-learn/blob/master/result_zhihu.txt + +再来个对照(格式说明:machine为算法结果,origi为博主自己加的标签): +``` +自带: +url: http://blog.sina.com.cn/s/blog_c6d19cf60102v9fg.html?tj=1 +title: 李旭东:午评分析(12月10日) +machine:早盘 平开 cn 涨停 活跃 板块 每日 sina 传媒 早博 环保 强势 blog 收盘 旭东 10300.60 中瑞 com 个股 涨幅 +origin:股票 李旭东 个股 涨停 午评 + +知乎: +url: http://blog.sina.com.cn/s/blog_c6d19cf60102v9fg.html?tj=1 +title: 李旭东:午评分析(12月10日) +machine:管理 资本运作 基金 传媒 创始人 期货 投资 金融 创业板 黄金 +origin:股票 李旭东 个股 涨停 午评 + + +自带: +url: http://blog.sina.com.cn/s/blog_4a17027b0102v7i4.html?tj=1 +title: 深扒《甄嬛传》十大美嫔艳妃婚恋现状 +machine:蒋欣 姑姑 孙俪 热依扎 恋情 贵人 热播 现实 华妃 男友 戏份 婚恋 虽然 倍受 陈思斯 绯闻 蔡少芬 女友 张晓龙 妃嫔 +origin:甄嬛传 妃嫔 婚恋 孙俪 蔡少芬 + +知乎: +url: http://blog.sina.com.cn/s/blog_4a17027b0102v7i4.html?tj=1 +title: 深扒《甄嬛传》十大美嫔艳妃婚恋现状 +machine:结婚 幸福 网店 节目 怀孕 演员 +origin:甄嬛传 妃嫔 婚恋 孙俪 蔡少芬 -#### flake8 - -[flake8](https://github.com/PyCQA/flake8)它是pyflakes+pep8, 对python做代码检查. firefly强制要求需要通过flake8检查 - -#### autopep8 - -如果你很懒, 或者发现pep8的错误看不懂, 不知道怎么修改. [autopep8](https://github.com/hhatto/autopep8)能自动帮你设置成符合pep8标准的代码. - -但是请注意, autopep8的代码基于pep8. 但是只是pep8检查的一个子集. 不能检查所有的问题. 比如E501 - -####pre-commit +``` +可以看到结果好了很多, 我们成功以极小的成本优化了关键词提取算法的准确率。 -[pre-commit](https://github.com/pre-commit/pre-commit)是Yelp开源的一个小工具. 他是git的一个hook. -就是在你push或者commit的时候自动对你本次提交做一些检查. 我认为类似flake8的错误可以本地避免, -没必要去跑CI时候才发现问题. +代码:http://git.oschina.net/wkc/lda-learn/ diff --git a/posts/welcome.md b/posts/welcome.md index d3a2daf..8b13789 100644 --- a/posts/welcome.md +++ b/posts/welcome.md @@ -1,30 +1 @@ -title: 欢迎入伙 -------------------------- -「欢迎入伙!」 - -假如你刚来到这里, 很荣幸我能给你介绍下这个社区, 以及[firefly](https://github.com/python-cn/firefly). -我想很多人在工作中会用python, 甚至python是你的主要工作语言. 但是你还是会遇到瓶颈, 比如python怎么提高? -我每天只面对了工作中需要的那部分知识, 框架, 库. 但是外面的世界还是很美丽的, 其他人用的东西和用法或许能给你不少的提示 - -如果你很年轻, 很有想法, 有些想要写的东西, 但是项目又有点大, 一个人很难搞出来. 而且在公司得不到锻炼和实践. 欢迎来这里. 说不定这里也有对它们 -有兴趣的人. 大家可以共同学习, 提高. 写些东西出来. - -我们欢迎python各阶段的用户, 也包括想学python, 但是却还不会的python的人(这里没有培训费). 你可以选择参与, 也可以选择默默的关注, -看到一个应用从零到发布的整个过程. 我相信会让你想来试一试. - -我们不欢迎以下几种类型的用户: - -* 语言不和善的的人 -* 觉得自己在python领域很牛X, 对别人从内心鄙视(我不忍心用那个2个字的词)的人 -* 满满地负能量的人 -* 不愿意分享和提问, 只会意淫扯淡的人 -* 真的认为PHP是最好语言的人(口水仗最后的结果就是谁也没服谁) - - -目前想做的一些东西: - -1. 一个有社交元素的python社区(firefly) -2. 给[pythoncn-slack](https://pythoncn.slack.com)写个被调戏的机器人 -3. 用react重写本手册 -4. 一个使用markdown可预览的博客应用 diff --git a/static/github.css b/static/github.css index 9cc3341..5841191 100644 --- a/static/github.css +++ b/static/github.css @@ -397,6 +397,18 @@ sub { color: #999; background-color: #EAF2F5; } +.type-csharp .highlight .k, .type-csharp .highlight .kt { + color: #00F; } +.type-csharp .highlight .nf { + color: #000; + font-weight: normal; } +.type-csharp .highlight .nc { + color: #2B91AF; } +.type-csharp .highlight .nn { + color: #000; } +.type-csharp .highlight .s, .type-csharp .highlight .sc { + color: #A31515; } + body.dark #wrapper { background: transparent !important; box-shadow: none !important; diff --git a/static/main.js b/static/main.js index 7a32734..51ec33b 100644 --- a/static/main.js +++ b/static/main.js @@ -12,14 +12,7 @@ return scope.$watch((function() { return ngModel.$modelValue; }), function(newValue) { - if (newValue) { - return element.html(marked(newValue)); - } else { - return element.html('
' + - '
' + - '
' + - '
'); - } + return element.html(marked((newValue ? newValue : "# loading..."))); }); } }; @@ -39,6 +32,8 @@ templateUrl: "/template/home.html" }).when("/post/:name", { templateUrl: "/template/post.html" + }).when("/page/:name", { + templateUrl: "/template/post.html" }).otherwise({ redirectTo: "/" }); diff --git a/static/style.css b/static/style.css index e719e3d..0930fde 100644 --- a/static/style.css +++ b/static/style.css @@ -315,7 +315,7 @@ a { color: rgb(75, 113, 151); } -.pythoncn-label, .firefly-label, .slack-label, .tb-label { +.pythoncn-label, .firefly-label, .slack-label { width: 15px; height: 15px; display: inline-block; @@ -323,10 +323,6 @@ a { border-radius: 3px; } -.tb-label { - background: #6699ff; -} - .pythoncn-label { background: #41ccb4; } @@ -377,70 +373,3 @@ a { } } - -.sk-spinner-chasing-dots.sk-spinner { - margin: 0 auto; - width: 40px; - height: 40px; - position: relative; - text-align: center; - -webkit-animation: sk-chasingDotsRotate 2s infinite linear; - animation: sk-chasingDotsRotate 2s infinite linear; } -.sk-spinner-chasing-dots .sk-dot1, .sk-spinner-chasing-dots .sk-dot2 { - width: 60%; - height: 60%; - display: inline-block; - position: absolute; - top: 0; - background-color: #333; - border-radius: 100%; - -webkit-animation: sk-chasingDotsBounce 2s infinite ease-in-out; - animation: sk-chasingDotsBounce 2s infinite ease-in-out; } -.sk-spinner-chasing-dots .sk-dot2 { - top: auto; - bottom: 0px; - -webkit-animation-delay: -1s; - animation-delay: -1s; } - -@-webkit-keyframes sk-chasingDotsRotate { - 100% { - -webkit-transform: rotate(360deg); - transform: rotate(360deg); } } - -@keyframes sk-chasingDotsRotate { - 100% { - -webkit-transform: rotate(360deg); - transform: rotate(360deg); } } - -@-webkit-keyframes sk-chasingDotsBounce { - 0%, 100% { - -webkit-transform: scale(0); - transform: scale(0); } - - 50% { - -webkit-transform: scale(1); - transform: scale(1); } } - -@keyframes sk-chasingDotsBounce { - 0%, 100% { - -webkit-transform: scale(0); - transform: scale(0); } - - 50% { - -webkit-transform: scale(1); - transform: scale(1); } } - -.ng-pristine { - min-height: 50px; -} - -.warn { - background: none repeat scroll 0 0 rgb(37, 42, 58); - border-radius: 3px; - color: #fff; - padding: 0.3em 1em; -} - -.warn a { - color: #1b98f8; -} \ No newline at end of file diff --git a/stylesheets/github-light.css b/stylesheets/github-light.css deleted file mode 100644 index 10f40a4..0000000 --- a/stylesheets/github-light.css +++ /dev/null @@ -1,115 +0,0 @@ -/* - Copyright 2014 GitHub Inc. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - -*/ - -.pl-c /* comment */ { - color: #969896; -} - -.pl-c1 /* constant, markup.raw, meta.diff.header, meta.module-reference, meta.property-name, support, support.constant, support.variable, variable.other.constant */, -.pl-s .pl-v /* string variable */ { - color: #0086b3; -} - -.pl-e /* entity */, -.pl-en /* entity.name */ { - color: #795da3; -} - -.pl-s .pl-s1 /* string source */, -.pl-smi /* storage.modifier.import, storage.modifier.package, storage.type.java, variable.other, variable.parameter.function */ { - color: #333; -} - -.pl-ent /* entity.name.tag */ { - color: #63a35c; -} - -.pl-k /* keyword, storage, storage.type */ { - color: #a71d5d; -} - -.pl-pds /* punctuation.definition.string, string.regexp.character-class */, -.pl-s /* string */, -.pl-s .pl-pse .pl-s1 /* string punctuation.section.embedded source */, -.pl-sr /* string.regexp */, -.pl-sr .pl-cce /* string.regexp constant.character.escape */, -.pl-sr .pl-sra /* string.regexp string.regexp.arbitrary-repitition */, -.pl-sr .pl-sre /* string.regexp source.ruby.embedded */ { - color: #183691; -} - -.pl-v /* variable */ { - color: #ed6a43; -} - -.pl-id /* invalid.deprecated */ { - color: #b52a1d; -} - -.pl-ii /* invalid.illegal */ { - background-color: #b52a1d; - color: #f8f8f8; -} - -.pl-sr .pl-cce /* string.regexp constant.character.escape */ { - color: #63a35c; - font-weight: bold; -} - -.pl-ml /* markup.list */ { - color: #693a17; -} - -.pl-mh /* markup.heading */, -.pl-mh .pl-en /* markup.heading entity.name */, -.pl-ms /* meta.separator */ { - color: #1d3e81; - font-weight: bold; -} - -.pl-mq /* markup.quote */ { - color: #008080; -} - -.pl-mi /* markup.italic */ { - color: #333; - font-style: italic; -} - -.pl-mb /* markup.bold */ { - color: #333; - font-weight: bold; -} - -.pl-md /* markup.deleted, meta.diff.header.from-file */ { - background-color: #ffecec; - color: #bd2c00; -} - -.pl-mi1 /* markup.inserted, meta.diff.header.to-file */ { - background-color: #eaffea; - color: #55a532; -} - -.pl-mdr /* meta.diff.range */ { - color: #795da3; - font-weight: bold; -} - -.pl-mo /* meta.output */ { - color: #1d3e81; -} diff --git a/stylesheets/normalize.css b/stylesheets/normalize.css deleted file mode 100644 index 30366a6..0000000 --- a/stylesheets/normalize.css +++ /dev/null @@ -1,424 +0,0 @@ -/*! normalize.css v3.0.2 | MIT License | git.io/normalize */ - -/** - * 1. Set default font family to sans-serif. - * 2. Prevent iOS text size adjust after orientation change, without disabling - * user zoom. - */ - -html { - font-family: sans-serif; /* 1 */ - -ms-text-size-adjust: 100%; /* 2 */ - -webkit-text-size-adjust: 100%; /* 2 */ -} - -/** - * Remove default margin. - */ - -body { - margin: 0; -} - -/* HTML5 display definitions - ========================================================================== */ - -/** - * Correct `block` display not defined for any HTML5 element in IE 8/9. - * Correct `block` display not defined for `details` or `summary` in IE 10/11 - * and Firefox. - * Correct `block` display not defined for `main` in IE 11. - */ - -article, -aside, -details, -figcaption, -figure, -footer, -header, -hgroup, -main, -menu, -nav, -section, -summary { - display: block; -} - -/** - * 1. Correct `inline-block` display not defined in IE 8/9. - * 2. Normalize vertical alignment of `progress` in Chrome, Firefox, and Opera. - */ - -audio, -canvas, -progress, -video { - display: inline-block; /* 1 */ - vertical-align: baseline; /* 2 */ -} - -/** - * Prevent modern browsers from displaying `audio` without controls. - * Remove excess height in iOS 5 devices. - */ - -audio:not([controls]) { - display: none; - height: 0; -} - -/** - * Address `[hidden]` styling not present in IE 8/9/10. - * Hide the `template` element in IE 8/9/11, Safari, and Firefox < 22. - */ - -[hidden], -template { - display: none; -} - -/* Links - ========================================================================== */ - -/** - * Remove the gray background color from active links in IE 10. - */ - -a { - background-color: transparent; -} - -/** - * Improve readability when focused and also mouse hovered in all browsers. - */ - -a:active, -a:hover { - outline: 0; -} - -/* Text-level semantics - ========================================================================== */ - -/** - * Address styling not present in IE 8/9/10/11, Safari, and Chrome. - */ - -abbr[title] { - border-bottom: 1px dotted; -} - -/** - * Address style set to `bolder` in Firefox 4+, Safari, and Chrome. - */ - -b, -strong { - font-weight: bold; -} - -/** - * Address styling not present in Safari and Chrome. - */ - -dfn { - font-style: italic; -} - -/** - * Address variable `h1` font-size and margin within `section` and `article` - * contexts in Firefox 4+, Safari, and Chrome. - */ - -h1 { - font-size: 2em; - margin: 0.67em 0; -} - -/** - * Address styling not present in IE 8/9. - */ - -mark { - background: #ff0; - color: #000; -} - -/** - * Address inconsistent and variable font size in all browsers. - */ - -small { - font-size: 80%; -} - -/** - * Prevent `sub` and `sup` affecting `line-height` in all browsers. - */ - -sub, -sup { - font-size: 75%; - line-height: 0; - position: relative; - vertical-align: baseline; -} - -sup { - top: -0.5em; -} - -sub { - bottom: -0.25em; -} - -/* Embedded content - ========================================================================== */ - -/** - * Remove border when inside `a` element in IE 8/9/10. - */ - -img { - border: 0; -} - -/** - * Correct overflow not hidden in IE 9/10/11. - */ - -svg:not(:root) { - overflow: hidden; -} - -/* Grouping content - ========================================================================== */ - -/** - * Address margin not present in IE 8/9 and Safari. - */ - -figure { - margin: 1em 40px; -} - -/** - * Address differences between Firefox and other browsers. - */ - -hr { - box-sizing: content-box; - height: 0; -} - -/** - * Contain overflow in all browsers. - */ - -pre { - overflow: auto; -} - -/** - * Address odd `em`-unit font size rendering in all browsers. - */ - -code, -kbd, -pre, -samp { - font-family: monospace, monospace; - font-size: 1em; -} - -/* Forms - ========================================================================== */ - -/** - * Known limitation: by default, Chrome and Safari on OS X allow very limited - * styling of `select`, unless a `border` property is set. - */ - -/** - * 1. Correct color not being inherited. - * Known issue: affects color of disabled elements. - * 2. Correct font properties not being inherited. - * 3. Address margins set differently in Firefox 4+, Safari, and Chrome. - */ - -button, -input, -optgroup, -select, -textarea { - color: inherit; /* 1 */ - font: inherit; /* 2 */ - margin: 0; /* 3 */ -} - -/** - * Address `overflow` set to `hidden` in IE 8/9/10/11. - */ - -button { - overflow: visible; -} - -/** - * Address inconsistent `text-transform` inheritance for `button` and `select`. - * All other form control elements do not inherit `text-transform` values. - * Correct `button` style inheritance in Firefox, IE 8/9/10/11, and Opera. - * Correct `select` style inheritance in Firefox. - */ - -button, -select { - text-transform: none; -} - -/** - * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio` - * and `video` controls. - * 2. Correct inability to style clickable `input` types in iOS. - * 3. Improve usability and consistency of cursor style between image-type - * `input` and others. - */ - -button, -html input[type="button"], /* 1 */ -input[type="reset"], -input[type="submit"] { - -webkit-appearance: button; /* 2 */ - cursor: pointer; /* 3 */ -} - -/** - * Re-set default cursor for disabled elements. - */ - -button[disabled], -html input[disabled] { - cursor: default; -} - -/** - * Remove inner padding and border in Firefox 4+. - */ - -button::-moz-focus-inner, -input::-moz-focus-inner { - border: 0; - padding: 0; -} - -/** - * Address Firefox 4+ setting `line-height` on `input` using `!important` in - * the UA stylesheet. - */ - -input { - line-height: normal; -} - -/** - * It's recommended that you don't attempt to style these elements. - * Firefox's implementation doesn't respect box-sizing, padding, or width. - * - * 1. Address box sizing set to `content-box` in IE 8/9/10. - * 2. Remove excess padding in IE 8/9/10. - */ - -input[type="checkbox"], -input[type="radio"] { - box-sizing: border-box; /* 1 */ - padding: 0; /* 2 */ -} - -/** - * Fix the cursor style for Chrome's increment/decrement buttons. For certain - * `font-size` values of the `input`, it causes the cursor style of the - * decrement button to change from `default` to `text`. - */ - -input[type="number"]::-webkit-inner-spin-button, -input[type="number"]::-webkit-outer-spin-button { - height: auto; -} - -/** - * 1. Address `appearance` set to `searchfield` in Safari and Chrome. - * 2. Address `box-sizing` set to `border-box` in Safari and Chrome - * (include `-moz` to future-proof). - */ - -input[type="search"] { - -webkit-appearance: textfield; /* 1 */ /* 2 */ - box-sizing: content-box; -} - -/** - * Remove inner padding and search cancel button in Safari and Chrome on OS X. - * Safari (but not Chrome) clips the cancel button when the search input has - * padding (and `textfield` appearance). - */ - -input[type="search"]::-webkit-search-cancel-button, -input[type="search"]::-webkit-search-decoration { - -webkit-appearance: none; -} - -/** - * Define consistent border, margin, and padding. - */ - -fieldset { - border: 1px solid #c0c0c0; - margin: 0 2px; - padding: 0.35em 0.625em 0.75em; -} - -/** - * 1. Correct `color` not being inherited in IE 8/9/10/11. - * 2. Remove padding so people aren't caught out if they zero out fieldsets. - */ - -legend { - border: 0; /* 1 */ - padding: 0; /* 2 */ -} - -/** - * Remove default vertical scrollbar in IE 8/9/10/11. - */ - -textarea { - overflow: auto; -} - -/** - * Don't inherit the `font-weight` (applied by a rule above). - * NOTE: the default cannot safely be changed in Chrome and Safari on OS X. - */ - -optgroup { - font-weight: bold; -} - -/* Tables - ========================================================================== */ - -/** - * Remove most spacing between table cells. - */ - -table { - border-collapse: collapse; - border-spacing: 0; -} - -td, -th { - padding: 0; -} diff --git a/stylesheets/stylesheet.css b/stylesheets/stylesheet.css deleted file mode 100644 index b5f20c2..0000000 --- a/stylesheets/stylesheet.css +++ /dev/null @@ -1,245 +0,0 @@ -* { - box-sizing: border-box; } - -body { - padding: 0; - margin: 0; - font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif; - font-size: 16px; - line-height: 1.5; - color: #606c71; } - -a { - color: #1e6bb8; - text-decoration: none; } - a:hover { - text-decoration: underline; } - -.btn { - display: inline-block; - margin-bottom: 1rem; - color: rgba(255, 255, 255, 0.7); - background-color: rgba(255, 255, 255, 0.08); - border-color: rgba(255, 255, 255, 0.2); - border-style: solid; - border-width: 1px; - border-radius: 0.3rem; - transition: color 0.2s, background-color 0.2s, border-color 0.2s; } - .btn + .btn { - margin-left: 1rem; } - -.btn:hover { - color: rgba(255, 255, 255, 0.8); - text-decoration: none; - background-color: rgba(255, 255, 255, 0.2); - border-color: rgba(255, 255, 255, 0.3); } - -@media screen and (min-width: 64em) { - .btn { - padding: 0.75rem 1rem; } } - -@media screen and (min-width: 42em) and (max-width: 64em) { - .btn { - padding: 0.6rem 0.9rem; - font-size: 0.9rem; } } - -@media screen and (max-width: 42em) { - .btn { - display: block; - width: 100%; - padding: 0.75rem; - font-size: 0.9rem; } - .btn + .btn { - margin-top: 1rem; - margin-left: 0; } } - -.page-header { - color: #fff; - text-align: center; - background-color: #159957; - background-image: linear-gradient(120deg, #155799, #159957); } - -@media screen and (min-width: 64em) { - .page-header { - padding: 5rem 6rem; } } - -@media screen and (min-width: 42em) and (max-width: 64em) { - .page-header { - padding: 3rem 4rem; } } - -@media screen and (max-width: 42em) { - .page-header { - padding: 2rem 1rem; } } - -.project-name { - margin-top: 0; - margin-bottom: 0.1rem; } - -@media screen and (min-width: 64em) { - .project-name { - font-size: 3.25rem; } } - -@media screen and (min-width: 42em) and (max-width: 64em) { - .project-name { - font-size: 2.25rem; } } - -@media screen and (max-width: 42em) { - .project-name { - font-size: 1.75rem; } } - -.project-tagline { - margin-bottom: 2rem; - font-weight: normal; - opacity: 0.7; } - -@media screen and (min-width: 64em) { - .project-tagline { - font-size: 1.25rem; } } - -@media screen and (min-width: 42em) and (max-width: 64em) { - .project-tagline { - font-size: 1.15rem; } } - -@media screen and (max-width: 42em) { - .project-tagline { - font-size: 1rem; } } - -.main-content :first-child { - margin-top: 0; } -.main-content img { - max-width: 100%; } -.main-content h1, .main-content h2, .main-content h3, .main-content h4, .main-content h5, .main-content h6 { - margin-top: 2rem; - margin-bottom: 1rem; - font-weight: normal; - color: #159957; } -.main-content p { - margin-bottom: 1em; } -.main-content code { - padding: 2px 4px; - font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; - font-size: 0.9rem; - color: #383e41; - background-color: #f3f6fa; - border-radius: 0.3rem; } -.main-content pre { - padding: 0.8rem; - margin-top: 0; - margin-bottom: 1rem; - font: 1rem Consolas, "Liberation Mono", Menlo, Courier, monospace; - color: #567482; - word-wrap: normal; - background-color: #f3f6fa; - border: solid 1px #dce6f0; - border-radius: 0.3rem; } - .main-content pre > code { - padding: 0; - margin: 0; - font-size: 0.9rem; - color: #567482; - word-break: normal; - white-space: pre; - background: transparent; - border: 0; } -.main-content .highlight { - margin-bottom: 1rem; } - .main-content .highlight pre { - margin-bottom: 0; - word-break: normal; } -.main-content .highlight pre, .main-content pre { - padding: 0.8rem; - overflow: auto; - font-size: 0.9rem; - line-height: 1.45; - border-radius: 0.3rem; } -.main-content pre code, .main-content pre tt { - display: inline; - max-width: initial; - padding: 0; - margin: 0; - overflow: initial; - line-height: inherit; - word-wrap: normal; - background-color: transparent; - border: 0; } - .main-content pre code:before, .main-content pre code:after, .main-content pre tt:before, .main-content pre tt:after { - content: normal; } -.main-content ul, .main-content ol { - margin-top: 0; } -.main-content blockquote { - padding: 0 1rem; - margin-left: 0; - color: #819198; - border-left: 0.3rem solid #dce6f0; } - .main-content blockquote > :first-child { - margin-top: 0; } - .main-content blockquote > :last-child { - margin-bottom: 0; } -.main-content table { - display: block; - width: 100%; - overflow: auto; - word-break: normal; - word-break: keep-all; } - .main-content table th { - font-weight: bold; } - .main-content table th, .main-content table td { - padding: 0.5rem 1rem; - border: 1px solid #e9ebec; } -.main-content dl { - padding: 0; } - .main-content dl dt { - padding: 0; - margin-top: 1rem; - font-size: 1rem; - font-weight: bold; } - .main-content dl dd { - padding: 0; - margin-bottom: 1rem; } -.main-content hr { - height: 2px; - padding: 0; - margin: 1rem 0; - background-color: #eff0f1; - border: 0; } - -@media screen and (min-width: 64em) { - .main-content { - max-width: 64rem; - padding: 2rem 6rem; - margin: 0 auto; - font-size: 1.1rem; } } - -@media screen and (min-width: 42em) and (max-width: 64em) { - .main-content { - padding: 2rem 4rem; - font-size: 1.1rem; } } - -@media screen and (max-width: 42em) { - .main-content { - padding: 2rem 1rem; - font-size: 1rem; } } - -.site-footer { - padding-top: 2rem; - margin-top: 2rem; - border-top: solid 1px #eff0f1; } - -.site-footer-owner { - display: block; - font-weight: bold; } - -.site-footer-credits { - color: #819198; } - -@media screen and (min-width: 64em) { - .site-footer { - font-size: 1rem; } } - -@media screen and (min-width: 42em) and (max-width: 64em) { - .site-footer { - font-size: 1rem; } } - -@media screen and (max-width: 42em) { - .site-footer { - font-size: 0.9rem; } }