Skip to content

Instantly share code, notes, and snippets.

@lubocsu
lubocsu / Python.md
Created June 6, 2018 03:37 — forked from JeOam/Python.md
Python 环境配置

Python 环境配置: 安装 pip: A tool for installing and managing Python packages.

To install or upgrade pip, securely download get-pip.py. Then run the following (which may require administrator access):

$ sudo python get-pip.py
#Upgrade pip
$ pip install -U pip 
git config --global https.proxy http://127.0.0.1:1080
git config --global https.proxy https://127.0.0.1:1080
git config --global --unset http.proxy
git config --global --unset https.proxy
npm config delete proxy
@lubocsu
lubocsu / viewportNotes.md
Created May 3, 2018 13:10 — forked from chengmu/viewportNotes.md
viewportNotes

###device Pixel & CSS Pixel

物理像素指显示设备上的物理像素点,比如HTC G11宽是480px,这的480是用物理像素衡量的。 CSS像素的话则指我们写页面时理解的那个像素单位。可以理解为是设备自己做了一层缩放,让2个物理像素代表一个我们css里说的像素,也就是dp(设备独立像素)的概念。行业内有个约定俗成的规范,即一般这个数值是320。 有的很高密度的手机略作了调整。

想知道设备的物理像素的话,一般去取 screen.width 就可以。 但苹果只会给你dp的数值,也就是320。这个时候就得用实际上的虚拟像素数(即dp个数)乘以设备像素和css像素的比值计算出来设备像素值。

screen.width * devicePiexlRation