Skip to content

Instantly share code, notes, and snippets.

@losinggeneration
losinggeneration / muxchain_kitten.go
Created May 18, 2014 15:41
This is a fix to the muxchain kitten example in https://stephensearles.com/?p=254
func main() {
m := muxchainutil.NewMethodMux()
m.Handle("GET /kitten", http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
f, _ := os.Open("kitten.jpg")
defer f.Close()
io.Copy(w, f)
}))
http.ListenAndServe(":3000", m)
[
{
"name": "Full Size Orthorlinear",
"switchMount": "cherry",
"switchBrand": "kailh",
"switchType": "PG151101D64/D10",
"plate": true
},
[
{
@losinggeneration
losinggeneration / Gopkg.lock
Last active April 21, 2018 00:35
Viper PFlag nested binding
[[projects]]
name = "github.com/fsnotify/fsnotify"
packages = ["."]
revision = "c2828203cd70a50dcccfb2761f8b1f8ceef9a8e9"
version = "v1.4.7"
[[projects]]
branch = "master"
name = "github.com/hashicorp/hcl"
packages = [".","hcl/ast","hcl/parser","hcl/printer","hcl/scanner","hcl/strconv","hcl/token","json/parser","json/scanner","json/token"]
@losinggeneration
losinggeneration / scale1
Created June 30, 2020 18:04
String += within a loop issue
goos: linux
goarch: amd64
BenchmarkStringPlus-8 77480 132547 ns/op 1205014 B/op 1 allocs/op
BenchmarkStringPlusFmt-8 63650 124560 ns/op 1203372 B/op 3 allocs/op
BenchmarkStringBuilder-8 51845487 77.0 ns/op 185 B/op 0 allocs/op
BenchmarkStringBuilderFmt-8 7772652 146 ns/op 216 B/op 1 allocs/op