Skip to content

Instantly share code, notes, and snippets.

View smallnest's full-sized avatar

smallnest smallnest

View GitHub Profile

引用源地址

语义化的版本控制 2.0.0-rc.1

在软件管理世界里存在着被称作“依赖地狱”的死亡之谷,系统规模越大,引入的程序包越多,你就越有可能在不久的将来发现自己深陷绝望之中。

在多依赖的系统中发布新版本程序包很快成为噩梦。如果依赖关系过紧密,可能面临版本控制被锁死的风险(必须对每一个依赖程序包改版才能完成某次升级)。而如果依赖关系过于松散,又无法避免版本混乱(\产生超过合理值的版本数/)。当你项目的进展由于版本控制被锁死和/或版本混乱变得不那么简便和可靠,也就意味着你正处于依赖地狱之中。

为了解决这个问题,我提议通过一些规则和约束来表述版本号如何命名及何时更新。要使此系统正常运作,你首先需要声明一个公共应用程序接口(以下简称API)。可以\以文档形式或代码形式实施/。需要注意的是,这个API必须是清晰和明确的。一旦公共API确定下来,你将通过版本号增量来描述版本修改。形如X.Y.Z(主版本号.副版本号.补丁号)这样的版本格式。通过增加补丁号来表示不影响API的错误修复,增加副版本号来表示兼容现有API的扩展/修改,而增加主版本号则表示不兼容现有API的修改。

@smallnest
smallnest / colors.xml
Last active August 29, 2015 14:14 — forked from drewis/colors.xml
<?xml version="1.0" encoding="utf-8"?>
<!-- https://gist.github.com/kalehv/bae765c756e94455ed88 -->
<resources>
<color name="red_50">#ffebee</color>
<color name="red_100">#ffcdd2</color>
<color name="red_200">#ef9a9a</color>
<color name="red_300">#e57373</color>
<color name="red_400">#ef5350</color>
<color name="red_500">#f44336</color>
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.AttributeSet;
import android.view.View;
import kafka.consumer.SimpleConsumer
import kafka.common.TopicAndPartition
import kafka.api._
import scala.annotation.tailrec
import scala.util._
object KafkaSimpleConsumerUtils {
def getLastOffset(consumer: SimpleConsumer, topic: String, partition: Int, whichTime: Long, clientName: String): Try[Long] = {
val tap = new TopicAndPartition(topic, partition)
/*
* Copyright (C) 2012 47 Degrees, LLC
* http://47deg.com
* hello@47deg.com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
package main;
message ColorGroup2 {
required int32 id = 1;
required string name = 2;
repeated string colors = 3;
}
@smallnest
smallnest / demo.go
Created September 29, 2015 05:55
go语言语法演示
/*
GoTips.go:
Golang速学速查速用代码手册
Source: github.com/coderzh/CodeTips/blob/master/GoTips.go
Author: coderzh(github.com/coderzh)
Blog: http://blog.coderzh.com
参考:《Go语言编程》
*/
@smallnest
smallnest / win32.go
Created June 21, 2016 04:30 — forked from nathan-osman/win32.go
Simple Windows GUI application written in Go
package main
import (
"log"
"syscall"
"unsafe"
)
var (
kernel32 = syscall.NewLazyDLL("kernel32.dll")
@smallnest
smallnest / hexo-migrate.js
Created June 21, 2016 07:12 — forked from morris821028/hexo-migrate.js
hexo 2.8.3 to 3.1.1 tag plugin migrate
/*
$ npm install mkdirp --save
$ node hexo-migrate.js _post/
$ cd file_migrate/_post
*/
var fs = require("fs");
var path = require("path");
var mkdirp = require("mkdirp");
function file_migrate(file_path) {
@smallnest
smallnest / rpc-tls-client.go
Created August 24, 2016 01:38 — forked from artyom/rpc-tls-client.go
Go RPC over TLS.You have to create the following keys: certs/client.crt, certs/client.key, certs/server.crt, certs/server.key. client.crt and server.crt should be signed with ca.crt, which should be concatenated to both client.crt and server.crt. It's easier to do with easy-rsa: http://openvpn.net/index.php/open-source/documentation/howto.html#pki
package main
import (
"crypto/tls"
"crypto/x509"
"log"
"net/rpc"
)
func main() {