Skip to content
Fetching contributors…
Cannot retrieve contributors at this time
141 lines (132 sloc) 5.6 KB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<script src="/js/lib/highlight.js"></script>
<script src="/js/languages/go.js"></script>
<script src="/js/options.js"></script>
<link rel="stylesheet" href="/css/reset.css" type="text/css" media="screen">
<link rel="stylesheet" href="/css/main.css" type="text/css" media="screen">
<link rel="stylesheet" href="/css/options.css" type="text/css" media="screen">
<link rel="stylesheet" href="/css/none.css" type="text/css" media="screen">
<title>Sight Options</title>
</head>
<body class="hljs">
<div>
<h3>Select your theme</h3>
<select id="theme">
<option value="agate">agate</option>
<option value="androidstudio">androidstudio</option>
<option value="arta">arta</option>
<option value="ascetic">ascetic</option>
<option value="atelier-dune.dark">atelier-dune.dark</option>
<option value="atelier-dune.light">atelier-dune.light</option>
<option value="atelier-forest.dark">atelier-forest.dark</option>
<option value="atelier-forest.light">atelier-forest.light</option>
<option value="atelier-heath.dark">atelier-heath.dark</option>
<option value="atelier-heath.light">atelier-heath.light</option>
<option value="atelier-lakeside.dark">atelier-lakeside.dark</option>
<option value="atelier-lakeside.light">atelier-lakeside.light</option>
<option value="atelier-seaside.dark">atelier-seaside.dark</option>
<option value="atelier-seaside.light">atelier-seaside.light</option>
<option value="atelier-sulphurpool.dark">atelier-sulphurpool.dark</option>
<option value="atelier-sulphurpool.light">atelier-sulphurpool.light</option>
<option value="codepen-embed">codepen-embed</option>
<option value="color-brewer">color-brewer</option>
<option value="dark">dark</option>
<option value="darkula">darkula</option>
<option value="default">default</option>
<option value="docco">docco</option>
<option value="far">far</option>
<option value="foundation">foundation</option>
<option value="github">github</option>
<option value="googlecode">googlecode</option>
<option value="hybrid">hybrid</option>
<option value="idea">idea</option>
<option value="ir_black">ir_black</option>
<option value="kimbie.dark">kimbie.dark</option>
<option value="kimbie.light">kimbie.light</option>
<option value="magula">magula</option>
<option value="mono-blue">mono-blue</option>
<option value="monokai">monokai</option>
<option value="monokai_sublime">monokai_sublime</option>
<option value="obsidian">obsidian</option>
<option value="paraiso.dark">paraiso.dark</option>
<option value="paraiso.light">paraiso.light</option>
<option value="pojoaque">pojoaque</option>
<option value="railscasts">railscasts</option>
<option value="rainbow">rainbow</option>
<option value="solarized_dark">solarized_dark</option>
<option value="solarized_light">solarized_light</option>
<option value="sunburst">sunburst</option>
<option value="tomorrow">tomorrow</option>
<option value="tomorrow-night">tomorrow-night</option>
<option value="tomorrow-night-blue">tomorrow-night-blue</option>
<option value="tomorrow-night-bright">tomorrow-night-bright</option>
<option value="tomorrow-night-eighties">tomorrow-night-eighties</option>
<option value="vs">vs</option>
<option value="xcode">xcode</option>
<option value="zenburn">zenburn</option>
</select>
<h3>Select your font</h3>
<select id="font">
<option value="Inconsolata">Inconsolata</option>
<option value="Courier New">Courier New</option>
<option value="Monaco">Monaco</option>
<option value="Anonymous Pro">Anonymous Pro</option>
<option value="DejaVuSansMono">DejaVu Sans Mono</option>
<option value="DroidSansMono">Droid Sans Mono</option>
<option value="Monofur">Monofur</option>
<option value="ProFont">ProFont</option>
<option value="ProggyClean">Proggy Clean</option>
<option value="Consolas">Consolas</option>
</select>
<h3>Select your font size</h3>
<select id="font-size">
<option value="xx-small">xx-small</option>
<option value="x-small">x-small</option>
<option value="small">small</option>
<option value="medium">medium</option>
<option value="large">large</option>
<option value="x-large">x-large</option>
<option value="xx-large">xx-large</option>
</select>
<h3>Line numbers:<input id="line-numbers" type="checkbox"></h3>
<pre id="code" class="go">
package main
import (
"fmt"
"math/rand"
"time"
)
type Runner interface {
Run(distance int) time.Duration
}
type human struct {
name string
}
func (h *human) Run(distance int) time.Duration {
began := time.Now()
for i := 0; i < distance; i++ {
time.Sleep(time.Duration(rand.Intn(100)) * time.Microsecond)
}
return time.Since(began)
}
func main() {
const distance = 30000
runners := []Runner{&human{"John Doe"}, &human{"John Moe"}}
timings := make(chan time.Duration, 2)
for i := range runners {
go func(i int) { timings <- runners[i].Run(distance) }(i)
}
var total time.Duration
for i := 0; i < cap(timings); i++ {
total += <-timings
}
avg := time.Duration(float64(total) / float64(len(runners)))
fmt.Printf("Average run took: %s", avg)
}
</pre>
</div>
</body>
</html>
Jump to Line
Something went wrong with that request. Please try again.