more
This commit is contained in:
parent
1acd30143c
commit
291ce2c2a4
18
README
18
README
@ -1,8 +1,17 @@
|
|||||||
|
= next
|
||||||
|
write blog post on Go on Heroku
|
||||||
|
market blog post on Go on Heroku
|
||||||
|
proof ebook toolchain
|
||||||
|
|
||||||
|
= vision
|
||||||
|
must-have book for hackers interested in Go
|
||||||
|
sold at a significant price and producing real revenue
|
||||||
|
notable example of ebook product and marketing
|
||||||
|
|
||||||
= values
|
= values
|
||||||
design
|
design
|
||||||
curation
|
empathy
|
||||||
excellence
|
creativity
|
||||||
excitement
|
|
||||||
|
|
||||||
= validation
|
= validation
|
||||||
private emails
|
private emails
|
||||||
@ -55,7 +64,6 @@ gobyexample.com signups
|
|||||||
* web app
|
* web app
|
||||||
* hipache port
|
* hipache port
|
||||||
* templating
|
* templating
|
||||||
* scatter-gather
|
|
||||||
* ssh
|
* ssh
|
||||||
* environment variables
|
* environment variables
|
||||||
* dns
|
* dns
|
||||||
@ -71,3 +79,5 @@ gobyexample.com signups
|
|||||||
* sort-by
|
* sort-by
|
||||||
* errors
|
* errors
|
||||||
* compilation
|
* compilation
|
||||||
|
* time
|
||||||
|
* time duration
|
||||||
|
10
src/xx-elapsed.go
Normal file
10
src/xx-elapsed.go
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import ("time"; "fmt")
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
start := time.Now()
|
||||||
|
time.Sleep(3 * time.Second)
|
||||||
|
finish := time.Now()
|
||||||
|
fmt.Println(finish.Sub(start))
|
||||||
|
}
|
13
src/xx-epoch.go
Normal file
13
src/xx-epoch.go
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import ("time"; "fmt")
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
now := time.Now()
|
||||||
|
secs := now.Unix()
|
||||||
|
nanos := now.UnixNano()
|
||||||
|
millis := nanos / 1000000
|
||||||
|
fmt.Println("Seconds since epoch:", secs)
|
||||||
|
fmt.Println("Millis since epoch:", millis)
|
||||||
|
fmt.Println("Nanos since epoch:", nanos)
|
||||||
|
}
|
21
src/xx-scatter-gather.go
Normal file
21
src/xx-scatter-gather.go
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import ("sync"; "time"; "math/rand"; "fmt")
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
times := new([20]int)
|
||||||
|
wait := new(sync.WaitGroup)
|
||||||
|
for i := 0; i < 20; i++ {
|
||||||
|
n := i
|
||||||
|
wait.Add(1)
|
||||||
|
go func() {
|
||||||
|
opTime := rand.Intn(2000)
|
||||||
|
time.Sleep(time.Duration(opTime) * time.Millisecond)
|
||||||
|
fmt.Println(n)
|
||||||
|
times[n] = opTime
|
||||||
|
wait.Done()
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
wait.Wait()
|
||||||
|
fmt.Println(*times)
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user