Atom快捷键

文件切换

ctrl-shift-s 保存所有打开的文件
cmd-shift-o 打开目录
cmd-\ 显示或隐藏目录树
ctrl-0 焦点移到目录树
目录树下,使用a,m,delete来增加,修改和删除
cmd-tcmd-p 查找文件
cmd-b 在打开的文件之间切换
cmd-shift-b 只搜索从上次git commit后修改或者新增的文件

导航

(等价于上下左右)
ctrl-p 前一行
ctrl-n 后一行
ctrl-f 前一个字符
ctrl-b 后一个字符

alt-B, alt-left 移动到单词开始
alt-F, alt-right 移动到单词末尾

cmd-right, ctrl-E 移动到一行结束
cmd-left, ctrl-A 移动到一行开始

cmd-up 移动到文件开始
cmd-down 移动到文件结束

ctrl-g 移动到指定行 row:column 处

cmd-r 在方法之间跳转

程序员如何提高影响力?

影响力,让梦想离你更近。

试想一下,有一天你开发了一个新的语言。它比现有的某某主流软件,运行效率将提高了50%,开发效率提高了100%。接着,你在github上release了0.1,但是由于出现某个开发难题,你需要别人的帮助。而这时,你找不到有效的途径去找到那些真正会用它的人。接着出现了一个新的语言可以达到一样的效果,而这个项目就死于腹中,我记得mruby刚刚只写了一个README.md的时候,就获得了上千个star。

如何提高影响力,为自己代言

impact

每个人都可以是一个品牌,对于一个程序员来说,我们的ID就是我们的品牌。而构成品牌的有多个要素:

  • 博客
  • Github
  • Weibo(or Twitter)
  • StackOverflow(or SegmentFault, Zhihu)

等等。

搭建一个跨平台的平台

连接各个平台的核心是我们的ID。

第一个平台指的是不同的网站,如我们的博客、Github、知乎等等,第二个平台指的是我们的影响力。

So,在开始的时候我们需要有一个统一的ID,来标识我们的身份:我是谁,你在xx网站上看到的那个xx就是我。刚开始的时候,我在CSDN、Github上的ID(gmszone)和我的博客的域名(Phodal)是不一样的,因为当时的域名(gmszone.com)握在别人的手上,于是我便想办法将两个ID改了过来(ps: github提供迁移)。后来,Phodal就成了我的发声平台:

于是,这时就可以开始使用跨平台的平台了。

用Tornado试玩新浪微博开放平台 API

Tornado 作为一个 Python 的异步非阻塞服务器与轻量级 Web 框架, 相当令人着迷. 为了体验一把 OAuth2.0 认证, 我用 Tornado 搭建了一个网站, 调用新浪微博 API. 新浪微博的 OAuth2.0 认证的顺序如下:

  • 用户访问客户端, 客户端把用户带到新浪认证服务器去输用户名密码;
  • 新浪认证服务器认证完毕后, 将用户带到客户端某指定页面, 给这个页面传递一个 GET 参数 code;
  • 客户端某指定页面接收到 code 之后, 后台发起对新浪API服务器的POST请求, 用 code 换取 access_token;
  • 得到 access_token 后, 就可以用来调用各种需要用户登录之后才能调用的 API 了.

下面简单说明在 Python 3 下用 Tornado 如何完成上述四个步骤.

不要在setting中import太多东西

这篇文章讲了一个挺有意思的问题, 结合south和django使用时要注意下.(还好django1.7以上的版本似乎用不到south了)

One of our production Django sites broke this afternoon with a database error “relation xyz doesn’t exist”. So: a missing table.

Why 1

I helped debugging it and eventually found the cause by doing a select * from south_migrationhistory. This lists the south migrations and lo and behold, a migration had just been applied 25 minutes earlier. The migration name suggested a rename of tables, which of course matches the “missing table” error.

Why 2

Cause found. But you have to ask yourself “why” again. So: “why was this migration applied?”.

Well, someone was working on a bit of database cleanup and refactoring. Naming consistency, proper use of permissions, that sort of thing. Of course, locally in a branch. And on a development database. Now why did the local command result in a migration on the production database?

Why 3

