Skip to content

Instantly share code, notes, and snippets.

View jony4's full-sized avatar
🎯
Focusing

牛强 jony4

🎯
Focusing
View GitHub Profile
@jony4
jony4 / call_user_func_array.go
Last active May 27, 2019 02:00
Likely PHP's call_user_func_array() or Javascritpt's callback(jsonObject)
package main
import (
"errors"
"fmt"
"reflect"
)
func main() {
funcs := map[string]interface{}{"foo": foo, "bar": bar}
@jony4
jony4 / time_parse_bug.go
Created September 29, 2018 07:45
go日期包,parse踩坑
package main
import (
"fmt"
"time"
)
func main() {
t1, _ := time.Parse("2006-01-01", "2010-06-05")
fmt.Println(t1)
@jony4
jony4 / ToUpperCamelCase.go
Last active January 3, 2019 09:04
go ToUpperCamelCase
var camelre = regexp.MustCompile(`_([a-z])`)
// ToUpperCamelCase is an NameFunc that converts strings from snake case to upper camel case.
func ToUpperCamelCase(s string) string {
return strings.ToUpper(string(s[0])) + camelre.ReplaceAllStringFunc(s[1:len(s)], func(s string) string {
return strings.ToUpper(s[1:len(s)])
})
}
@jony4
jony4 / git-tag-delete.go
Last active May 30, 2019 08:46
git tag batch delete local & remote
package main
import (
"bytes"
"fmt"
"log"
"os/exec"
"strings"
)
@jony4
jony4 / docker-luajit.Dockerfile
Created May 27, 2019 01:57
docker-luajit.Dockerfile
FROM alpine:3.8
MAINTAINER github.com/jony4 <niuqiang@yet-inc.com>
RUN apk add --no-cache luajit
ENTRYPOINT [ "/usr/bin/env", "luajit" ]
@jony4
jony4 / weekly.go
Created May 27, 2019 02:20
export chrome history to markdown file.
package main
import (
"bytes"
"database/sql"
"flag"
"fmt"
"io/ioutil"
"log"
"net/url"
@jony4
jony4 / suid.go
Created May 27, 2019 06:17
SUID is a simple golang library that generates concise, unambiguous, URL-safe UUIDs.You can use it as your Private Password Generator!
package suid
import (
"fmt"
"math/big"
"github.com/google/uuid"
)
const (
FROM golang:1.12.5-alpine3.9
RUN apk add --no-cache upx
@jony4
jony4 / wxmp.css
Last active July 15, 2019 01:41
Typora 自定义微信,用于公众平台主题
@charset "UTF-8";
:root {
--control-text-color: #000000;
--side-bar-bg-color: #f6f8fa
}
#write {
max-width: 860px;
margin: 0 auto;
padding: 20px;
/*自定义样式,实时生效*/
/* 全局属性
* 页边距 padding:30px;
* 全文字体 font-family:ptima-Regular;
* 英文换行 word-break:break-all;
*/
.layout {
font-family:PingFangSC-Light;
}