Skip to content

Instantly share code, notes, and snippets.

Takayuki Sugita sugilog

Block or report user

Report or block sugilog

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
@sugilog
sugilog / sample.go
Last active Aug 29, 2015
Goroutines:ベーシック
View sample.go
package main
import (
"fmt"
"time"
)
func say( s string ) {
for i := 0; i < 5; i++ {
fmt.Println( i, s );
View src__server.go
package main
import (
"fmt"
"net/http"
"io/ioutil"
"html/template"
)
type Page struct {
@sugilog
sugilog / sample.go
Created Jan 22, 2015
簡単なHTTPサーバー
View sample.go
package main
import (
"fmt"
"net/http"
)
type String string
View sample.go
package main
import "fmt"
const (
flag0 = iota
flag1
flag2
flag3
)
@sugilog
sugilog / sample.go
Last active Aug 29, 2015
構造体へのメソッド定義
View sample.go
package main
import (
"fmt"
"math"
)
type Vertex struct {
X, Y MyFloat
}
@sugilog
sugilog / sample.go
Created Jan 4, 2015
switchの挙動
View sample.go
package main
import "fmt"
func main() {
fmt.Println( "patternA" )
patternA( 1 )
fmt.Println( "patternB" )
patternB( 1 )
}
@sugilog
sugilog / exercise.go
Created Jan 4, 2015
closureの演習
View exercise.go
package main
import "fmt"
// fibonacci is a function that returns
// a function that returns an int.
func fibonacci() func() int {
i := 0
a0 := 0
a1 := 0
@sugilog
sugilog / sample.go
Created Jan 4, 2015
クロージャのスコープ
View sample.go
package main
import (
"fmt"
"math"
)
var k float64 = 1
func main() {
@sugilog
sugilog / sample.go
Created Jan 3, 2015
mapの初期化
View sample.go
package main
import "fmt"
func main() {
printer()
variables()
}
func printer() {
View sample.go
package main
import "fmt"
func main() {
fmt.Println( "withNilMap" )
withNilMap()
fmt.Println( "withMakeMap" )
withMakeMap()
fmt.Println( "withEmptyInitMap" )
You can’t perform that action at this time.