设置 npm 和 yarn 的镜像源为淘宝镜像源,解决依赖下载很慢的问题。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38

# ==========================================================
# NPM
# ==========================================================

npm set registry https://r.npm.taobao.org # 注册模块镜像
npm set disturl https://npm.taobao.org/dist # node-gyp 编译依赖的 node 源码镜像

## 以下选择添加
npm set sass_binary_site https://npm.taobao.org/mirrors/node-sass # node-sass 二进制包镜像
npm set electron_mirror https://npm.taobao.org/mirrors/electron/ # electron 二进制包镜像
npm set puppeteer_download_host https://npm.taobao.org/mirrors # puppeteer 二进制包镜像
npm set chromedriver_cdnurl https://npm.taobao.org/mirrors/chromedriver # chromedriver 二进制包镜像
npm set operadriver_cdnurl https://npm.taobao.org/mirrors/operadriver # operadriver 二进制包镜像
npm set phantomjs_cdnurl https://npm.taobao.org/mirrors/phantomjs # phantomjs 二进制包镜像
npm set selenium_cdnurl https://npm.taobao.org/mirrors/selenium # selenium 二进制包镜像
npm set node_inspector_cdnurl https://npm.taobao.org/mirrors/node-inspector # node-inspector 二进制包镜像

npm cache clean --force # 清空缓存

# ==========================================================
# YARN
# ==========================================================

yarn config set registry https://r.npm.taobao.org # 注册模块镜像
yarn config set disturl https://npm.taobao.org/dist # node-gyp 编译依赖的 node 源码镜像

## 以下选择添加
yarn config set sass_binary_site https://npm.taobao.org/mirrors/node-sass # node-sass 二进制包镜像
yarn config set electron_mirror https://npm.taobao.org/mirrors/electron/ # electron 二进制包镜像
yarn config set puppeteer_download_host https://npm.taobao.org/mirrors # puppeteer 二进制包镜像
yarn config set chromedriver_cdnurl https://npm.taobao.org/mirrors/chromedriver # chromedriver 二进制包镜像
yarn config set operadriver_cdnurl https://npm.taobao.org/mirrors/operadriver # operadriver 二进制包镜像
yarn config set phantomjs_cdnurl https://npm.taobao.org/mirrors/phantomjs # phantomjs 二进制包镜像
yarn config set selenium_cdnurl https://npm.taobao.org/mirrors/selenium # selenium 二进制包镜像
yarn config set node_inspector_cdnurl https://npm.taobao.org/mirrors/node-inspector # node-inspector 二进制包镜像

yarn cache clean # 清空缓存
阅读全文 »

代码设计能力的三个阶段(写作文、图形设计或者干其他事同理): 第一阶段,缺乏设计。没有意识到代码设计的意义,或者意识到了但没有设计的能力。 第二阶段,过度设计,或者生搬硬套别人的设计。此时已经有很大进步,知道代码设计的重要性了,但是并没有理解代码设计的根本目的,觉得设计的越复杂越牛逼,实际上是让别人看不懂,甚至自己都被绕晕了,而问题并没有很好的解决。或者是强行套用别人的结论,没考虑实际情况差异。 第三阶段,用最简单优雅的方式,解决最复杂棘手的问题,正所谓大道至简。这个阶段才是真正的高手,不仅有技术实力,还懂得哲学指导思想。明白了代码设计的精髓,并不是要搞的别人看不懂,而是Don’t make me think,看的人很快就看明白了并且恍然大悟,原来头疼的问题这么简单就解决了,实在是精妙。

了解MotionEvent

MotionEvent.class自身并不实际包含Action相关的信息,只包含了一个mNativePtr,指向JNI层实际包含所有Event信息的Object。

阅读全文 »

工具安装

  1. 安装JDK

  2. 安装Git

  3. 安装android-sdk

  4. 安装Gradle(如果使用Gradle Wrapper则不需要提前安装)

  5. 安装Tomcat

  6. 安装Jenkins ver. 1.652和相关插件

    参考插件列表

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    Android Emulator Plugin
    Ant Plugin
    Credentials Plugin
    CVS Plug-in
    Email Extension Plugin
    Email Extension Template Plugin
    External Monitor Job Type Plugin
    FindBugs Plug-in
    Git client plugin
    Git plugin
    Gradle Plugin
    Javadoc Plugin
    JUnit Plugin
    LDAP Plugin
    Mailer Plugin
    Matrix Authorization Strategy Plugin
    Matrix Project Plugin
    Maven Integration plugin
    OWASP Markup Formatter Plugin
    PAM Authentication plugin
    Port Allocator Plug-in
    Role-based Authorization Strategy
    SCM API Plugin
    Script Security Plugin
    SSH Credentials Plugin
    SSH Slaves plugin
    Static Analysis Utilities
    Subversion Plug-in
    Token Macro Plugin
    Translation Assistance plugin
    Windows Slaves Plugin
    WWPass Authentication Plugin
阅读全文 »

遵循用户习惯

Don’t make me think这一思想来自交互设计人员必读书《Don’t make me think》。这本书主要讲的是针对大众用户,网页交互设计应该符合用户使用习惯,不需要过多思考就能找到自己想要的东西。

阅读全文 »

本文提出一套Android项目的资源文件命令规范,可用于大型Android项目。参考了Android系统自带资源文件的命名风格。

文中的例子只是用于示意说明,并非来自真实的项目。

阅读全文 »

过去特别是最近一年,体验了一些社交平台,做了一点研究。之所以会研究社交平台,一方面是自己作为互联网从业者,本身好奇心强、爱思考和研究,所以会去研究一些互联网产品;另一方面,自己也是社交平台的用户。

这篇文章会做一些相关内容的分析,发表一些不是很严谨的观点,也会讲一点自己和身边人经历过的故事,涉及的内容比较多,看完本文你可能会打开某些新世界的大门,也可能会对如何借助社交工具交友、找对象有更好的理解。

阅读全文 »

之前就打算验光检查一下视力,在知乎上做过一些调研,最常见的是眼镜店免费验光,往往比较随意,设备也不齐全,几分钟到十几分钟完事,以前我一直都是这么验光的;正规眼科医院一般都是有资质的验光师,设备齐全,但是医院可能会人很多于是就快速随便的验一下了,另外千万不要在医院配眼镜因为有提成非常贵;另外还有一些资历很高的验光师,看到评价挺好的一个就是宝岛眼镜古北店的马家骅师傅,据说有十几年的验光经验,所以我决定去试试。

在微信公众号里提前预约了今天下午的验光,坐车一个小时到那边,等了一会就验光了。

阅读全文 »