Skip to content

Instantly share code, notes, and snippets.

John Asmuth skelterjohn

  • Google
  • New York, New York
Block or report user

Report or block skelterjohn

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:1909621
func write(localFile, remoteFile string) (err error) {
buf := bytes.NewBuffer([]byte{})
mw := multipart.NewWriter(buf)
if err = mw.WriteField("field", value); err != nil {
View gist:1184026
type SorterDefault []MyType
func (s SorterDefault) Len() int { return len(s)}
func (s SorterDefault) Swap(i, j int) { s[i], s[j] = s[j], s[i]}
type Sorter1 struct { SorterDefault }
func (s Sorter1) Less(i, j int) bool { ... }
type Sorter2 struct { SorterDefault }
View gist:1132444
package cgopkg
//#include <stdlib.h>
//#include "cgopkg.h"
import "C"
import (
func Foo() {
chi := C.CString("hi")
View gist:1125784
func Redirect(wr io.Writer, data interface{}) {
switch data.(type) {
case ElementA:
templateA.Execute(wr, data)
case ElementB:
templateB.Execute(wr, data)
View gist:1125779
{{range .Stuff}}
{{if .(ElementA)}}string:{{.X}} int:{{.Y}}{{end}}
{{if .(ElementB)}}int:{{.X}} string:{{.Y}}{{end}}
View gist:1120386
for {
select {
case <-me.stopChan:
break loop
View gist:986048
package main
import "fmt"
type MySlice []int
func main() {
s := MySlice{1,2,3,4}
for i, v := range s {
fmt.Println(i, v)
You can’t perform that action at this time.