Skip to content

Instantly share code, notes, and snippets.

@allyraza
allyraza / bytes_split.go
Created June 15, 2020 15:11 — forked from xlab/bytes_split.go
Golang split byte slice in chunks sized by limit
func split(buf []byte, lim int) [][]byte {
var chunk []byte
chunks := make([][]byte, 0, len(buf)/lim+1)
for len(buf) >= lim {
chunk, buf = buf[:lim], buf[lim:]
chunks = append(chunks, chunk)
}
if len(buf) > 0 {
chunks = append(chunks, buf[:len(buf)])
}
@allyraza
allyraza / handler.go
Created December 10, 2018 09:29
go handler test example
package main
import (
"fmt"
"net/http"
)
type Repo interface {
GetOne() string
}
@allyraza
allyraza / .block
Last active July 12, 2018 14:42
logos
license: mit