Skip to content

Instantly share code, notes, and snippets.

@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>
@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: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 / 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:1314449
Created October 25, 2011 21:52
jwplayer problem
<!doctype html>
<head> <meta charset="utf-8">
<title></title>
<link rel="sytlesheet" href="css/sytle.css">
<script type="text/javascript" src="http://worleyworks.com.s3.amazonaws.com/jwscript.js"></script>
</head>
<body>
<div id="container">Loading the player...</div>
<script type="text/javascript">
jwplayer("container").setup({
@gregworley
gregworley / gist:1294450
Created October 18, 2011 02:10 — forked from bradfitz/gist:1190721
go x11 mpeg stream viewer
// X11 viewer for a MJPEG stream, such as the one obtained from the
// Android app https://market.android.com/details?id=com.pas.webcam
package main
import (
"exp/gui/x11"
"flag"
"http"
"image"
@gregworley
gregworley / gobfun.go
Created October 13, 2011 20:33
fun with gob
//Encoding a map to a gob. Save the gob to disk. Read the gob from disk. Decode the gob into another map.
package main
import (
"fmt"
"gob"
"bytes"
"io/ioutil"
)
func main() {
@gregworley
gregworley / trivialTemplate.go
Created October 7, 2011 20:48
Golang's New Template pkg
package main
import ("template" ;"os")
const templ = `Hello {{.Name}}`
type Person struct {Name string}
func main() {
me := &Person{Name: "greg"}
var t = template.Must(template.New("first").Parse(templ))
@gregworley
gregworley / gist:1198903
Created September 6, 2011 20:45
almost lost
//http://docs.amazonwebservices.com/AmazonCloudFront/latest/DeveloperGuide/PrivateContent.html#PrivateContent_AuthExamples
//Amazon CloudFront Developer's Guide (API Version 2010-11-01) Using Amazon Cloudfront>Serving Private Content > Creating a Signed URL
package main
import (
"os"
"strconv"
"fmt"
"io/ioutil"
//working example of func(*iter)Next from: http://goneat.org/pkg/launchpad.net/mgo/#Iter.Next
package main
import (
"fmt"
"launchpad.net/mgo"
)
type Person struct {