So, effectively, “why don’t the development settings work as intended”? We normally use settings.py as the production settings and a developmentsettings.py that is used in development. It imports from settings.py and sets the debug mode and development database and so.

This project is a bit different in that there’s only a settings.py. It does however try to import localsettings.py. This is generated for you when you set up your project environment with ansible. A bit less clear (in my opinion) than a real .py file in your github repository, but it works. We saw the generated localsettings file with development database and DEBUG = True. This wasn’t the cause. What then?

Normally, calling django’s diffsettings command (see the django documentation) shows you any settings errors by printing all the settings in your config that are different from Django’s defaults. In this case, nothing was wrong. The DATABASES setting was the right one with the local development database. Huh?

The developer mentioned one other thing he changed recently: importing some django signal registration module in the settings.py. Ah! Django’s signals often work on the database. Yes, the signals in this module did database work, too.

So the settings.py effectively looked like this:

DATABASES = { .... 'server': 'productiondatabase' ....}
import my_project.signal_stuff_that_works_on_the_database
try:
from .localsettings import *
# This normally sets DATABASES = { .... 'server': 'developmentdatabase' ....}
except ImportError:
pass

The import of the signal registration module apparently triggered something in Django’s database layer so that the database connection was already active. The subsequent change of the DATABASES config to the local development database didn’t have any effect anymore.

diffsettings just shows you what the settings are and doesn’t catch the fact that the DATABASES isn’t really used in the form that comes out of diffsettings.

ECMAScript 6 Features 中文版

ECMAScript 6 Features 中文版

第一遍粗译,词不达意,欢迎提 issue

采用中英混排的方式进行译制,如不解请查看对应原文

本文档将与原作者的 文档 保持同步更新,欢迎关注

Introduction 简介

ECMAScript 6 is the upcoming version of the ECMAScript standard. This standard is targeting ratification in June 2015. ES6 is a significant update to the language, and the first update to the language since ES5 was standardized in 2009. Implementation of these features in major JavaScript engines is underway now.

ECMAScript 6 是 ECMAScript 的下一代标准,预计将在 2015年6月 正式发布。ES6 的发布将是是这门语言自 2009 年 ES5 正式发布以来的首次更新,是一次富有意义的更新。Javascript核心引擎的新特性仍然在快速开发中。

See the draft ES6 standard for full specification of the ECMAScript 6 language.

这里有ES6标准草案的所有细节可以参考

ES6 includes the following new features:

python lambda教程

有很多Python的 lambda 教程. 最近我偶然发现一个, 真挺有用的. 是 Mike Driscoll 在 Mouse VS Python 博客上的关于 lambda 的讨论 .

When I first started learning Python, one of the most confusing concepts to get my head around was the lambda statement. I’m sure other new programmers get confused by it as well…

当我刚开始学习Python, 最容易困惑的概念之一, 是lambda声明. 我敢肯定, 其他新的程序员也对它很困惑, 以及…

Mike的讨论非常好:清晰, 直接, 有实用的示例. 它帮助我终于领会了lambda, 并导致我写的另一篇lambda教程.

lambda:一个用来构造函数的工具

基本上, Python的lambda是用于构造函数(或更精确地说, 函数对象)的工具. 这意味着, Python有两个构造函数的工具:def和lambda.

一切都是属性(python)

对于菜鸟来说,python中如何创建类(Class)应该是很简单的,比如:

class Foo(object):
pass

这就是python的类(很无聊对吧?). 我们也可以实例化这个类:

f = Foo()

实际上, 我们如果输出这个实例的类型,会发现它就是个类:

>>> type(f)
<class '__main__.Foo'>

Python and Flask Are Ridiculously Powerful

As a developer, I sometimes forget the power I wield. It’s easy to forget that, when something doesn’t work the way I’d like, I have the power to change it. Yesterday, I was reminded of this fact as I finally got fed up with the way payments are processed for my book. After being unhappy with the three different digital-goods payment processors I’ve used since the book came out, I took two hours and wrote my own solution using Python and Flask. That’s right. Two hours. It’s now powering my book payment processing and the flow is so incredibly simple that you can buy the book and begin reading it in 20 seconds.

