This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package tstappend | |
import "testing" | |
const N = 8192 | |
func appendBytes(a, b []byte) []byte { | |
if len(b) == 0 { | |
return a | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"time" | |
) | |
type Token struct { | |
token string | |
expires time.Time |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ROT13 reader | |
// See: http://en.wikipedia.org/wiki/Rot13 | |
package main | |
import ( | |
"bytes" | |
"io" | |
"os" | |
"strings" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Fibonacci series iterator using closure | |
package main | |
import "fmt" | |
func fibonacci() func() int { | |
x, y := 0, 1 | |
return func() int { | |
x, y = y, x + y | |
return x |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Go Hello World | |
package main | |
import "fmt" | |
func main() { | |
fmt.Println("Hello world!") | |
} |