Skip to content

Instantly share code, notes, and snippets.

@gregworley
gregworley / templateUse.go
Created October 31, 2011 19:15
golang r60 template package example using range on a slice of maps and accessing keys
package main
import (
"template"
"os"
)
const levelsT = `levels: [
{{range $h := .}} {{"{"}}bitrate:{{$h.bitrate}}, file:"{{$h.file}}", width:{{$h.width}}, height:{{$h.height}}{{"}"}}
{{end}}]
@gregworley
gregworley / gist:4725728
Created February 6, 2013 20:54
trying to use gorilla template with slots and fills
package main
import (
template "github.com/gorilla/template/v0"
"fmt"
"os"
)
func main() {
@gregworley
gregworley / gist:4751964
Created February 11, 2013 02:00
Data Structure in Golang that will be passed to a template to render a side navigation bar based on bootstrap
package main
import "fmt"
type NavBar struct {
SpanDefault int
Content []Category
}
type Category struct {
Name string
@gregworley
gregworley / gist:4752120
Created February 11, 2013 02:50
the side nav bar from twitter's bootstrap example of a fluid layout
<div class="span2">
<div class="well sidebar-nav">
<ul class="nav nav-list">
<li class="nav-header">Sidebar</li>
<li class="active"><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li class="nav-header">Sidebar</li>
<li><a href="#">Link</a></li>