WIP: list posts
This commit is contained in:
parent
ccaea0145b
commit
dd8e3a95fc
@ -1,12 +1,12 @@
|
|||||||
|
{
|
||||||
|
id: "open-an-iex-shell-from-an-elixir-script"
|
||||||
|
}
|
||||||
|
|
||||||
---
|
---
|
||||||
title: "Open An IEx Shell From An Elixir Script"
|
title: "Open An IEx Shell From An Elixir Script"
|
||||||
blurb: "We can run an Elixir script with either the <code>elixir</code> or the <code>iex</code> command. Both will execute the code, but the second command opens an interactive IEx shell afterward. What if, we won't know until runtime whether we want a shell or not? How can we start an IEx session even when we use <code>elixir</code>, instead of <code>iex</code>, to run our script?"
|
blurb: "We can run an Elixir script with either the <code>elixir</code> or the <code>iex</code> command. Both will execute the code, but the second command opens an interactive IEx shell afterward. What if, we won't know until runtime whether we want a shell or not? How can we start an IEx session even when we use <code>elixir</code>, instead of <code>iex</code>, to run our script?"
|
||||||
...
|
...
|
||||||
|
|
||||||
{
|
|
||||||
id: "open-an-iex-shell-from-an-elixir-script"
|
|
||||||
}
|
|
||||||
|
|
||||||
## Method 1
|
## Method 1
|
||||||
|
|
||||||
Here's a quick test script:
|
Here's a quick test script:
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
|
{
|
||||||
|
id: "start-erlangs-dialyzer-with-gui-from-a-docker-container"
|
||||||
|
}
|
||||||
|
|
||||||
---
|
---
|
||||||
title: "Start Erlang's Dialyzer With GUI From A Docker Container"
|
title: "Start Erlang's Dialyzer With GUI From A Docker Container"
|
||||||
blurb: "Everything in OTP is command-line driven, so using containers during development has been without issue. But, Dialyzer, Erlang's static analysis tool, actually has a Graphical User Interface. How can we still use Dialyzer and its GUI even though Elixir is running inside a container?"
|
blurb: "Everything in OTP is command-line driven, so using containers during development has been without issue. But, Dialyzer, Erlang's static analysis tool, actually has a Graphical User Interface. How can we still use Dialyzer and its GUI even though Elixir is running inside a container?"
|
||||||
...
|
...
|
||||||
|
|
||||||
{
|
|
||||||
id: "start-erlangs-dialyzer-with-gui-from-a-docker-container"
|
|
||||||
}
|
|
||||||
|
|
||||||
I use Docker mostly when working on software projects and I figured out how to get Erlang's Dialyzer GUI working in a Docker container.
|
I use Docker mostly when working on software projects and I figured out how to get Erlang's Dialyzer GUI working in a Docker container.
|
||||||
|
|
||||||
1. Start a container with X11 forwarding:
|
1. Start a container with X11 forwarding:
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
---
|
|
||||||
blurb: "One thing we learned from a week of trying to make isometric vector drawings."
|
|
||||||
...
|
|
||||||
|
|
||||||
{
|
{
|
||||||
id: "fix-distortion-introduced-when-transforming-multiview-projections-to-isometric"
|
id: "fix-distortion-introduced-when-transforming-multiview-projections-to-isometric"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
---
|
||||||
|
blurb: "One thing we learned from a week of trying to make isometric vector drawings."
|
||||||
|
...
|
||||||
|
|
||||||
## Objective
|
## Objective
|
||||||
|
|
||||||
Construct an isometric vector image of an object from top, front, and side view projections (like [this](https://workforce.libretexts.org/Bookshelves/Drafting_and_Design_Technology/Introduction_to_Drafting_and_AutoCAD_3D_(Baumback)/02%3A_Part_2/2.01%3A_Module_7-_Visualizing_Multiview_Drawings), but using Inkscape instead of AutoCAD).
|
Construct an isometric vector image of an object from top, front, and side view projections (like [this](https://workforce.libretexts.org/Bookshelves/Drafting_and_Design_Technology/Introduction_to_Drafting_and_AutoCAD_3D_(Baumback)/02%3A_Part_2/2.01%3A_Module_7-_Visualizing_Multiview_Drawings), but using Inkscape instead of AutoCAD).
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
|
{
|
||||||
|
id: "deploy-elixir-generated-html-with-docker-on-digitalocean"
|
||||||
|
}
|
||||||
|
|
||||||
---
|
---
|
||||||
title: "Deploy Elixir-Generated HTML With Docker On DigitalOcean"
|
title: "Deploy Elixir-Generated HTML With Docker On DigitalOcean"
|
||||||
blurb: "This is a simple proof of concept where we create a boilerplate HTML file with Elixir, containerize our build process with Docker, and deploy our markup live with DigitalOcean's hosting service."
|
blurb: "This is a simple proof of concept where we create a boilerplate HTML file with Elixir, containerize our build process with Docker, and deploy our markup live with DigitalOcean's hosting service."
|
||||||
...
|
...
|
||||||
|
|
||||||
{
|
|
||||||
id: "deploy-elixir-generated-html-with-docker-on-digitalocean"
|
|
||||||
}
|
|
||||||
|
|
||||||
## Introduction
|
## Introduction
|
||||||
|
|
||||||
DigitalOcean has this [App Platform](https://www.digitalocean.com/products/app-platform) service that can host a static website, as well as build it from a Docker image, if provided a `Dockerfile`. We thought a static website built by an Elixir app could be an instructive project. To explore if the idea is viable, we wrote a small Elixir application that generates a simple `index.html` file and deployed it live on DigitalOcean's service.
|
DigitalOcean has this [App Platform](https://www.digitalocean.com/products/app-platform) service that can host a static website, as well as build it from a Docker image, if provided a `Dockerfile`. We thought a static website built by an Elixir app could be an instructive project. To explore if the idea is viable, we wrote a small Elixir application that generates a simple `index.html` file and deployed it live on DigitalOcean's service.
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
|
{
|
||||||
|
id: "test-mix-task-file-modify"
|
||||||
|
}
|
||||||
|
|
||||||
---
|
---
|
||||||
title: "Temporary Directories For Testing Mix Tasks That Modify Files"
|
title: "Temporary Directories For Testing Mix Tasks That Modify Files"
|
||||||
blurb: "Writing a test for a simple Mix task gets surprisingly complex. Application environment variables, temporary test directories, and IO capture are all involved."
|
blurb: "Writing a test for a simple Mix task gets surprisingly complex. Application environment variables, temporary test directories, and IO capture are all involved."
|
||||||
...
|
...
|
||||||
|
|
||||||
{
|
|
||||||
id: "test-mix-task-file-modify"
|
|
||||||
}
|
|
||||||
|
|
||||||
## Intro
|
## Intro
|
||||||
|
|
||||||
Last time, we added a Mix task to our project that writes an HTML file to a directory `/public` in the container's filesystem. Today, we will write a test for that task.
|
Last time, we added a Mix task to our project that writes an HTML file to a directory `/public` in the container's filesystem. Today, we will write a test for that task.
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
|
{
|
||||||
|
id: "build-static-website-generator-part-1"
|
||||||
|
}
|
||||||
|
|
||||||
---
|
---
|
||||||
title: "Build A Static-Website Generator With Elixir, Part 1"
|
title: "Build A Static-Website Generator With Elixir, Part 1"
|
||||||
blurb: "We take the first steps in designing and implementing the \"world's simplest static-website generator\". Building on tools and knowledge we acquired previously, and utilizing an incremental and iterative development process, we go through the entire software life-cycle from creating the initial project files to deploying to production. We spare nothing, from spelling out every command, to ensuring application integrity with tests, and even updating the README file. Grab a drink and some snacks, and dive right in!"
|
blurb: "We take the first steps in designing and implementing the \"world's simplest static-website generator\". Building on tools and knowledge we acquired previously, and utilizing an incremental and iterative development process, we go through the entire software life-cycle from creating the initial project files to deploying to production. We spare nothing, from spelling out every command, to ensuring application integrity with tests, and even updating the README file. Grab a drink and some snacks, and dive right in!"
|
||||||
...
|
...
|
||||||
|
|
||||||
{
|
|
||||||
id: "build-static-website-generator-part-1"
|
|
||||||
}
|
|
||||||
|
|
||||||
::: info
|
::: info
|
||||||
This post was originally intended to be the first in a multi-part series.
|
This post was originally intended to be the first in a multi-part series.
|
||||||
However, the deeper we got into this project, the more we realized we were
|
However, the deeper we got into this project, the more we realized we were
|
||||||
|
27
index.html
27
index.html
@ -7,30 +7,7 @@
|
|||||||
<!-- render templates/wares -->
|
<!-- render templates/wares -->
|
||||||
$render{"templates/wares"}
|
$render{"templates/wares"}
|
||||||
|
|
||||||
<!-- render moon-test -->
|
|
||||||
$render{"moon-test"}
|
|
||||||
|
|
||||||
<!-- render home -->
|
|
||||||
$render{"home"}
|
|
||||||
|
|
||||||
<h2>Posts</h2>
|
<h2>Posts</h2>
|
||||||
|
|
||||||
$each{posts, "post"}[[
|
<!-- render posts -->
|
||||||
<section>
|
$render{"posts"}
|
||||||
<h3>
|
|
||||||
<a href="$url_for{ id = "recursively-list-all-files-in-a-directory-with-elixir" }">
|
|
||||||
$post
|
|
||||||
</a>
|
|
||||||
</h3>
|
|
||||||
|
|
||||||
<time datetime="2025-01-18">Jan 18, 2025</time>
|
|
||||||
— blurb here
|
|
||||||
<a href="$url_for{ id = "recursively-list-all-files-in-a-directory-with-elixir" }" class="read-post-link">
|
|
||||||
Read post →
|
|
||||||
</a>
|
|
||||||
</section>
|
|
||||||
]]
|
|
||||||
|
|
||||||
$markdown{[[
|
|
||||||
#### [View more posts]($root/posts/)
|
|
||||||
]]}
|
|
||||||
|
24
index.md
24
index.md
@ -1,24 +0,0 @@
|
|||||||
{
|
|
||||||
date: "Thu May 08 2025 19:41:30.000000000"
|
|
||||||
}
|
|
||||||
|
|
||||||
## where is this??
|
|
||||||
|
|
||||||
$(<h1>asdfasdf</h1>)
|
|
||||||
|
|
||||||
$markdown{[[
|
|
||||||
- this is markdown
|
|
||||||
- also, sparta
|
|
||||||
]]}
|
|
||||||
|
|
||||||
$if{"val"}[[<h1>just some straight up text</h1>]]
|
|
||||||
|
|
||||||
$render{"templates/wares"}
|
|
||||||
|
|
||||||
$render{"moon-test"}
|
|
||||||
|
|
||||||
## Posts
|
|
||||||
|
|
||||||
- [recursive]($root/posts/2023-08-03-recursively-list-all-files-in-a-directory-with-elixir.html)
|
|
||||||
|
|
||||||
#### [View more posts]($root/posts/)
|
|
80
posts.moon
Normal file
80
posts.moon
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
-- html ->
|
||||||
|
--
|
||||||
|
-- posts = [{
|
||||||
|
-- id: p.meta.id
|
||||||
|
-- target: p.meta.target
|
||||||
|
-- source: p.source
|
||||||
|
-- } for _, p in pairs site.pages when p.meta.template == "blog"]
|
||||||
|
--
|
||||||
|
-- require("moon").p posts
|
||||||
|
-- div { "this is a post" }
|
||||||
|
-- div { "this anoter post" }
|
||||||
|
|
||||||
|
-- date = require "date"
|
||||||
|
-- return {
|
||||||
|
-- format: "markdown"
|
||||||
|
-- title: "My Site's Title"
|
||||||
|
-- {
|
||||||
|
-- title: "The First Post"
|
||||||
|
-- date: date 2011, 11, 26
|
||||||
|
-- link: "/my-post"
|
||||||
|
-- description: [[
|
||||||
|
-- The things I did.
|
||||||
|
--
|
||||||
|
-- * ordered pizza
|
||||||
|
-- * ate it
|
||||||
|
-- ]]
|
||||||
|
-- }
|
||||||
|
-- }
|
||||||
|
|
||||||
|
-- <section>
|
||||||
|
-- <h3>
|
||||||
|
-- <a href="/posts/publish-markdown-documents-as-static-web-pages-with-pandoc-and-phoenix">
|
||||||
|
-- Publish Markdown Documents As Static Web Pages with Pandoc and Phoenix
|
||||||
|
-- </a>
|
||||||
|
-- </h3>
|
||||||
|
--
|
||||||
|
-- <time datetime="2025-01-18">Jan 18, 2025</time>
|
||||||
|
-- — We thought we wanted a static website generator. It turns out what we really wanted was Phoenix, with an option to convert markdown to HTML. Here is our implementation of a solution, using our very own, recently-released, Pandoc Hex package!
|
||||||
|
-- <a href="/posts/publish-markdown-documents-as-static-web-pages-with-pandoc-and-phoenix" class="read-post-link">
|
||||||
|
-- Read post →
|
||||||
|
-- </a>
|
||||||
|
-- </section>
|
||||||
|
date = require "date"
|
||||||
|
date!
|
||||||
|
-- return {
|
||||||
|
-- format: "markdown"
|
||||||
|
-- title: "My Site's Title"
|
||||||
|
-- {
|
||||||
|
-- title: "The First Post"
|
||||||
|
-- date: date 2011, 11, 26
|
||||||
|
|
||||||
|
-- require("moon").p tostring(date(2011, 11, 26))
|
||||||
|
path = require "sitegen.path"
|
||||||
|
moon = require("moon")
|
||||||
|
common = require("sitegen.common")
|
||||||
|
|
||||||
|
get_date = (str) -> str
|
||||||
|
|
||||||
|
html ->
|
||||||
|
posts = [{
|
||||||
|
id: p.meta.id
|
||||||
|
target: p.meta.target
|
||||||
|
source: p.source
|
||||||
|
} for _, p in pairs page.site.pages when p.meta.template == "blog"]
|
||||||
|
|
||||||
|
[tag["section"] {
|
||||||
|
tag["h3"] { tag["a"] { href: p.target .. ".html", p.id }}
|
||||||
|
tag["time"] {
|
||||||
|
-- p.source
|
||||||
|
-- tostring(date(2011, 11, 26))
|
||||||
|
-- one = string.match(path.filename(p.source), "%d+%-%d%d%-%d%d%-")
|
||||||
|
-- r = string.gsub(one, "%-", " ")
|
||||||
|
-- r
|
||||||
|
get_date string.match(path.filename(p.source), "%d+%-%d%d%-%d%d")
|
||||||
|
-- common.slugify path.filename(p.target)
|
||||||
|
}
|
||||||
|
"— blurb here"
|
||||||
|
tag["a"] { class: "read-post-link", href: p.target .. ".html", "Read post →"}
|
||||||
|
} for _, p in ipairs posts]
|
||||||
|
|
70
site.moon
70
site.moon
@ -19,18 +19,84 @@ posts = (path=".") ->
|
|||||||
{join(path, file), target(file, "/posts") for _, file in ipairs files}
|
{join(path, file), target(file, "/posts") for _, file in ipairs files}
|
||||||
|
|
||||||
-- Change output dir to what Openresty prefers
|
-- Change output dir to what Openresty prefers
|
||||||
site = site!
|
-- site = site!
|
||||||
site.config.out_dir = "html/"
|
site.config.out_dir = "html/"
|
||||||
|
|
||||||
css = tools.system_command "cat < %s > %s", "css"
|
css = tools.system_command "cat < %s > %s", "css"
|
||||||
|
|
||||||
|
ps = posts("docs")
|
||||||
|
|
||||||
|
-- require("moon").p ps
|
||||||
|
|
||||||
|
files = [file for file in lfs.dir "docs" when file != "." and file != ".."]
|
||||||
|
|
||||||
|
-- sf = require("sitegen.site_file")
|
||||||
|
|
||||||
|
-- require("moon").p sf
|
||||||
|
|
||||||
|
-- for file in lfs.dir "docs" -- when file != "." and file != ".."
|
||||||
|
-- print rootname(last(split path))
|
||||||
|
-- print file
|
||||||
|
|
||||||
|
at = (one, two) ->
|
||||||
|
print "ANOTHER TEST"
|
||||||
|
require("moon").p two
|
||||||
|
|
||||||
|
html = require("sitegen.html")
|
||||||
|
|
||||||
|
one = () ->
|
||||||
|
html.build ->
|
||||||
|
tag.a { href: "momo", "yayaya" }
|
||||||
|
tag.a { href: "momo", "yayaya" }
|
||||||
|
|
||||||
sitegen.create =>
|
sitegen.create =>
|
||||||
@title = "WebDevCat.me · Catalin Mititiuc"
|
@title = "WebDevCat.me · Catalin Mititiuc"
|
||||||
@app_name = "stasis"
|
@app_name = "stasis"
|
||||||
@version = "0.2.12"
|
@version = "0.2.12"
|
||||||
@val = "yes"
|
@val = "yes"
|
||||||
|
@posts = (page) ->
|
||||||
|
-- require("moon").p [key for key in pairs page.site.pages[1]]
|
||||||
|
-- require("moon").p [key for key in pairs page.site]
|
||||||
|
-- posts = [{
|
||||||
|
-- id: p.meta.id
|
||||||
|
-- target: p.meta.target
|
||||||
|
-- source: p.source
|
||||||
|
-- } for _, p in pairs page.site.pages when p.meta.template == "blog"]
|
||||||
|
-- pages = [key for key, _ in pairs page for _, page in ipairs page.site.pages]
|
||||||
|
|
||||||
add "index.md"
|
-- posts = [{
|
||||||
|
-- id: p.meta.id
|
||||||
|
-- target: p.meta.target
|
||||||
|
-- source: p.source
|
||||||
|
-- } for _, p in pairs page.site.pages when p.meta.template == "blog"]
|
||||||
|
|
||||||
|
-- require("moon").p posts
|
||||||
|
-- posts
|
||||||
|
-- require("moon").p [key for key in pairs page.site]
|
||||||
|
-- require("moon").p [k for k,v in pairs page for _, page in ipairs pages]
|
||||||
|
-- require("moon").p [{page.meta, page.source} for _, page in ipairs pages when page.meta.template == "blog"]
|
||||||
|
-- require("moon").p [{dv} for k, dv in pairs(v) for _, v in pairs pages]
|
||||||
|
-- require("moon").p [k,v for key, v in pairs pages]
|
||||||
|
-- require("moon").p site.target
|
||||||
|
|
||||||
|
-- require("moon").p get_site
|
||||||
|
@test = (page) -> {{"b": 1, "c": 2}, {"d": 3, "e": 4}}
|
||||||
|
@what = (page) ->
|
||||||
|
-- require("moon").p [{ln, lv} for ln, lv in pairs debug.getlocal(2, idx)]
|
||||||
|
-- require("moon").p
|
||||||
|
"what?"
|
||||||
|
|
||||||
|
-- require("moon").p @
|
||||||
|
|
||||||
|
-- require("moon").p @site
|
||||||
|
|
||||||
|
add "index.html", o: one
|
||||||
add path, target: out, template: "blog" for path, out in pairs posts "docs"
|
add path, target: out, template: "blog" for path, out in pairs posts "docs"
|
||||||
|
-- add "test.html", id: "test"
|
||||||
|
-- feed "posts.moon", "feed.xml"
|
||||||
|
|
||||||
|
-- require("moon").p site
|
||||||
|
|
||||||
build css, "app.css"
|
build css, "app.css"
|
||||||
|
|
||||||
|
-- require("moon").p site
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
|
<h2><code>templates/index.html</code></h2>
|
||||||
|
|
||||||
$wrap{"root"}
|
$wrap{"root"}
|
||||||
|
|
||||||
<p>spacing guild</p>
|
|
||||||
|
|
||||||
$([[<h1>hi</h1>]])
|
|
||||||
|
|
||||||
<section>
|
<section>
|
||||||
<h2>Hi, I'm Catalin Mititiuc</h2>
|
<h2>Hi, I'm Catalin Mititiuc</h2>
|
||||||
<p>
|
<p>
|
||||||
@ -11,11 +9,6 @@ $([[<h1>hi</h1>]])
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>Hiring? Reach me by <a href="mailto:webdevcat@proton.me">email</a>.</p>
|
<p>Hiring? Reach me by <a href="mailto:webdevcat@proton.me">email</a>.</p>
|
||||||
|
|
||||||
$markdown{[[
|
|
||||||
**We can embed markdown directly into an HTML file!**
|
|
||||||
]]}
|
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
$body
|
$body
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
<link rel="stylesheet" href="$root/app.css?$generate_date" />
|
<link rel="stylesheet" href="$root/app.css?$generate_date" />
|
||||||
</head>
|
</head>
|
||||||
<body class="bg-white">
|
<body class="bg-white">
|
||||||
|
<h2><code>templates/root.html</code></h2>
|
||||||
<header>
|
<header>
|
||||||
<div style="display: inline-block;">
|
<div style="display: inline-block;">
|
||||||
<h1><a href="/">Web Dev Solutions</a></h1>
|
<h1><a href="/">Web Dev Solutions</a></h1>
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
<h2><code>templates/wares.html</code></h2>
|
||||||
|
|
||||||
<h2>Wares</h2>
|
<h2>Wares</h2>
|
||||||
|
|
||||||
<section>
|
<section>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user