CSS Flex in a Nutshell

Flex, also referred as flexible box, flexbox or flex layout, is a one dimensional layout in CSS. Elements inside flexbox are placed along one axis. Compared to using position for elements arrangement, using flex is much easier. Flex elements There are two kinds of flex elements: Flex container: element with display: flex or display: inline-flex attribute. display: inline-flex makes the flex container display inline. Flex item: A direct child elements of a flex container is a flex items.

CSS Position

The CSS position property specifies how an element is positioned in dom. There are five different position values: static relative absolute sticky fixed Elements are then positioned using the top, bottom, left, z-index and right properties. Position: static This is the default position property for all elements, menas that element is positioned with normal document flow. Static positoned elements are not affected by top, bottom, left, z-index and right properties.

Git Proxy

This is, sadly, one of those China-only dev problems: “Failed to connect to github.com port 443:connection timed out” We can solve this by setting up local or global proxy for git: local: 1 2 git config http.proxy http://127.0.0.1:10809 git config https.proxy http://127.0.0.1:10809 global: 1 2 git config --global http.proxy http://127.0.0.1:10809 git config --global https.proxy http://127.0.0.1:10809 and unset respectively: 1 2 git config --unset http.

Change pip Registry in Dockerfile

Default pip resigtry is desperately slow in China. That makes building python docker image a PITA. Luckily we can config Dockerfile with a different pip registry: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 # Dockerfile # Set environment variables ENV PYTHONDONTWRITEBYTECODE 1 ENV PYTHONUNBUFFERED 1 ... # Upgrade pip then change pip registry RUN pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pip -U RUN pip config set global.

Linux Alias

Alias for current linux user Create/edit bashrc file 1 sudo vim ~/.bashrc Add aliases Add aliases content to bashrc file 1 2 3 alias tmuxat="tmux a -t" alias tmuxkill="tmux kill-session -t" alias tmuxkillall="tmux kill-session -a" Refresh current shell environment 1 source ~/.bashrc

Vim Cheatsheet

Started to learn vim from many years ago and used it on and off from time to time. I still feel it’s hard to master but fun to use. It’s frustrating that I wanted to improve my text editing speed but always stumbled for basic commands. So this time I am not aiming for complex combos, just enjoying the convenience it brings. Reicepes This is a section for common vim operations.