Skip to content

Instantly share code, notes, and snippets.

@sanatgersappa
sanatgersappa / gist:4030649
Created November 7, 2012 10:10
Querying Sharepoint on Office365 with Go
package main
import (
"fmt"
"io/ioutil"
"net/http"
"log"
"regexp"
"strings"
)
@sanatgersappa
sanatgersappa / gist:4063850
Created November 13, 2012 04:01
Go FastCGI app
package main
import (
"fmt"
"log"
"net"
"net/http"
"net/http/fcgi"
)
@sanatgersappa
sanatgersappa / gist:4063871
Created November 13, 2012 04:07
nginx conf
server {
#listen 80; ## listen for ipv4; this line is default and implied
#listen [::]:80 default_server ipv6only=on; ## listen for ipv6
root /usr/share/nginx/www;
index index.html index.htm;
# Make site accessible from http://localhost/
server_name localhost, gopher.cloudapp.net;
@sanatgersappa
sanatgersappa / app.go
Created March 10, 2013 06:02
Web app written in Go to demonstrate handling multiple file uploads.
package main
import (
"html/template"
"io"
"net/http"
"os"
)
//Compile templates on start
@sanatgersappa
sanatgersappa / alt.go
Last active March 28, 2020 07:24
Alternative handler for multiple file uploads in Go.
package main
import (
"html/template"
"io"
"net/http"
"os"
)
//Compile templates on start
package main
import (
"html/template"
"net/http"
)
//Compile templates on start
var templates = template.Must(template.ParseFiles("header.html", "footer.html", "main.html", "about.html"))
{{define "header"}}
<!DOCTYPE html>
<html>
<head>
<title>{{.Title}}</title>
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css">
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-theme.min.css">
<style type="text/css">
body {padding-bottom: 70px;}
.content {margin:10px;}
{{define "main"}}
{{template "header" .}}
<div class="content">
<h2>Main</h2>
<div>This is the Main page</div>
</div>
{{template "footer" .}}
{{end}}
{{define "about"}}
{{template "header" .}}
<div class="content">
<h2>About</h2>
<div>This is the About page</div>
</div>
{{template "footer" .}}
{{end}}