Skip to content

Instantly share code, notes, and snippets.

package main
import (
"html/template"
"os"
)
type DataPoint struct {
Time float64
Summary string
(defn fac [n]
(reduce *'
(range n 0 -1)))
package main
import "fmt"
func main() {
for i := 1; i <= 100; i++ {
if i%15 == 0 { //divisible by 5 and 3
fmt.Println("FizzBuzz")
} else if i%5 == 0 { //divisible by 5
(defn relevant? [n]
"returns true if n is divisible by 3 or 5"
(or (= 0 (rem n 3)) (= 0 (rem n 5))))
(reduce + (filter relevant? (range 1000)))
package main
import (
"fmt"
"sort"
)
type Person struct {
Name string
Age int
(def people [
{:Name "Bob", :Age 31}
{:Name "John" :Age 42}
{:Name "Michael" :Age 17}
{:Name "Jenny" :Age 26}
]
)
(println people)
(println (sort-by :Age people))
@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 / gist:4063850
Created November 13, 2012 04:01
Go FastCGI app
package main
import (
"fmt"
"log"
"net"
"net/http"
"net/http/fcgi"
)
(defn get-digit [n]
(cond
(nil? n) "_"
(nil? (re-find #"\d" (str n))) ""
:else n))
(defn get-char [n]
(cond
(nil? n) "_"
(nil? (re-find #"[A-Za-z]" (str n))) ""
{{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;}