Skip to content

Instantly share code, notes, and snippets.

@weinung-chiu
weinung-chiu / Dockerfile
Created August 11, 2020 14:16
docker_vol2
# 直接用 official image,可以省下很多工
FROM php:7.4.9-fpm-alpine
COPY php.ini $PHP_INI_DIR/conf.d/
# 安裝 php extensions 的神器,請務必一試!
# https://github.com/mlocati/docker-php-extension-installer
COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/bin/
RUN install-php-extensions redis mysqli xdebug
a := map[string]interface{} {"name": "Charlie", "age": 20}
b := map[string]interface{} {"name": "Charlie", "age": 20}
fmt.Printf("a: %v\nb: %v\nDeepEqual:%v\n", a, b, reflect.DeepEqual(a, b))
fmt.Printf("(%T) %v\n", b["age"], b["age"])
err := json.Unmarshal([]byte(`{"name": "Charlie", "age": 20}`), &b)
if err != nil {
panic("oops")
}
fmt.Printf("a: %v\nb: %v\nDeepEqual:%v\n", a, b, reflect.DeepEqual(a, b))
@weinung-chiu
weinung-chiu / comparison_1.go
Last active May 5, 2020 15:25
CharlieCC_JSON
a := map[string]interface{} {"name": "Charlie", "age": 20}
b := map[string]interface{} {"name": "Charlie", "age": 20}
fmt.Printf("a: %v\nb: %v\nDeepEqual:%v\n", a, b, reflect.DeepEqual(a, b))
err := json.Unmarshal([]byte(`{"name": "Charlie", "age": 20}`), &b)
if err != nil {
panic("oops")
}
fmt.Printf("a: %v\nb: %v\nDeepEqual:%v\n", a, b, reflect.DeepEqual(a, b))
@weinung-chiu
weinung-chiu / test.go
Created May 4, 2020 08:25
for CharlieCC
func main() {
//str := "能解此愁,唯有杜康!"
//str := `"{"data":"中文"}"`
str := []byte(`"{"data":"中文"}"`)
fmt.Printf("string: %s\n", str)
//fmt.Println("String length:", len([]rune(str)))
fmt.Println("String length:", len([]byte(str)))
fmt.Println(" Bytes length:", len(str))
fmt.Println("------------------------------------")
fmt.Println("cnt index rune char bytes")