Read on to find out how I created my own digital goods payment solution in an evening.

A Better Way to Learn AngularJS

Introduction

Congratulations on taking the plunge!

This AngularJS course is built with the intent of exposing you to the best available resources on each Angular topic. Our desire is to present these topics richly, and from a variety of vantage points, in order to afford you a more complete perspective on them.

This course is accompanied by AngularJS Tutorial: Learn to Build Modern Web Apps with MEAN.

The learning curve of AngularJS can be described as a hockey stick. Getting started with apps featuring basic functionality is delightfully easy. However, building more complex apps often require understanding Angular’s inner workings. Failure to do so will cause development to become awkward and cumbersome.

With AngularJS, the “Ready, Fire, Aim” learning methodology of duct taping together a handful of tutorials and a cursory glance through the documentation will lead to confusion and frustration. This curriculum is designed to properly guide you through each of the key Angular concepts thoroughly with a broad exposure to high quality content. With your eventual mastery of AngularJS, you will be able to fluently and efficiently construct large-scale applications.

Prerequisites

  • Moderate knowledge of HTML, CSS, and JavaScript
  • Basic Model-View-Controller (MVC) concepts
  • The Document Object Model (DOM)
  • JavaScript functions, events, and error handling

Resources

Since AngularJS is still in its infancy relative to other JavaScript frameworks, the number of encyclopaedic resources on it is still insufficient. Therefore, the curriculum will employ a healthy number of excellent blogs in order to offer a more meaty perspective on respective topics.

  • Required Resources
    • AngularJS - O’Reilly Media (available on Amazon)
    • John Lindquist’s egghead.io
    • AngularJS docs
  • Supplemental Resources
    • Ben Nadel blog
    • OneHungryMind
    • year of moo
    • Bruno Scopelliti blog

Part 1. Kicking the Tires

AngularJS is not a library.

Rather, it is a JavaScript framework that embraces extending HTML into a more expressive and readable format. It allows you to decorate your HTML with special markup that synchronizes with your JavaScript leaving you to write your application logic instead of manually updating views. Whether you’re looking to augment existing JavaScript applications or harness the full power of the framework to create rich and interactive SPA’s, Angular can help you write cleaner and more efficient code.
Filling the Tank

We’ve found that the egghead.io videos are the best starting resource available, so every chapter will lead off with them. The transcribed screencasts and source code are provided along with the videos. We encourage you to follow along with them, as they make the video content much more readily digestible.

As good as the egghead videos are, they should serve only as an introductory resource. Excerpts from the O’Reilly AngularJS book and the angularjs.org documentation complement the videos as the broader and more thorough source, and should be treated as the main reference for the course.
Adjusting Your Mirrors

When descending upon an entirely new topic, it is important to frame the topic correctly before diving into the minutia.

Read the following two entries in the AngularJS guide docs, they will give you a good idea of what you’re about to get into. Don’t worry about picking up on every aspect of the topics they glaze over, all of these will be covered thoroughly in subsequent lessons.

AngularJS Overview

Introduction to AngularJS
Revving the Engine

Before we get on with it, we recommend this post:

Things I Wish I Were Told About Angular.js

It goes over a handful of topics that might be helpful in building the appropriate mental models while consuming the Angular curriculum. Some, probably most, of the terms will bounce right off you until you have gone through that section of the course, but it should provide valuable context when approaching a new topic.

Now it’s off to the races!

AngularJS相关工具

AngularJS 是一组用来开发Web页面的框架、模板以及数据绑定和丰富UI组件。它支持整个开发进程,提供web应用的架构,无需进行手工DOM操作。 AngularJS很小,只有60K,兼容主流浏览器,与 jQuery 配合良好。

数据绑定可能是AngularJS最酷最实用的特性。它能够帮助你避免书写大量的初始代码从而节约开发时间。一个典型的web应用可能包含了80%的代码用来处理,查询和监听DOM。数据绑定使得代码更少,你可以专注于你的应用。
开源中国收录的 AngularJS 相关软件:

AngularJS 扩展:

当前网速较慢或者你使用的浏览器不支持博客特定功能,请尝试刷新或换用Chrome、Firefox等现代浏览器