Skip to content

Instantly share code, notes, and snippets.

View codegangsta's full-sized avatar

Jeremy Saenz codegangsta

View GitHub Profile
package main
import (
"github.com/codegangsta/martini"
)
func main() {
m := martini.Classic()
m.Get("/", func() string {
return "hello world"
package auth
import (
"encoding/base64"
"net/http"
)
func Basic(username string, password string) http.HandlerFunc {
var siteAuth = base64.StdEncoding.EncodeToString([]byte(username + ":" + password))
return func(res http.ResponseWriter, req *http.Request) {
// folder structure
// - templates/
// - admin/
// - index.tmpl
// - rendering.go
package main
import (
"github.com/codegangsta/martini"
"github.com/codegangsta/martini-contrib/render"
package main
import (
"github.com/codegangsta/inject"
"reflect"
"testing"
)
func helloWorld(val string) {
i := 0
package main
import (
"github.com/codegangsta/martini"
"github.com/codegangsta/martini-contrib/binding"
"github.com/codegangsta/martini-contrib/render"
"labix.org/v2/mgo"
)
type Wish struct {
package util
import (
"crypto/rand"
"fmt"
)
type UUID [16]byte
// create a new uuid v4
package main
import (
"github.com/bmizerany/mc"
"github.com/codegangsta/envy/lib"
"github.com/codegangsta/negroni"
"github.com/crowdmob/goamz/aws"
"github.com/crowdmob/goamz/s3"
"github.com/disintegration/imaging"
package main
import (
"flag"
"net/http"
"github.com/codegangsta/negroni"
)
func main() {
package models
import (
"net/http"
"labix.org/v2/mgo"
)
type DB struct {
Database string
@codegangsta
codegangsta / main.go
Created July 7, 2015 23:08
JSON and Middleware
package main
import (
"encoding/json"
"net/http"
"github.com/codegangsta/negroni"
"github.com/julienschmidt/httprouter"
)