Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nuzzlify everything #33

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
repl:
clj

# TODO I'm confused by why the action has to be in different order
build-action:
clojure -X:build
npm install
Expand All @@ -17,9 +18,10 @@ build:
cp -r resources/* _site/
touch _site/.nojekyll

watch: build
# TODO idk what to change about this one too
watch:
while true; do \
BUILD_ENV=development make build ; \
BUILD_ENV=development npm run release; \
inotifywait -r -e modify src/gaiwan resources; \
done

Expand All @@ -36,4 +38,7 @@ deploy: build
git push origin gh-pages

serve:
cd _site && python3 -m http.server --bin 0.0.0.0 8001
clj -X:serve

develop:
clj -X:develop
7 changes: 0 additions & 7 deletions blog/delivering-devops-enterprise-summit.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
---
date: 2021-06-01
title: "Delivering devops enterprise summit"
slug: "itrevolution-devops-enterprise-summit"
author: "Mitesh (@oxalorg)"
---

We have worked closely with Gene Kim and his team at [ITRevolution](https://itrevolution.com) to build and deliver the Dev Ops Enterprise Summit online conference.

Up until 2019 these conferences amassed tech leaders from across the globe for an in-person conference. After the pandemic though, there was an urgent need to take this to an online venue without detracting from the experience.
Expand Down
7 changes: 0 additions & 7 deletions blog/growing-our-team.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
---
date: 2020-11-01
title: "Growing the Gaiwan team"
slug: "growing-our-team"
author: "Mitesh (@oxalorg)"
---

We have some great news to share today. Our Gaiwan team has officially expanded
to **5 team members** now!

Expand Down
7 changes: 0 additions & 7 deletions blog/still_beating_the_averages.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
---
date: 2022-06-08
title: "Still Beating the Averages"
slug: "still-beating-the-averages"
author: "Joshua Ballanco"
---

It has been just over 20 years since Paul Graham published ["Beating the Averages"](http://www.paulgraham.com/avg.html), one of his more famous articles. While it is perhaps most recognized for its emphatic endorsement of Lisp, Paul Graham's larger point in the article (and source of the title) is that the "average" startup goes out of business. To be successful, he argues, you need to do something to set yourself apart -- to be "above average" -- and using Lisp is one way a startup can be above average.

At Gaiwan, we definitely agree that Lisp (or, in our case, Clojure) is a super-powered programming language that can empower a team of developers to beat the average. Indeed, some of us have been using Clojure for over a decade to help both startups and large organizations succeed. That said, upon re-reading "Beating the Averages", one notices a flaw in Paul Graham's argument for choosing Lisp.
Expand Down
23 changes: 5 additions & 18 deletions deps.edn
Original file line number Diff line number Diff line change
@@ -1,34 +1,21 @@
{:paths ["src" "resources"]
:deps {org.clojure/clojure {:mvn/version "1.11.1"}
lambdaisland/data-printers {:mvn/version "0.7.47"}

;; Logging
com.lambdaisland/glogi {:mvn/version "1.1.144"}
io.pedestal/pedestal.log {:mvn/version "0.5.10"}
ch.qos.logback/logback-classic {:mvn/version "1.2.11"}

;; HTTP
ring/ring {:mvn/version "1.9.5"}
ring/ring-defaults {:mvn/version "0.3.3"}
metosin/reitit-ring {:mvn/version "0.5.18"}
metosin/reitit-http {:mvn/version "0.5.18"}
metosin/reitit-interceptors {:mvn/version "0.5.18"}
ring/ring-jetty-adapter {:mvn/version "1.9.5"}

;; HTTP / CSS (Server-side)
lambdaisland/webstuff {:git/url "https://github.com/lambdaisland/webstuff"
:sha "5d5669e7f7829c65fdd00b19ef826565ce41b7ea"}
com.lambdaisland/ornament {:mvn/version "0.4.34"}
clj-rss/clj-rss {:mvn/version "0.3.0"}

;; Data
markdown-clj/markdown-clj {:mvn/version "1.11.0"}
org.clojure/data.json {:mvn/version "2.4.0"}
io.github.nextjournal/markdown {:mvn/version "0.4.109"}

;; Static site generation
com.lambdaisland/reitit-jaatya {:mvn/version "0.0.24"}}
codes.stel/nuzzle {:mvn/version "0.6.502"}
}

:aliases
{:build
{:exec-fn co.gaiwan.site/build}}}
{:build {:exec-fn co.gaiwan.site/publish}
:serve {:exec-fn co.gaiwan.site/serve}
:develop {:exec-fn co.gaiwan.site/develop}}}
4 changes: 1 addition & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 0 additions & 10 deletions pages/dev_checkup.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,3 @@
---
title: "Gaiwan's Clojure Dev Tooling & Docs Week"
slug: clojure-dev-tooling-docs-checkup
description: |-
Invite the Gaiwan Team over for a week improve your setup, and to help boost
your team's productivity. Everything from having a good REPL experience, a solid test
setup, and a reloadable workflow, up to having a kick-ass onboarding experience for
the next person to join.
---

# Gaiwan's Clojure Dev and Docs Week

As a consultancy we get to see a lot of code bases, and it's always interesting
Expand Down
92 changes: 71 additions & 21 deletions src/co/gaiwan/site.clj
Original file line number Diff line number Diff line change
@@ -1,22 +1,72 @@
(ns co.gaiwan.site
(:require [clojure.java.io :as io]
[co.gaiwan.site.http :as http]
[lambdaisland.reitit-jaatya.freeze :as freeze]
[lambdaisland.webstuff.bootstrap :as bootstrap]))

(defn build [& args]
(http/spit-ornament)
(freeze/iced
(http/build-handler)
{:sitemap-path "/sitemap.xml"
:sitemap-trailing-slash true
:base-url "https://gaiwan.co"}))

(defn serve []
(bootstrap/go :dev))

(comment
;; this will create a `_site` folder in `does-library`
;; to browse it locally run
;; cd _site && python3 -m http.server
(build))
(:require [co.gaiwan.site.blog :as blog]
[co.gaiwan.site.data :as data]
[co.gaiwan.site.home :as home]
[co.gaiwan.site.markdown :as md]
[co.gaiwan.site.pages :as pages]
[co.gaiwan.site.work :as work]
[nuzzle.core :as nuzz]))

(defn pages []
{[]
{:nuzzle/title data/site-title
:nuzzle/render-page home/get-home}

[:work]
{:nuzzle/title "Our Work - Gaiwan Team"
:nuzzle/summary "Projects built by the Gaiwan team. We use clojure and clojurescript to solve critical problems for our clients."
:nuzzle/render-page work/get-work}

[:clojure-dev-tooling-docs-checkup]
{:nuzzle/title "Gaiwan's Clojure Dev Tooling & Docs Week"
:nuzzle/render-page pages/get-generic
:nuzzle/render-content #(md/md-content "pages/dev_checkup.md")
:nuzzle/summary "Invite the Gaiwan Team over for a week improve your setup, and to help boost your team's productivity. Everything from having a good REPL experience, a solid test setup, and a reloadable workflow, up to having a kick-ass onboarding experience for the next person to join."}

[:blog]
{:nuzzle/title "Gaiwan Blog"
:nuzzle/summary "The Gaiwan Blog"
:nuzzle/render-page blog/get-blog}

[:blog :itrevolution-devops-enterprise-summit]
{:nuzzle/title "Delivering devops enterprise summit"
:nuzzle/render-page blog/get-blog-item
:nuzzle/render-content #(md/md-content "blog/delivering-devops-enterprise-summit.md")
:nuzzle/published #inst "2021-06-01"
:nuzzle/feed true
:nuzzle/author (data/authors :mitesh)}

[:blog :growing-our-team]
{:nuzzle/title "Growing the Gaiwan team"
:nuzzle/render-page blog/get-blog-item
:nuzzle/render-content #(md/md-content "blog/growing-our-team.md")
:nuzzle/published #inst "2020-11-01"
:nuzzle/feed true
:nuzzle/author (data/authors :mitesh)}

[:blog :still-beating-the-averages]
{:nuzzle/title "Still Beating the Averages"
:nuzzle/render-page blog/get-blog-item
:nuzzle/render-content #(md/md-content "blog/still_beating_the_averages.md")
:nuzzle/published #inst "2022-06-08"
:nuzzle/author (data/authors :josh)
:nuzzle/feed true}

[:version]
{:nuzzle/title "Site Version"
:nuzzle/render-page pages/get-version}})

(defn develop [& _]
(nuzz/develop #'pages {:overlay-dir "resources"
:refresh-interval 2500}))

(defn serve [& _]
(nuzz/serve #'pages {:overlay-dir "resources"
:refresh-interval 2500}))

(defn publish [& _]
(nuzz/publish pages {:overlay-dir "resources"
:base-url data/base-url
:atom-feed {:title "Gaiwan Blog"
:description "The Gaiwan Blog"}
:publish-dir "_site"}))
93 changes: 32 additions & 61 deletions src/co/gaiwan/site/blog.clj
Original file line number Diff line number Diff line change
@@ -1,30 +1,27 @@
(ns co.gaiwan.site.blog
(:require [clj-rss.core :as rss]
[co.gaiwan.site.layout :as layout]
[co.gaiwan.site.md-files :as md-files]
[co.gaiwan.site.open-graph :as og]))
(:require [co.gaiwan.site.layout :as layout]
[co.gaiwan.site.open-graph :as og]
[co.gaiwan.site.utils :as utils]))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Components

(defn list-item [{:keys [html]
{:keys [title slug author date] :or {slug ""}} :meta
:as post}]
(defn list-item [{:nuzzle/keys [title url author published]}]
[:article {:class "flex items-center py-4 border-b border-gray-200"}
[:div
[:header
[:h2 {:class "h4 mb-2"}
[:a {:class "hover:underline" :href (str "/blog/" slug "/")}
[:a {:class "hover:underline" :href url}
title]]]
[:div {:class "text-lg text-gray-600 mb-4"} ""]
[:footer {:class "text-sm"}
[:div {:class "flex items-center"}
[:div [:span {:class "text-gray-600"} "By "]
[:span {:class "text-gray-600 font-medium hover:underline2"}
author]
(author :name)]
" "
[:span {:class "text-gray-600"} (.format (java.text.SimpleDateFormat. "MMM dd, yyyy") date)]]]]]
[:a {:class "block flex-shrink-0 ml-6" :href (str "/blog/" slug "/")}
[:span {:class "text-gray-600"} (utils/format-inst published)]]]]]
[:a {:class "block flex-shrink-0 ml-6" :href url}
[:span {:class "sr-only"} "Read more"]
[:svg
{:class "w-4 h-4 fill-current text-blue-600",
Expand All @@ -38,7 +35,7 @@
{:class
"relative mt-12 md:mt-0 md:w-64 md:ml-12 lg:ml-20 md:flex-shrink-0"}])

(defn section [posts]
(defn section [{:nuzzle/keys [get-pages] :as _page}]
[:section
[:div {:class "max-w-6xl mx-auto px-4 sm:px-6"}
[:div {:class "pt-24 pb-12 md:pt-32 md:pb-20"}
Expand All @@ -55,55 +52,29 @@
[:div {:class "md:flex md:justify-between"}
#_[:comment " Articles container "]
[:div {:class "md:flex-grow -mt-4"}
(for [post posts]
[list-item post])]
[sidebar]]]]])
(for [post (->> (get-pages [:blog] {:children true})
(sort-by :nuzzle/published)
reverse)]
(list-item post))]
(sidebar)]]]])

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Routes

(def posts (delay (md-files/slurp-dir "blog")))

(defn get-blog-rss [_]
{:status 200
:body (apply rss/channel-xml
{:title "Gaiwan Blog" :link "https://gaiwan.co/blog" :description "The Gaiwan Blog"}
(for [{:keys [meta html]} (vals @posts)
:let [{:keys [title slug author date]} meta]]
{:title title
:link (str "https://gaiwan.co/blog/" slug)
:description html
:author author
:pubDate (.toInstant date)}))})
(defn get-blog-item
[{:nuzzle/keys [author render-content published] :as page}]
(layout/layout
(og/social-tags page)
[:div {:class "post my-8 mx-auto px-2 container prose lg:prose-lg"}
[:h1 (:title meta)]
[:div.post-meta
"Posted on "
[:span (utils/format-inst published)]
" by "
[:span (let [{:keys [name twitter]} author]
(str name (when twitter (str " (" twitter ")"))))]]
(render-content)]))

(defn get-blog-item [request]
(let [{:keys [slug]} (:path-params request)
post (get @posts slug)]
{:status 200
:body {:slug slug
:post post}
:view (fn [{:keys [slug post] :as data}]
(let [{:keys [meta hiccup]} post]
[layout/layout
(og/social-tags {:title (:title meta)
:description (:description meta "")})
[:div {:class "post my-8 mx-auto px-2 container prose lg:prose-lg"}
[:h1 (:title meta)]
[:div.post-meta
"Posted on "
[:span (.format (java.text.SimpleDateFormat. "MMM dd, yyyy") (:date meta))]
" by "
[:span (:author meta)]]
hiccup]]))}))

(defn get-blog [_]
{:status 200
:body {:posts (reverse (sort-by (comp :date :meta) (vals @posts)))}
:view (fn [{:keys [posts]}]
[layout/layout
(og/social-tags {:image ""})
[:div
(section posts)]])})
(defn get-blog [page]
(layout/layout
(og/social-tags page)
[:div
(section page)]))

(defn freeze-data []
(map #(do {:slug %}) (keys @posts)))
8 changes: 4 additions & 4 deletions src/co/gaiwan/site/components/header.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@
[:a
{:class
"text-gray-800 font-bold hover:text-gray-900 px-3 lg:px-5 py-2 flex items-center transition duration-150 ease-in-out",
:href "/blog/"} "Blog"]]
:href [:blog]} "Blog"]]
[:li
[:a
{:class
"text-gray-800 font-bold hover:text-gray-900 px-3 lg:px-5 py-2 flex items-center transition duration-150 ease-in-out",
:href "/work/"} "Work"]]
:href [:work]} "Work"]]
[:li
[:a
{:class
Expand Down Expand Up @@ -81,15 +81,15 @@
[:li
[:a
{:class "flex text-gray-600 hover:text-gray-900 py-2",
:href "/about/"} "About us"]]
:href [:about]} "About us"]]
#_[:li
[:a
{:class "flex text-gray-600 hover:text-gray-900 py-2",
:href ""} "Tutorials"]]
[:li
[:a
{:class "flex text-gray-600 hover:text-gray-900 py-2",
:href "/blog/"} "Blog"]]
:href [:blog]} "Blog"]]
#_[:li {:class "py-2 my-2 border-t border-b border-gray-200"}
[:span {:class "flex text-gray-600 hover:text-gray-900 py-2"}
"Resources"]
Expand Down
Loading