From 30aa5d8c2ddb49ec56596edad23b5c1043737366 Mon Sep 17 00:00:00 2001 From: Christine Dodrill Date: Wed, 17 May 2017 21:30:25 -0700 Subject: [PATCH 01/10] remove code --- Dockerfile | 4 - README.md | 8 - backend/christine.website/gopreload.go | 9 - backend/christine.website/hash.go | 14 - backend/christine.website/main.go | 192 -- backend/christine.website/rss.go | 67 - box.rb | 54 - build.sh | 11 - containermake.lua | 23 - containermake.sh | 13 - frontend/.gitignore | 9 - frontend/LICENSE | 24 - frontend/README.md | 38 - frontend/bower.json | 19 - frontend/package.json | 53 - frontend/src/BlogEntry.purs | 72 - frontend/src/BlogIndex.purs | 86 - frontend/src/Counter.purs | 40 - frontend/src/Layout.purs | 188 -- frontend/src/Main.purs | 53 - frontend/src/NotFound.purs | 8 - frontend/src/Pux/DocumentTitle.js | 3 - frontend/src/Pux/DocumentTitle.purs | 7 - frontend/src/Resume.purs | 66 - frontend/src/Routes.purs | 31 - frontend/src/Utils.js | 16 - frontend/src/Utils.purs | 3 - frontend/support/index.html | 18 - frontend/support/index.js | 25 - frontend/support/pux-starter-app.gif | Bin 2095651 -> 0 bytes frontend/webpack.config.js | 102 - frontend/webpack.production.config.js | 69 - run.sh | 4 - vendor-log | 11 - vendor/github.com/Xe/asarfs/asarfs.go | 117 - vendor/github.com/Xe/asarfs/bench_test.go | 156 - vendor/github.com/Xe/asarfs/runtest.go | 24 - vendor/github.com/Xe/gopreload/doc.go | 7 - vendor/github.com/Xe/gopreload/preload.go | 26 - vendor/github.com/Xe/ln/filter.go | 66 - vendor/github.com/Xe/ln/formatter.go | 100 - vendor/github.com/Xe/ln/logger.go | 141 - vendor/github.com/Xe/ln/stack.go | 44 - vendor/github.com/gernest/front/front.go | 144 - vendor/github.com/gorilla/feeds/atom.go | 163 - vendor/github.com/gorilla/feeds/doc.go | 70 - vendor/github.com/gorilla/feeds/feed.go | 106 - vendor/github.com/gorilla/feeds/rss.go | 146 - vendor/github.com/gorilla/feeds/uuid.go | 27 - vendor/github.com/pkg/errors/errors.go | 269 -- vendor/github.com/pkg/errors/stack.go | 178 -- vendor/github.com/urfave/negroni/doc.go | 25 - vendor/github.com/urfave/negroni/logger.go | 35 - vendor/github.com/urfave/negroni/negroni.go | 133 - vendor/github.com/urfave/negroni/recovery.go | 65 - .../urfave/negroni/response_writer.go | 99 - vendor/github.com/urfave/negroni/static.go | 88 - vendor/gopkg.in/yaml.v2/apic.go | 742 ----- vendor/gopkg.in/yaml.v2/decode.go | 683 ----- vendor/gopkg.in/yaml.v2/emitterc.go | 1685 ---------- vendor/gopkg.in/yaml.v2/encode.go | 306 -- vendor/gopkg.in/yaml.v2/parserc.go | 1096 ------- vendor/gopkg.in/yaml.v2/readerc.go | 394 --- vendor/gopkg.in/yaml.v2/resolve.go | 203 -- vendor/gopkg.in/yaml.v2/scannerc.go | 2710 ----------------- vendor/gopkg.in/yaml.v2/sorter.go | 104 - vendor/gopkg.in/yaml.v2/writerc.go | 89 - vendor/gopkg.in/yaml.v2/yaml.go | 346 --- vendor/gopkg.in/yaml.v2/yamlh.go | 716 ----- vendor/gopkg.in/yaml.v2/yamlprivateh.go | 173 -- vendor/layeh.com/asar/builder.go | 80 - vendor/layeh.com/asar/decoder.go | 64 - vendor/layeh.com/asar/doc.go | 2 - vendor/layeh.com/asar/encoder.go | 122 - vendor/layeh.com/asar/entry.go | 227 -- vendor/layeh.com/asar/header.go | 212 -- 76 files changed, 13523 deletions(-) delete mode 100644 Dockerfile delete mode 100644 README.md delete mode 100644 backend/christine.website/gopreload.go delete mode 100644 backend/christine.website/hash.go delete mode 100644 backend/christine.website/main.go delete mode 100644 backend/christine.website/rss.go delete mode 100644 box.rb delete mode 100755 build.sh delete mode 100644 containermake.lua delete mode 100755 containermake.sh delete mode 100644 frontend/.gitignore delete mode 100644 frontend/LICENSE delete mode 100644 frontend/README.md delete mode 100644 frontend/bower.json delete mode 100644 frontend/package.json delete mode 100644 frontend/src/BlogEntry.purs delete mode 100644 frontend/src/BlogIndex.purs delete mode 100644 frontend/src/Counter.purs delete mode 100644 frontend/src/Layout.purs delete mode 100644 frontend/src/Main.purs delete mode 100644 frontend/src/NotFound.purs delete mode 100644 frontend/src/Pux/DocumentTitle.js delete mode 100644 frontend/src/Pux/DocumentTitle.purs delete mode 100644 frontend/src/Resume.purs delete mode 100644 frontend/src/Routes.purs delete mode 100644 frontend/src/Utils.js delete mode 100644 frontend/src/Utils.purs delete mode 100644 frontend/support/index.html delete mode 100644 frontend/support/index.js delete mode 100644 frontend/support/pux-starter-app.gif delete mode 100644 frontend/webpack.config.js delete mode 100644 frontend/webpack.production.config.js delete mode 100755 run.sh delete mode 100644 vendor-log delete mode 100644 vendor/github.com/Xe/asarfs/asarfs.go delete mode 100644 vendor/github.com/Xe/asarfs/bench_test.go delete mode 100644 vendor/github.com/Xe/asarfs/runtest.go delete mode 100644 vendor/github.com/Xe/gopreload/doc.go delete mode 100644 vendor/github.com/Xe/gopreload/preload.go delete mode 100644 vendor/github.com/Xe/ln/filter.go delete mode 100644 vendor/github.com/Xe/ln/formatter.go delete mode 100644 vendor/github.com/Xe/ln/logger.go delete mode 100644 vendor/github.com/Xe/ln/stack.go delete mode 100644 vendor/github.com/gernest/front/front.go delete mode 100644 vendor/github.com/gorilla/feeds/atom.go delete mode 100644 vendor/github.com/gorilla/feeds/doc.go delete mode 100644 vendor/github.com/gorilla/feeds/feed.go delete mode 100644 vendor/github.com/gorilla/feeds/rss.go delete mode 100644 vendor/github.com/gorilla/feeds/uuid.go delete mode 100644 vendor/github.com/pkg/errors/errors.go delete mode 100644 vendor/github.com/pkg/errors/stack.go delete mode 100644 vendor/github.com/urfave/negroni/doc.go delete mode 100644 vendor/github.com/urfave/negroni/logger.go delete mode 100644 vendor/github.com/urfave/negroni/negroni.go delete mode 100644 vendor/github.com/urfave/negroni/recovery.go delete mode 100644 vendor/github.com/urfave/negroni/response_writer.go delete mode 100644 vendor/github.com/urfave/negroni/static.go delete mode 100644 vendor/gopkg.in/yaml.v2/apic.go delete mode 100644 vendor/gopkg.in/yaml.v2/decode.go delete mode 100644 vendor/gopkg.in/yaml.v2/emitterc.go delete mode 100644 vendor/gopkg.in/yaml.v2/encode.go delete mode 100644 vendor/gopkg.in/yaml.v2/parserc.go delete mode 100644 vendor/gopkg.in/yaml.v2/readerc.go delete mode 100644 vendor/gopkg.in/yaml.v2/resolve.go delete mode 100644 vendor/gopkg.in/yaml.v2/scannerc.go delete mode 100644 vendor/gopkg.in/yaml.v2/sorter.go delete mode 100644 vendor/gopkg.in/yaml.v2/writerc.go delete mode 100644 vendor/gopkg.in/yaml.v2/yaml.go delete mode 100644 vendor/gopkg.in/yaml.v2/yamlh.go delete mode 100644 vendor/gopkg.in/yaml.v2/yamlprivateh.go delete mode 100644 vendor/layeh.com/asar/builder.go delete mode 100644 vendor/layeh.com/asar/decoder.go delete mode 100644 vendor/layeh.com/asar/doc.go delete mode 100644 vendor/layeh.com/asar/encoder.go delete mode 100644 vendor/layeh.com/asar/entry.go delete mode 100644 vendor/layeh.com/asar/header.go 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). - -![](http://i.imgur.com/MOhMzmB.png) 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, - }) - } -} diff --git a/box.rb b/box.rb deleted file mode 100644 index 3d2ec43..0000000 --- a/box.rb +++ /dev/null @@ -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 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 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. - -![Pux starter app animation](support/pux-starter-app.gif) - -## 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 " - ], - "description": "Starter Pux application using webpack with hot-reloading.", - "main": "support/index.js", - "license": "BSD3", - "dependencies": { - "purescript-pux": "^7.0.0", - "purescript-pux-devtool": "^4.1.0", - "purescript-argonaut": "^2.0.0", - "purescript-affjax": "^3.0.2" - }, - "resolutions": { - "purescript-dom": "^3.1.0" - } -} diff --git a/frontend/package.json b/frontend/package.json deleted file mode 100644 index 9de0f7d..0000000 --- a/frontend/package.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "name": "christine-website", - "version": "0.1.0", - "description": "Starter Pux application using webpack with hot-reloading.", - "main": "support/index.js", - "keywords": [ - "pux", - "purescript-pux", - "boilerplate", - "starter-app" - ], - "scripts": { - "postinstall": "bower cache clean && bower install", - "clean": "rimraf static/dist && rimraf dist && rimraf output", - "build": "webpack --config ./webpack.production.config.js --progress --profile --colors", - "watch": "npm run clean && node ./webpack.config.js", - "serve": "http-server static --cors -p 3000", - "start": "npm run watch", - "test": "echo \"Error: no test specified\" && exit 1" - }, - "repository": { - "type": "git", - "url": "git://github.com/alexmingoia/pux-starter-app.git" - }, - "author": "Alexander C. Mingoia", - "license": "BSD-3-Clause", - "bugs": { - "url": "https://github.com/alexmingoia/pux-starter-app/issues" - }, - "dependencies": { - "bower": "^1.7.9", - "connect-history-api-fallback": "^1.2.0", - "express": "^4.13.4", - "favicons-webpack-plugin": "0.0.7", - "html-webpack-plugin": "^2.15.0", - "http-server": "^0.9.0", - "purescript": "^0.10.1", - "purescript-psa": "^0.3.9", - "purs-loader": "^2.0.0", - "react": "^15.0.0", - "react-document-title": "^2.0.2", - "react-dom": "^15.0.0", - "rimraf": "^2.5.2", - "showdown": "^1.6.0", - "webpack": "^2.1.0-beta.25", - "webpack-uglify-js-plugin": "^1.1.9" - }, - "devDependencies": { - "source-map-loader": "^0.1.5", - "webpack-dev-middleware": "^1.8.3", - "webpack-hot-middleware": "^2.12.2" - } -} diff --git a/frontend/src/BlogEntry.purs b/frontend/src/BlogEntry.purs deleted file mode 100644 index 0a46976..0000000 --- a/frontend/src/BlogEntry.purs +++ /dev/null @@ -1,72 +0,0 @@ -module App.BlogEntry where - -import App.Utils (mdify) -import Control.Monad.Aff (attempt) -import DOM (DOM) -import Data.Argonaut (class DecodeJson, decodeJson, (.?)) -import Data.Either (Either(..), either) -import Data.Maybe (Maybe(..)) -import Network.HTTP.Affjax (AJAX, get) -import Prelude (bind, pure, show, ($), (<>), (<<<)) -import Pux (noEffects, EffModel) -import Pux.DocumentTitle (documentTitle) -import Pux.Html (Html, div, h1, p, text) -import Pux.Html.Attributes (dangerouslySetInnerHTML, className, id_, title) - -data Action = RequestPost - | ReceivePost (Either String Post) - -type State = - { status :: String - , id :: Maybe Int - , post :: Post - , name :: String } - -data Post = Post - { title :: String - , body :: String - , date :: String } - -instance decodeJsonPost :: DecodeJson Post where - decodeJson json = do - obj <- decodeJson json - title <- obj .? "title" - body <- obj .? "body" - date <- obj .? "date" - pure $ Post { title: title, body: body, date: date } - -init :: State -init = - { status: "Loading..." - , post: Post - { title: "" - , body: "" - , date: "" } - , name: "" - , id: Nothing } - -update :: Action -> State -> EffModel State Action (ajax :: AJAX, dom :: DOM) -update (ReceivePost (Left err)) state = - noEffects $ state { id = Nothing, status = err } -update (ReceivePost (Right post)) state = noEffects $ state { status = "", id = Just 1, post = post } -update RequestPost state = - { state: state - , effects: [ do - res <- attempt $ get ("/api/blog/post?name=" <> state.name) - let decode r = decodeJson r.response :: Either String Post - let post = either (Left <<< show) decode res - pure $ ReceivePost post - ] - } - -view :: State -> Html Action -view { id: id, status: status, post: (Post post) } = - case id of - Nothing -> div [] [] - (Just _) -> - div [ className "row" ] - [ h1 [] [ text status ] - , documentTitle [ title $ post.title <> " - Christine Dodrill" ] [] - , div [ className "col s8 offset-s2" ] - [ p [ id_ "blogpost", dangerouslySetInnerHTML $ mdify post.body ] [] ] - ] diff --git a/frontend/src/BlogIndex.purs b/frontend/src/BlogIndex.purs deleted file mode 100644 index 1b41dbf..0000000 --- a/frontend/src/BlogIndex.purs +++ /dev/null @@ -1,86 +0,0 @@ -module App.BlogIndex where - -import Control.Monad.Aff (attempt) -import DOM (DOM) -import Data.Argonaut (class DecodeJson, decodeJson, (.?)) -import Data.Either (Either(Left, Right), either) -import Network.HTTP.Affjax (AJAX, get) -import Prelude (($), bind, map, const, show, (<>), pure, (<<<)) -import Pux (EffModel, noEffects) -import Pux.DocumentTitle (documentTitle) -import Pux.Html (Html, br, div, h1, ol, li, button, text, span, p) -import Pux.Html.Attributes (className, id_, key, title) -import Pux.Html.Events (onClick) -import Pux.Router (link) - -data Action = RequestPosts - | ReceivePosts (Either String Posts) - -type State = - { posts :: Posts - , status :: String } - -data Post = Post - { title :: String - , link :: String - , summary :: String - , date :: String } - -type Posts = Array Post - -instance decodeJsonPost :: DecodeJson Post where - decodeJson json = do - obj <- decodeJson json - title <- obj .? "title" - link <- obj .? "link" - summ <- obj .? "summary" - date <- obj .? "date" - pure $ Post { title: title, link: link, summary: summ, date: date } - -init :: State -init = - { posts: [] - , status: "" } - -update :: Action -> State -> EffModel State Action (ajax :: AJAX, dom :: DOM) -update (ReceivePosts (Left err)) state = - noEffects $ state { status = ("error: " <> err) } -update (ReceivePosts (Right posts)) state = - noEffects $ state { posts = posts, status = "" } -update RequestPosts state = - { state: state { status = "Loading..." } - , effects: [ do - res <- attempt $ get "/api/blog/posts" - let decode r = decodeJson r.response :: Either String Posts - let posts = either (Left <<< show) decode res - pure $ ReceivePosts posts - ] - } - -post :: Post -> Html Action -post (Post state) = - div - [ className "col s6" ] - [ div - [ className "card pink lighten-5" ] - [ div - [ className "card-content black-text" ] - [ span [ className "card-title" ] [ text state.title ] - , br [] [] - , p [] [ text ("Posted on: " <> state.date) ] - , span [] [ text state.summary ] - ] - , div - [ className "card-action pink lighten-5" ] - [ link state.link [] [ text "Read More" ] ] - ] - ] - -view :: State -> Html Action -view state = - div - [] - [ h1 [] [ text "Posts" ] - , documentTitle [ title "Posts - Christine Dodrill" ] [] - , div [ className "row" ] $ map post state.posts - , p [] [ text state.status ] ] diff --git a/frontend/src/Counter.purs b/frontend/src/Counter.purs deleted file mode 100644 index d56afbe..0000000 --- a/frontend/src/Counter.purs +++ /dev/null @@ -1,40 +0,0 @@ -module App.Counter where - -import Prelude ((+), (-), const, show) -import Pux.Html (Html, a, br, div, span, text) -import Pux.Html.Attributes (className, href) -import Pux.Html.Events (onClick) - -data Action = Increment | Decrement - -type State = Int - -init :: State -init = 0 - -update :: Action -> State -> State -update Increment state = state + 1 -update Decrement state = state - 1 - -view :: State -> Html Action -view state = - div - [ className "row" ] - [ div - [ className "col s4 offset-s4" ] - [ div - [ className "card blue-grey darken-1" ] - [ div - [ className "card-content white-text" ] - [ span [ className "card-title" ] [ text "Counter" ] - , br [] [] - , span [] [ text (show state) ] - ] - , div - [ className "card-action" ] - [ a [ onClick (const Increment), href "#" ] [ text "Increment" ] - , a [ onClick (const Decrement), href "#" ] [ text "Decrement" ] - ] - ] - ] - ] diff --git a/frontend/src/Layout.purs b/frontend/src/Layout.purs deleted file mode 100644 index 193419e..0000000 --- a/frontend/src/Layout.purs +++ /dev/null @@ -1,188 +0,0 @@ -module App.Layout where - -import App.BlogEntry as BlogEntry -import App.BlogIndex as BlogIndex -import App.Counter as Counter -import App.Resume as Resume -import Pux.Html as H -import App.Routes (Route(..)) -import Control.Monad.RWS (state) -import DOM (DOM) -import Network.HTTP.Affjax (AJAX) -import Prelude (($), (#), map, pure) -import Pux (EffModel, noEffects, mapEffects, mapState) -import Pux.DocumentTitle (documentTitle) -import Pux.Html (style, Html, a, code, div, h1, h2, h3, h4, li, nav, p, pre, text, ul, img, span) -import Pux.Html (Html, a, code, div, h1, h3, h4, li, nav, p, pre, text, ul) -import Pux.Html.Attributes (attr, target, href, classID, className, id_, role, src, rel, title) -import Pux.Router (link) - -data Action - = Child (Counter.Action) - | BIChild (BlogIndex.Action) - | BEChild (BlogEntry.Action) - | REChild (Resume.Action) - | PageView Route - -type State = - { route :: Route - , count :: Counter.State - , bistate :: BlogIndex.State - , bestate :: BlogEntry.State - , restate :: Resume.State } - -init :: State -init = - { route: NotFound - , count: Counter.init - , bistate: BlogIndex.init - , bestate: BlogEntry.init - , restate: Resume.init } - -update :: Action -> State -> EffModel State Action (ajax :: AJAX, dom :: DOM) -update (PageView route) state = routeEffects route $ state { route = route } -update (BIChild action) state = BlogIndex.update action state.bistate - # mapState (state { bistate = _ }) - # mapEffects BIChild -update (BEChild action) state = BlogEntry.update action state.bestate - # mapState (state { bestate = _ }) - # mapEffects BEChild -update (REChild action) state = Resume.update action state.restate - # mapState ( state { restate = _ }) - # mapEffects REChild -update (Child action) state = noEffects $ state { count = Counter.update action state.count } -update _ state = noEffects $ state - -routeEffects :: Route -> State -> EffModel State Action (dom :: DOM, ajax :: AJAX) -routeEffects (BlogIndex) state = { state: state - , effects: [ pure BlogIndex.RequestPosts ] } # mapEffects BIChild -routeEffects (Resume) state = { state: state - , effects: [ pure Resume.RequestResume ] } # mapEffects REChild -routeEffects (BlogPost page') state = { state: state { bestate = BlogEntry.init { name = page' } } - , effects: [ pure BlogEntry.RequestPost ] } # mapEffects BEChild -routeEffects _ state = noEffects $ state - -view :: State -> Html Action -view state = - div - [] - [ navbar state - , div - [ className "container" ] - [ page state.route state ] - ] - -navbar :: State -> Html Action -navbar state = - nav - [ className "pink lighten-1", role "navigation" ] - [ div - [ className "nav-wrapper container" ] - [ link "/" [ className "brand-logo", id_ "logo-container" ] [ text "Christine Dodrill" ] - , H.link [ rel "stylesheet", href "/static/css/about/main.css" ] [] - , ul - [ className "right hide-on-med-and-down" ] - [ li [] [ link "/blog" [] [ text "Blog" ] ] - -- , li [] [ link "/projects" [] [ text "Projects" ] ] - , li [] [ link "/resume" [] [ text "Resume" ] ] - , li [] [ link "/contact" [] [ text "Contact" ] ] - ] - ] - ] - -contact :: Html Action -contact = - div - [ className "row" ] - [ documentTitle [ title "Contact - Christine Dodrill" ] [] - , div - [ className "col s6" ] - [ h3 [] [ text "Email" ] - , div [ className "email" ] [ text "me@christine.website" ] - , p [] - [ text "My GPG fingerprint is " - , code [] [ text "799F 9134 8118 1111" ] - , text ". If you get an email that appears to be from me and the signature does not match that fingerprint, it is not from me. You may download a copy of my public key " - , a [ href "/static/gpg.pub" ] [ text "here" ] - , text "." - ] - , h3 [] [ text "Social Media" ] - , ul - [ className "browser-default" ] - [ li [] [ a [ href "https://github.com/Xe" ] [ text "Github" ] ] - , li [] [ a [ href "https://twitter.com/theprincessxena"] [ text "Twitter" ] ] - , li [] [ a [ href "https://keybase.io/xena" ] [ text "Keybase" ] ] - , li [] [ a [ href "https://www.coinbase.com/christinedodrill" ] [ text "Coinbase" ] ] - , li [] [ a [ href "https://www.facebook.com/chrissycade1337" ] [ text "Facebook" ] ] - ] - ] - , div - [ className "col s6" ] - [ h3 [] [ text "Other Information" ] - , p [] - [ text "To send me donations, my bitcoin address is " - , code [] [ text "1Gi2ZF2C9CU9QooH8bQMB2GJ2iL6shVnVe" ] - , text "." - ] - , div [] - [ h4 [] [ text "IRC" ] - , p [] [ text "I am on many IRC networks. On Freenode I am using the nick Xe but elsewhere I will use the nick Xena or Cadey." ] - ] - , div [] - [ h4 [] [ text "Telegram" ] - , a [ href "https://telegram.me/miamorecadenza" ] [ text "@miamorecadenza" ] - ] - , div [] - [ h4 [] [ text "Discord" ] - , pre [] [ text "Cadey~#1932" ] - ] - ] - ] - -index :: Html Action -index = - div - [ className "row panel" ] - [ documentTitle [ title "Christine Dodrill" ] [] - , div [] [ div - [ className "col m4 bg_blur valign-wrapper center-align" ] - [ div - [ className "valign center-align fb_wrap" ] - [ link "/contact" - [ className "btn follow_btn" ] - [ text "Contact Me" ] - ] - ] - ] - , div - [ className "col m8" ] - [ div - [ className "header" ] - [ h1 [] [ text "Christine Dodrill" ] - , h4 [] [ text "Rockstar Hacker, Freelance Programmer, Gopher, Cloud Architect" ] - , span [] [ text "I am a GitHub power user. I am constantly learning new languages and tools. I strongly believe in knowing many languages and ways to do things so I can pick the right tool for the job." ] - , h2 [] [ text "Skills" ] - , ul - [ className "browser-default" ] - [ li [] [ text "Go, Moonscript, Lua, Python, C, Nim, Haskell" ] - , li [] [ text "Docker deployments" ] - , li [] [ text "Research, Development and Experimentation" ] - ] - , h2 [] [ text "Side Projects" ] - , ul - [ className "browser-default" ] - [ li [] [ text "Real-time globally distributed chat server maintenance" ] - , li [] [ text "Mashups of chat, video and music" ] - ] - ] - ] - ] - -page :: Route -> State -> Html Action -page NotFound _ = h1 [] [ text "not found" ] -page Home _ = index -page Resume state = map REChild $ Resume.view state.restate -page BlogIndex state = map BIChild $ BlogIndex.view state.bistate -page (BlogPost _) state = map BEChild $ BlogEntry.view state.bestate -page ContactPage _ = contact -page _ _ = h1 [] [ text "not implemented yet" ] diff --git a/frontend/src/Main.purs b/frontend/src/Main.purs deleted file mode 100644 index 09030f3..0000000 --- a/frontend/src/Main.purs +++ /dev/null @@ -1,53 +0,0 @@ -module Main where - -import App.Layout (Action(PageView), State, view, update) -import App.Routes (match) -import Control.Bind ((=<<)) -import Control.Monad.Eff (Eff) -import DOM (DOM) -import Network.HTTP.Affjax (AJAX) -import Prelude (bind, pure) -import Pux (renderToDOM, renderToString, App, Config, CoreEffects, start) -import Pux.Devtool (Action, start) as Pux.Devtool -import Pux.Router (sampleUrl) -import Signal ((~>)) - -type AppEffects = (dom :: DOM, ajax :: AJAX) - --- | App configuration -config :: forall eff. State -> Eff (dom :: DOM | eff) (Config State Action AppEffects) -config state = do - -- | Create a signal of URL changes. - urlSignal <- sampleUrl - - -- | Map a signal of URL changes to PageView actions. - let routeSignal = urlSignal ~> \r -> PageView (match r) - - pure - { initialState: state - , update: update - , view: view - , inputs: [routeSignal] } - --- | Entry point for the browser. -main :: State -> Eff (CoreEffects AppEffects) (App State Action) -main state = do - app <- start =<< config state - renderToDOM "#app" app.html - -- | Used by hot-reloading code in support/index.js - pure app - --- | Entry point for the browser with pux-devtool injected. -debug :: State -> Eff (CoreEffects AppEffects) (App State (Pux.Devtool.Action Action)) -debug state = do - app <- Pux.Devtool.start =<< config state - renderToDOM "#app" app.html - -- | Used by hot-reloading code in support/index.js - pure app - --- | Entry point for server side rendering -ssr :: State -> Eff (CoreEffects AppEffects) String -ssr state = do - app <- start =<< config state - res <- renderToString app.html - pure res diff --git a/frontend/src/NotFound.purs b/frontend/src/NotFound.purs deleted file mode 100644 index d22d26d..0000000 --- a/frontend/src/NotFound.purs +++ /dev/null @@ -1,8 +0,0 @@ -module App.NotFound where - -import Pux.Html (Html, (#), div, h2, text) - -view :: forall state action. state -> Html action -view state = - div # do - h2 # text "404 Not Found" diff --git a/frontend/src/Pux/DocumentTitle.js b/frontend/src/Pux/DocumentTitle.js deleted file mode 100644 index 4813319..0000000 --- a/frontend/src/Pux/DocumentTitle.js +++ /dev/null @@ -1,3 +0,0 @@ -var Pux = require('purescript-pux'); - -exports.documentTitle = Pux.fromReact(require('react-document-title')); diff --git a/frontend/src/Pux/DocumentTitle.purs b/frontend/src/Pux/DocumentTitle.purs deleted file mode 100644 index 584af35..0000000 --- a/frontend/src/Pux/DocumentTitle.purs +++ /dev/null @@ -1,7 +0,0 @@ -module Pux.DocumentTitle where - -import Pux.Html (Html, Attribute) - --- | Declaratively set `document.title`. See [react-document-title](https://github.com/gaearon/react-document-title) --- | for more information. -foreign import documentTitle :: forall a. Array (Attribute a) -> Array (Html a) -> Html a diff --git a/frontend/src/Resume.purs b/frontend/src/Resume.purs deleted file mode 100644 index 8a23d02..0000000 --- a/frontend/src/Resume.purs +++ /dev/null @@ -1,66 +0,0 @@ -module App.Resume where - -import App.Utils (mdify) -import Control.Monad.Aff (attempt) -import DOM (DOM) -import Data.Argonaut (class DecodeJson, decodeJson, (.?)) -import Data.Either (Either(..), either) -import Data.Maybe (Maybe(..)) -import Network.HTTP.Affjax (AJAX, get) -import Prelude (Unit, bind, pure, show, unit, ($), (<>), (<<<)) -import Pux (noEffects, EffModel) -import Pux.DocumentTitle (documentTitle) -import Pux.Html (Html, a, div, h1, p, text) -import Pux.Html.Attributes (href, dangerouslySetInnerHTML, className, id_, title) - -data Action = RequestResume - | ReceiveResume (Either String Resume) - -type State = - { status :: String - , err :: String - , resume :: Maybe Resume } - -data Resume = Resume - { body :: String } - -instance decodeJsonResume :: DecodeJson Resume where - decodeJson json = do - obj <- decodeJson json - body <- obj .? "body" - pure $ Resume { body: body } - -init :: State -init = - { status: "Loading..." - , err: "" - , resume: Nothing } - -update :: Action -> State -> EffModel State Action (ajax :: AJAX, dom :: DOM) -update (ReceiveResume (Left err)) state = - noEffects $ state { resume = Nothing, status = "Error in fetching resume, please use the plain text link below.", err = err } -update (ReceiveResume (Right body)) state = - noEffects $ state { status = "", err = "", resume = Just body } - where - got' = Just unit -update RequestResume state = - { state: state - , effects: [ do - res <- attempt $ get "/api/resume" - let decode r = decodeJson r.response :: Either String Resume - let resume = either (Left <<< show) decode res - pure $ ReceiveResume resume - ] - } - -view :: State -> Html Action -view { status: status, err: err, resume: resume } = - case resume of - Nothing -> div [] [ text status, p [] [ text err ] ] - (Just (Resume resume')) -> - div [ className "row" ] - [ documentTitle [ title "Resume - Christine Dodrill" ] [] - , div [ className "col s8 offset-s2" ] - [ p [ className "browser-default", dangerouslySetInnerHTML $ mdify resume'.body ] [] - , a [ href "/static/resume/resume.md" ] [ text "Plain-text version of this resume here" ], text "." ] - ] diff --git a/frontend/src/Routes.purs b/frontend/src/Routes.purs deleted file mode 100644 index 7076898..0000000 --- a/frontend/src/Routes.purs +++ /dev/null @@ -1,31 +0,0 @@ -module App.Routes where - -import App.BlogEntry as BlogEntry -import App.BlogIndex as BlogIndex -import App.Counter as Counter -import Control.Alt ((<|>)) -import Control.Apply ((<*), (*>)) -import Data.Functor ((<$)) -import Data.Maybe (fromMaybe) -import Prelude (($), (<$>)) -import Pux.Router (param, router, lit, str, end) - -data Route = Home - | Resume - | ContactPage - | StaticPage String - | BlogIndex - | BlogPost String - | NotFound - -match :: String -> Route -match url = fromMaybe NotFound $ router url $ - Home <$ end - <|> - BlogIndex <$ lit "blog" <* end - <|> - BlogPost <$> (lit "blog" *> str) <* end - <|> - ContactPage <$ lit "contact" <* end - <|> - Resume <$ lit "resume" <* end diff --git a/frontend/src/Utils.js b/frontend/src/Utils.js deleted file mode 100644 index 61023c8..0000000 --- a/frontend/src/Utils.js +++ /dev/null @@ -1,16 +0,0 @@ -// Module App.BlogEntry - -showdown = require("showdown"); - -showdown.extension('blog', function() { - return [{ - type: 'output', - regex: /