指针的介绍
- 指针仅仅是指向计算机中的某个地址,并带有类型限定符。
- 你可以对一个指针使用数组的语法来访问指向的东西,也可以对数组的名字做指针的算数运算。
- 你应该每次尽可能使用数组,并且按需将指针用作提升性能的手段。
指针并不是数组
无论怎么样,你都不应该把指针和数组混为一谈。它们并不是相同的东西,即使C让你以一些相同的方法来使用它们
const { EventEmitter } = require('event-emitter'); | |
function mapAsync(iterable, mapper, option) { | |
// consumer 控制 concurrency | |
} | |
function filterAsync(iterable, filterer) { | |
// promise 控制 | |
} |
#!/usr/bin/env node | |
console.log('cli application'); | |
process.on('rejectionHandled', error => { | |
throw error; | |
}); |
# go build link | |
PKG_NAME = github.com/ziyoung/repo | |
GO_LDFLAGS = -X ${PKG_NAME}/pkg.Var=123 | |
build: | |
go build -ldflags "${GO_LDFLAGS}" -o file ./some-file.go |
public class Run { | |
@Target(ElementType.PARAMETER) | |
@Retention(RetentionPolicy.RUNTIME) | |
static @interface QueryParam { | |
String value(); | |
} | |
public void testAnnotation(@QueryParam("action") String action) { | |
System.out.printf("action is %s\n", action); | |
} |
version: "3" | |
services: | |
my-db: | |
image: "mysql:5.7" | |
container_name: "my-db" | |
restart: always | |
environment: | |
MYSQL_ROOT_PASSWORD: 12345 | |
volumes: |
# https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html | |
version: '3' | |
services: | |
es01: | |
image: elasticsearch:7.2.0 | |
container_name: es01 | |
environment: | |
- node.name=es01 | |
- discovery.seed_hosts=es02 | |
- cluster.initial_master_nodes=es01,es02 |
const nodemailer = require('nodemailer'); | |
const config = require('./config.json'); | |
const wait = () => new Promise(resolve => setTimeout(resolve, 800)); | |
async function main() { | |
let transporter = nodemailer.createTransport({ | |
host: "email.example.com", | |
port: 587, | |
secure: false, // true for 465, false for other ports |
const genInlineComponentText = require('./build/md-loader/util').genInlineComponentText; | |
const template = '<el-input v-model="input" placeholder="请输入内容"></el-input>'; | |
const script = ` | |
export default { | |
data() { | |
return { | |
input: '' | |
} |
# 下面的这个命令更简洁一些,docker image ls -f "dangling=true" -q | |
IMAGES=`docker images -f "dangling=true" -q` | |
docker rmi $IMAGES | |
# 更为简洁的命令 | |
docker rmi -f $(docker images --filter "dangling=true" -q --no-trunc) |