Skip to content

Instantly share code, notes, and snippets.

View matryer's full-sized avatar
🔨
Building things at @grafana

Mat Ryer matryer

🔨
Building things at @grafana
View GitHub Profile
@matryer
matryer / example.silk.md
Created January 13, 2016 17:00
Example Silk API test file

Comments

POST /comments

Create a comment.

  • Content-Type: "application/json"
  • Accept: "application/json"
@matryer
matryer / quiz.go
Last active October 22, 2018 23:08
golanguk.com quiz
package main
import (
"fmt"
)
/*
Question:
What will be printed by this program?
{
"snippets": [
{
"match": {"global": true, "pkgname": ".", "fn": ".*_test.go"},
"snippets": [
{"text": "func Test", "title": "", "value": "func Test${1:ObjectName}${2:TestName}(t *testing.T) {\n\t$0\n}"},
{"text": "func Benchmark", "title": "", "value": "func Benchmark${1:ObjectName}${2:BenchmarkName}(b *testing.B) {\n\n\tb.StopTimer()\n\n\t$0\n\n\tb.StartTimer()\n\n\tfor i := 0; i < b.N; i++ {\n\t\t\n\t}\n\n}"},
{"text": "func Example", "title": "", "value": "func Example${1:ObjectName}${2:ExampleName}() {\n\n\t$0\n\n\t// Output:\n\t// \n\n}"}
]
},
cfg := nsq.NewConfig()
producer, err := nsq.NewProducer("127.0.0.1:4161", cfg)
if err != nil {
fatal(err)
}
producer.Publish("topic", []byte("Test"))
producer.Stop()