Skip to content

Instantly share code, notes, and snippets.

View ikawaha's full-sized avatar

ikawaha ikawaha

View GitHub Profile
@ikawaha
ikawaha / gist:913dd300105e00242ba1
Created December 16, 2014 02:23
メモリの確保のされ方の確認
package main
import "fmt"
import "unsafe"
type code [4]byte
type tape []code
func main() {
var c code = code{1,2,3,4}
@ikawaha
ikawaha / show-goimport.go
Created February 5, 2015 02:22
show goimports
package main
import (
"fmt"
"go/ast"
"go/parser"
"go/token"
"os"
)
package main
import (
"fmt"
"time"
"github.com/goamz/goamz/aws"
"github.com/goamz/goamz/sqs"
"github.com/k0kubun/pp"
)
@ikawaha
ikawaha / normalize.go
Created February 10, 2016 15:09
Neologd normalizer
package neologd
import (
"bytes"
"strings"
"unicode"
"unicode/utf8"
)
const (
@ikawaha
ikawaha / bottle.go
Last active February 23, 2016 09:23
goa sample
package main
import (
"fmt"
"cellar/app"
"github.com/goadesign/goa"
)
// BottleController implements thebottle resource.
@ikawaha
ikawaha / pg_test.go
Created March 8, 2016 03:40
やっつけ
package pg_test
import (
"fmt"
"reflect"
"time"
"gopkg.in/pg.v4"
"gopkg.in/pg.v4/orm"
"gopkg.in/pg.v4/types"
@ikawaha
ikawaha / readme.md
Last active April 4, 2017 01:20
cherry-pick

(1) master の該当の差分を探しておく

$ git log|head -15
commit e4ce857d53544c2f9c3a81c5fcf4b7c7dc4bb6ce
Author: Raphaël Simon <[email protected]>
Date:   Sun Apr 2 18:01:16 2017 -0700

    Update generated file headers to match new Go standard (#1160)

 as described in https://github.com/golang/go/issues/13560
@ikawaha
ikawaha / design.go
Created April 4, 2017 07:34
KeyがEnumで制限されているHashOf
package design // The convention consists of naming the design
// package "design"
import (
. "github.com/goadesign/goa/design" // Use . imports to enable the DSL
. "github.com/goadesign/goa/design/apidsl"
)
var _ = API("cellar", func() { // API defines the microservice endpoint and
Title("The virtual wine cellar") // other global properties. There should be one
Description("A simple goa service") // and exactly one API definition appearing in
grammar ReStructedText;
file
: section+ EOF
;
section
: section_title section_content+
// | empty_line* -> /* omit line-breaks between paragraphs from AST */
;
package design
import (
. "goa.design/goa/v3/dsl"
cors "goa.design/plugins/v3/cors/dsl"
)
var _ = API("calc", func() {
Title("Calculator Service")
Description("Service for adding numbers, a Goa teaser")