Skip to content

Instantly share code, notes, and snippets.

@guitong
guitong / gist:7170b79a655dd2c158da1e65290b9737
Created March 25, 2020 09:54
Compiling C++ programs with g++
Compiling C++ programs with g++
-------------------------------
The base command for the Gnu C compiler is "gcc"
The base command for the Gnu C++ compiler is "g++"
Single File Programs
--------------------
To compile a program that is in a single file, the easiest compilation
@guitong
guitong / difference-between-parsefloat-and-number.md
Last active December 21, 2018 09:37
The difference between parseFloat and Number - `parseFloat`和`Number`的区别 ?
@guitong
guitong / all-about-brew.md
Created October 24, 2018 11:42
all-about-brew

Homebrew 相关问题

brew update

方案一:直接取消执行

HOMEBREW_NO_AUTO_UPDATE=1 brew install somepkg
@guitong
guitong / so-bem-block-naming-nesting.md
Last active April 28, 2020 14:18
BEM block, naming & nesting - StackOverflow
@guitong
guitong / nth-child.md
Created June 12, 2018 07:36
CSS :nth-child

CSS 伪类 :nth-child()根据元素在一组同胞元素中的位置进行匹配。

/* Selects every fourth element among any group of siblings */
:nth-child(4n) {
    color: lime;
}

语法

@guitong
guitong / box-sizing.md
Created June 11, 2018 14:52
CSS: box-sizing

box-sizing

CSS的 box-sizing 属性定义了用户代理应该如何计算一个元素的总宽度和高度。

CSS Demo: https://codepen.io/guitong/pen/RJpMWV

在默认的 CSS 盒模型中,你分配给元素的宽度和高度仅应用于元素的_content box_。如果元素有边框(border)或者内边距(padding),则会将其添加到元素的宽度和高度,以获得元素在屏幕上渲染的框的大小。这意味着当你设置宽度和高度时,需要去调整它们的值来允许可能会添加的边框或内边距。

box-sizing属性可以被用来调整该表现:

@guitong
guitong / git-docs-reset.md
Last active May 2, 2018 04:39
git reset 指南
@guitong
guitong / difference-between-focus-and-active.md
Created April 20, 2018 09:50
What is the difference between `:focus` and `:active`?

Q: What is the difference between :focus and :active?

A: :focus:active是两种不同的状态。

:focus表示当元素是被选择接收输入设备(keyboard)的输入时的状态。:active表示当前元素正在被用户激活时的状态。

让我们来举个例子。假设我们有一个``元素,起初它不会有任何状态。它只是存在。如果我们使用Tab键将焦点移至其上,此时它将进入:focus状态。如果是点击操作(或者点击Space),它将进入`:active`状态。

@guitong
guitong / cross-env-readme-zh-cn.md
Created March 28, 2018 07:04
cross-env 简介 (README)

The problem

当你使用NODE_ENV=production设置环境变量的时候,大多数Windows命令提示行将会choke。(例外是Bash on Windows,使用原生bash)同样地,windows和POSIX环境命令使用环境变量的方式也不同。POSIX环境下,你使用:$ENV_VAR,而windows环境使用%ENV_VAR%

This solution

cross-env可以让你使用一个命令,所有环境通用。只要遵循POSIX系统风格即可。

Installation

@guitong
guitong / install-jdk-8-for-osx.md
Last active February 7, 2022 08:50
JDK 8 Installation for OS X