Skip to content

Instantly share code, notes, and snippets.

Takayuki Sugita sugilog

View GitHub Profile
@sugilog
sugilog / config.abc.json
Created Mar 17, 2017
Switch Config by arg at package.json for npm run.
View config.abc.json
{
"a" : 1,
"b" : 2,
"c" : 3
}
@sugilog
sugilog / concurLoop.go
Created Dec 2, 2016
同時実行数制限付きでループを並列処理する。
View concurLoop.go
package main
import (
"fmt"
"sync"
"time"
)
func main() {
log(-1, -1)
View stdout.go
package main
import(
"fmt"
)
func main() {
chars := []string{
"A", "B", "C", "D", "E", "F", "G",
"L", "M", "Z",
View json.go
package main
import (
"fmt"
"encoding/json"
)
func main() {
var parsed map[ string ]interface{}
jsonString := []byte( `{"a":"hoge","b":1.234}` )
@sugilog
sugilog / sample.go
Created Jan 31, 2015
Channelsのselect
View sample.go
package main
import (
"fmt"
"time"
)
const CAP = 20
func main() {
@sugilog
sugilog / overflow.go
Created Jan 31, 2015
整数のオーバーフローとラップアラウンド
View overflow.go
package main
import "fmt"
func main() {
fmt.Println( "overflowIntWithLiteral" )
overflowIntWithLiteral()
fmt.Println( "overflowInt" )
overflowInt()
@sugilog
sugilog / sample1.go
Created Jan 24, 2015
Channelsのcloseとrange
View sample1.go
package main
import (
"fmt"
)
func fibonacci(n int, c chan int) {
x, y := 0, 1
for i := 0; i < n; i++ {
View sample.go
package main
import (
"fmt"
)
func main() {
channel := make( chan int, 2 )
fmt.Println( "before send" )
@sugilog
sugilog / sample.go
Created Jan 24, 2015
Goroutines:Channels
View sample.go
package main
import (
"fmt"
"time"
)
func ccounter( step int, channel chan int ) {
sum := 0
@sugilog
sugilog / sample.go
Created Jan 24, 2015
Goroutines:ポインタ
View sample.go
package main
import (
"fmt"
"time"
)
func pcounter( index int, count *int ) {
for i := 0; i < 5; i++ {
*count++
You can’t perform that action at this time.