diff options
76 files changed, 0 insertions, 13523 deletions
diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 439fe62..0000000 --- a/Dockerfile +++ /dev/null @@ -1,4 +0,0 @@ -FROM xena/christine.website -ENV PORT 5000 -EXPOSE 5000 -RUN apk add --no-cache bash diff --git a/README.md b/README.md deleted file mode 100644 index b10d404..0000000 --- a/README.md +++ /dev/null @@ -1,8 +0,0 @@ -# My Site - -Version 2 - -This is intended as my portfolio site. This is a site made with [pux](https://github.com/alexmingoia/purescript-pux) -and [Go](https://golang.org). - - diff --git a/backend/christine.website/gopreload.go b/backend/christine.website/gopreload.go deleted file mode 100644 index 6829ae5..0000000 --- a/backend/christine.website/gopreload.go +++ /dev/null @@ -1,9 +0,0 @@ -// gopreload.go -package main - -/* - This file is separate to make it very easy to both add into an application, but - also very easy to remove. -*/ - -import _ "github.com/Xe/gopreload" diff --git a/backend/christine.website/hash.go b/backend/christine.website/hash.go deleted file mode 100644 index ed6112c..0000000 --- a/backend/christine.website/hash.go +++ /dev/null @@ -1,14 +0,0 @@ -package main - -import ( - "crypto/md5" - "fmt" -) - -// Hash is a simple wrapper around the MD5 algorithm implementation in the -// Go standard library. It takes in data and a salt and returns the hashed -// representation. -func Hash(data string, salt string) string { - output := md5.Sum([]byte(data + salt)) - return fmt.Sprintf("%x", output) -} diff --git a/backend/christine.website/main.go b/backend/christine.website/main.go deleted file mode 100644 index 35bbbc5..0000000 --- a/backend/christine.website/main.go +++ /dev/null @@ -1,192 +0,0 @@ -package main - -import ( - "bytes" - "encoding/json" - "io/ioutil" - "log" - "net/http" - "os" - "path/filepath" - "sort" - "strings" - "time" - - "github.com/Xe/asarfs" - "github.com/gernest/front" - "github.com/urfave/negroni" -) - -// Post is a single post summary for the menu. -type Post struct { - Title string `json:"title"` - Link string `json:"link"` - Summary string `json:"summary,omitifempty"` - Body string `json:"body, omitifempty"` - Date string `json:"date"` -} - -// Posts implements sort.Interface for a slice of Post objects. -type Posts []*Post - -func (p Posts) Len() int { return len(p) } -func (p Posts) Less(i, j int) bool { - iDate, _ := time.Parse("2006-01-02", p[i].Date) - jDate, _ := time.Parse("2006-01-02", p[j].Date) - - return iDate.Unix() < jDate.Unix() -} -func (p Posts) Swap(i, j int) { p[i], p[j] = p[j], p[i] } - -var ( - posts Posts - rbody string -) - -func init() { - err := filepath.Walk("./blog/", func(path string, info os.FileInfo, err error) error { - if err != nil { - return err - } - - if info.IsDir() { - return nil - } - - fin, err := os.Open(path) - if err != nil { - return err - } - defer fin.Close() - - content, err := ioutil.ReadAll(fin) - if err != nil { - // handle error - } - - m := front.NewMatter() - m.Handle("---", front.YAMLHandler) - front, _, err := m.Parse(bytes.NewReader(content)) - if err != nil { - return err - } - - sp := strings.Split(string(content), "\n") - sp = sp[4:] - data := strings.Join(sp, "\n") - - p := &Post{ - Title: front["title"].(string), - Date: front["date"].(string), - Link: strings.Split(path, ".")[0], - Body: data, - } - - posts = append(posts, p) - - return nil - }) - - if err != nil { - panic(err) - } - - sort.Sort(sort.Reverse(posts)) - - resume, err := ioutil.ReadFile("./static/resume/resume.md") - if err != nil { - panic(err) - } - - rbody = string(resume) -} - -func main() { - mux := http.NewServeMux() - - mux.HandleFunc("/health", func(w http.ResponseWriter, r *http.Request) {}) - mux.HandleFunc("/api/blog/posts", writeBlogPosts) - mux.HandleFunc("/api/blog/post", func(w http.ResponseWriter, r *http.Request) { - q := r.URL.Query() - name := q.Get("name") - - if name == "" { - goto fail - } - - for _, p := range posts { - if strings.HasSuffix(p.Link, name) { - json.NewEncoder(w).Encode(p) - return - } - } - - fail: - http.Error(w, "Not Found", http.StatusNotFound) - }) - mux.HandleFunc("/api/resume", func(w http.ResponseWriter, r *http.Request) { - json.NewEncoder(w).Encode(struct { - Body string `json:"body"` - }{ - Body: rbody, - }) - }) - - if os.Getenv("USE_ASAR") == "yes" { - log.Println("serving site frontend from asar file") - - do404 := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - http.Error(w, "Not found", http.StatusNotFound) - }) - fe, err := asarfs.New("./frontend.asar", do404) - if err != nil { - log.Fatal("frontend: ", err) - } - - mux.Handle("/dist/", http.FileServer(fe)) - } else { - log.Println("serving site frontend from filesystem") - mux.Handle("/dist/", http.FileServer(http.Dir("./frontend/static/"))) - } - - mux.Handle("/static/", http.FileServer(http.Dir("."))) - mux.HandleFunc("/", writeIndexHTML) - - port := os.Getenv("PORT") - if port == "" { - port = "9090" - } - - mux.HandleFunc("/blog.rss", createFeed) - mux.HandleFunc("/blog.atom", createAtom) - mux.HandleFunc("/keybase.txt", func(w http.ResponseWriter, r *http.Request) { - http.ServeFile(w, r, "./static/keybase.txt") - }) - - n := negroni.Classic() - n.UseHandler(mux) - - log.Fatal(http.ListenAndServe(":"+port, n)) -} - -func writeBlogPosts(w http.ResponseWriter, r *http.Request) { - p := []interface{}{} - for _, post := range posts { - p = append(p, struct { - Title string `json:"title"` - Link string `json:"link"` - Summary string `json:"summary,omitifempty"` - Date string `json:"date"` - }{ - Title: post.Title, - Link: post.Link, - Summary: post.Summary, - Date: post.Date, - }) - } - json.NewEncoder(w).Encode(p) -} - -func writeIndexHTML(w http.ResponseWriter, r *http.Request) { - http.ServeFile(w, r, "./frontend/static/dist/index.html") -} diff --git a/backend/christine.website/rss.go b/backend/christine.website/rss.go deleted file mode 100644 index b0cd445..0000000 --- a/backend/christine.website/rss.go +++ /dev/null @@ -1,67 +0,0 @@ -package main - -import ( - "net/http" - "time" - - "github.com/Xe/ln" - "github.com/gorilla/feeds" -) - -var bootTime = time.Now() - -var feed = &feeds.Feed{ - Title: "Christine Dodrill's Blog", - Link: &feeds.Link{Href: "https://christine.website/blog"}, - Description: "My blog posts and rants about various technology things.", - Author: &feeds.Author{Name: "Christine Dodrill", Email: "me@christine.website"}, - Created: bootTime, - Copyright: "This work is copyright Christine Dodrill. My viewpoints are my own and not the view of any employer past, current or future.", -} - -func init() { - for _, item := range posts { - itime, _ := time.Parse("2006-01-02", item.Date) - feed.Items = append(feed.Items, &feeds.Item{ - Title: item.Title, - Link: &feeds.Link{Href: "https://christine.website/" + item.Link}, - Description: item.Summary, - Created: itime, - }) - } -} - -// IncrediblySecureSalt ******* -const IncrediblySecureSalt = "hunter2" - -func createFeed(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "application/rss+xml") - w.Header().Set("ETag", Hash(bootTime.String(), IncrediblySecureSalt)) - - err := feed.WriteRss(w) - if err != nil { - http.Error(w, "Internal server error", http.StatusInternalServerError) - ln.Error(err, ln.F{ - "remote_addr": r.RemoteAddr, - "action": "generating_rss", - "uri": r.RequestURI, - "host": r.Host, - }) - } -} - -func createAtom(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "application/atom+xml") - w.Header().Set("ETag", Hash(bootTime.String(), IncrediblySecureSalt)) - - err := feed.WriteAtom(w) - if err != nil { - http.Error(w, "Internal server error", http.StatusInternalServerError) - ln.Error(err, ln.F{ - "remote_addr": r.RemoteAddr, - "action": "generating_rss", - "uri": r.RequestURI, - "host": r.Host, - }) - } -} @@ -1,54 +0,0 @@ -from "xena/go-mini:1.8.1" - -### setup go -run "go1.8.1 download" - -### Copy files -run "mkdir -p /site" - -def debug?() - getenv("DEBUG") == "yes" -end - -def debug!() - run "apk add --no-cache bash" - debug -end - -def put(file) - copy "./#{file}", "/site/#{file}" -end - -files = [ - "backend", - "blog", - "frontend.asar", - "static", - "build.sh", - "run.sh", - - # This file is packaged in the asar file, but the go app relies on being - # able to read it so it can cache the contents in ram. - "frontend/static/dist/index.html", -] - -files.each { |x| put x } - -copy "vendor/", "/root/go/src/" - -### Build -run "apk add --no-cache --virtual site-builddep build-base" -run %q[ cd /site && sh ./build.sh ] -debug! if debug? - -### Cleanup -run %q[ rm -rf /root/go /site/backend /root/sdk ] -run %q[ apk del git go1.8.1 site-builddep ] - -### Runtime -cmd "/site/run.sh" - -env "USE_ASAR" => "yes" - -flatten -tag "xena/christine.website" diff --git a/build.sh b/build.sh deleted file mode 100755 index b8be3a0..0000000 --- a/build.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh - -set -e -set -x - -export PATH="$PATH:/usr/local/go/bin" -export CI="true" - -cd /site/backend/christine.website -go1.8.1 build -v -mv christine.website /usr/bin diff --git a/containermake.lua b/containermake.lua deleted file mode 100644 index f9037e0..0000000 --- a/containermake.lua +++ /dev/null @@ -1,23 +0,0 @@ -local sh = require "sh" -local fs = require "fs" - -sh { abort = true } - -local cd = function(path) - local ok, err = fs.chdir(path) - if err ~= nil then - error(err) - end -end - -cd "frontend" -sh.rm("-rf", "node_modules", "bower_components"):ok() -print "running npm install..." -sh.npm("install"):print() -print "running npm run build..." -sh.npm("run", "build"):print() -print "packing frontend..." -sh.asar("pack", "static", "../frontend.asar"):print() -cd ".." - -sh.box("box.rb"):print() diff --git a/containermake.sh b/containermake.sh deleted file mode 100755 index 1501e74..0000000 --- a/containermake.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash - -set -e -set -x - -(cd frontend \ - && rm -rf node_modules bower_components \ - && npm install && npm run build \ - && asar pack static ../frontend.asar \ - && cd .. \ - && keybase sign -d -i ./frontend.asar -o ./frontend.asar.sig) - -box box.rb diff --git a/frontend/.gitignore b/frontend/.gitignore deleted file mode 100644 index 5f00026..0000000 --- a/frontend/.gitignore +++ /dev/null @@ -1,9 +0,0 @@ -node_modules/ -bower_components/ -output/ -dist/ -static/dist -.psci_modules -npm-debug.log -**DS_Store -.psc-ide-port diff --git a/frontend/LICENSE b/frontend/LICENSE deleted file mode 100644 index 69da0fe..0000000 --- a/frontend/LICENSE +++ /dev/null @@ -1,24 +0,0 @@ -Copyright (c) 2016, Alexander C. Mingoia -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - * Neither the name of the <organization> nor the - names of its contributors may be used to endorse or promote products - derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY -DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/frontend/README.md b/frontend/README.md deleted file mode 100644 index 51c3474..0000000 --- a/frontend/README.md +++ /dev/null @@ -1,38 +0,0 @@ -# pux-starter-app - -Starter [Pux](https://github.com/alexmingoia/purescript-pux/) application using -webpack with hot-reloading and time-travel debug using -[pux-devtool](https://github.com/alexmingoia/pux-devtool). - -See the [Guide](https://alexmingoia.github.io/purescript-pux) for help learning -Pux. - - - -## Installation - -```sh -git clone git://github.com/alexmingoia/pux-starter-app.git example -cd example -npm install -npm start -``` - -Visit `http://localhost:3000` in your browser, edit `src/purs/Layout.purs` -and watch the magic! - -## Available scripts - -### watch - -`npm start` or `npm run watch` will start a development server, which -hot-reloads your application when sources changes. - -### serve - -`npm run serve` serves your application without watching for changes or -hot-reloading. - -### build - -`npm run build` bundles and minifies your application to run in production mode. diff --git a/frontend/bower.json b/frontend/bower.json deleted file mode 100644 index 1ba4949..0000000 --- a/frontend/bower.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "pux-starter-app", - "homepage": "https://github.com/alexmingoia/pux-starter-app", - "authors": [ - "Alex Mingoia <talk@alexmingoia.com>" - ], - "description": "Starter Pux application us |
