TopoJSON files converted from shapfiles. It consists of 3 administrative levels ranging from 0 to 2, which are country, provinces, districts respectively.
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
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
Hello, world! | |
<p>Test Gist</p> |
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
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<style> | |
/* CSS goes here. */ | |
.subunit { fill: #dcd; } | |
</style> | |
<body> | |
<script src="http://d3js.org/d3.v3.min.js"></script> |
A map of Thailand built using D3 library. It shows the border of all the provinces.
A map of Thailand displayed by ampher.
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" | |
"io/ioutil" | |
"net/http" | |
) | |
func producer(total int) chan *http.Request { | |
queue := make(chan *http.Request) |
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
func producer(total int) chan *http.Request { | |
queue := make(chan *http.Request) | |
// make sure that this the for-loop is run using goroutine | |
// otherwiser, it will block | |
go func() { | |
for i := 0; i < total; i++ { | |
// ignore error assuming that the request valid | |
req, _ := http.NewRequest("GET", "http://localhost:9000", nil) | |
queue <- req | |
} |
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
func consumer(queue chan *http.Request, id int) { | |
// create http client | |
client := &http.Client{} | |
// consumer runs forever until the queue is closed | |
for { | |
select { | |
case req, ok := <-queue: | |
if !ok { | |
// not ok means queue is closed |
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
// ... | |
func main() { | |
// create fixed size queue | |
queue := producer(1000) | |
// create consumers to consume work in the queue | |
consumerCount := 10 | |
for i := 0; i < consumerCount; i++ { | |
go consumer(queue, i) | |
} |
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" | |
"io/ioutil" | |
"net/http" | |
"sync" | |
) | |
func producer(total int) chan *http.Request { |
OlderNewer