From 68305711b27425dd88d6941ae72164c1a8843389 Mon Sep 17 00:00:00 2001 From: Ava Gaiety W Date: Wed, 13 Sep 2023 09:01:27 -0500 Subject: [PATCH] TIL --- .eleventy.js | 8 +++++ .obsidian/app.json | 3 +- .obsidian/workspace.json | 48 +++++++++++++++++++++++-- _includes/baselayout.njk | 2 +- _includes/indexlayout.njk | 2 +- _includes/tilindexlayout.njk | 21 +++++++++++ _includes/tillayout.njk | 35 ++++++++++++++++++ content/.obsidian/templates.json | 3 ++ content/.obsidian/workspace.json | 46 +++++++++++++++--------- content/index.md | 2 +- content/templates/post.md | 8 ----- content/til.md | 12 +++++++ content/tils/struct_pattern_matching.md | 16 +++++++++ content/tils/tils.json | 2 ++ 14 files changed, 177 insertions(+), 31 deletions(-) create mode 100644 _includes/tilindexlayout.njk create mode 100644 _includes/tillayout.njk create mode 100644 content/.obsidian/templates.json delete mode 100644 content/templates/post.md create mode 100644 content/til.md create mode 100644 content/tils/struct_pattern_matching.md create mode 100644 content/tils/tils.json diff --git a/.eleventy.js b/.eleventy.js index c07ac5b..c60544e 100644 --- a/.eleventy.js +++ b/.eleventy.js @@ -8,6 +8,14 @@ module.exports = function(eleventyConfig) { eleventyConfig.addPlugin(pluginRss); eleventyConfig.addPlugin(metagen); + eleventyConfig.addCollection("posts", function(collection) { + return collection.getFilteredByGlob("content/posts/**/*.md"); + }); + + eleventyConfig.addCollection("tils", function(collection) { + return collection.getFilteredByGlob("content/tils/**/*.md"); + }); + return { htmlTemplateEngine: "njk", markdownTemplateEngine: "md", diff --git a/.obsidian/app.json b/.obsidian/app.json index bf21f23..b3b406e 100644 --- a/.obsidian/app.json +++ b/.obsidian/app.json @@ -1,4 +1,5 @@ { "legacyEditor": false, - "livePreview": true + "livePreview": true, + "vimMode": true } \ No newline at end of file diff --git a/.obsidian/workspace.json b/.obsidian/workspace.json index 78c3ef8..62926f5 100644 --- a/.obsidian/workspace.json +++ b/.obsidian/workspace.json @@ -11,8 +11,12 @@ "id": "73b3910cd9e889d3", "type": "leaf", "state": { - "type": "empty", - "state": {} + "type": "markdown", + "state": { + "file": "content/tils/struct_pattern_matching.md", + "mode": "source", + "source": false + } } } ] @@ -81,6 +85,7 @@ "state": { "type": "backlink", "state": { + "file": "content/tils/struct_pattern_matching.md", "collapseAll": false, "extraContext": false, "sortOrder": "alphabetical", @@ -90,6 +95,16 @@ "unlinkedCollapsed": true } } + }, + { + "id": "97c1436caa6060e6", + "type": "leaf", + "state": { + "type": "all-properties", + "state": { + "sortOrder": "frequency" + } + } } ] } @@ -109,6 +124,35 @@ }, "active": "73b3910cd9e889d3", "lastOpenFiles": [ + "content/tils/tils.json", + "content/posts/a_modern_terminal_workflow_1.md", + "_site/tils/struct_pattern_matching/index.html", + "_site/tils/struct_pattern_matching", + "_site/til/index.html", + "_site/til", + "_site/index.html", + "_site/feed.xml", + "_site/posts/ultimate-dungeon-terrain/index.html", + "_site/posts/ultimate-dungeon-terrain", + "_site/posts/where_to_thrive_in_colorado/index.html", + "_site/posts/where_to_thrive_in_colorado", + "_site/posts/back-at-allovue.md", + "content/til.md", + "content/index.md", + "til.md", + "index.md", + "_site/images/ultimate-dungeon-terrain-3.jpg", + "_site/images/ultimate-dungeon-terrain-2.jpg", + "_site/images/ultimate-dungeon-terrain-1.jpg", + "_site/images/testjssummit-speakerbio.png", + "_site/images/thrive-colorado.jpg", + "_site/images/testjssummit.png", + "_site/images/testjssummit-slides.jpg", + "_site/images/testjssummit-happening.jpg", + "_site/images/screenshot_20190224-234525_firefox_focus.jpg", + "_site/images/screen-shot-2019-06-22-at-7.49.41-pm.png", + "content/tils/struct_pattern_matching.md", + "content/posts/a_modern_terminal_workflow_2.md", "content/posts/batch-of-kobolds.md", "content/posts/silhouette-spray-paintings.md", "content/posts/skillsengine.md", diff --git a/_includes/baselayout.njk b/_includes/baselayout.njk index 32f4590..d1b4028 100644 --- a/_includes/baselayout.njk +++ b/_includes/baselayout.njk @@ -1,5 +1,5 @@ - + diff --git a/_includes/indexlayout.njk b/_includes/indexlayout.njk index 2ac22ec..4ef40e7 100644 --- a/_includes/indexlayout.njk +++ b/_includes/indexlayout.njk @@ -1,6 +1,6 @@ --- pagination: - data: collections.all + data: collections.posts size: 9 alias: posts reverse: true diff --git a/_includes/tilindexlayout.njk b/_includes/tilindexlayout.njk new file mode 100644 index 0000000..59e53bc --- /dev/null +++ b/_includes/tilindexlayout.njk @@ -0,0 +1,21 @@ +{% extends "baselayout.njk" %} + +{% block main %} +
+

Inspired by Lee Byron's TIL entry log to learn in public.

+ {%- for post in collections.tils -%} + +
+ +
+ {%- endfor -%} +
+{% endblock %} diff --git a/_includes/tillayout.njk b/_includes/tillayout.njk new file mode 100644 index 0000000..e861efe --- /dev/null +++ b/_includes/tillayout.njk @@ -0,0 +1,35 @@ +{% extends "baselayout.njk" %} + +{% block header %} +
+

+ + + + Back + +

+ +

{{ title }}

+

{{ description }}

+
+{% endblock %} + +{% block main %} +
+
+ {{ content | safe }} +
+{% endblock %} + +{% block footer %} + + + + Back + +{% endblock %} diff --git a/content/.obsidian/templates.json b/content/.obsidian/templates.json new file mode 100644 index 0000000..d15c036 --- /dev/null +++ b/content/.obsidian/templates.json @@ -0,0 +1,3 @@ +{ + "folder": "" +} \ No newline at end of file diff --git a/content/.obsidian/workspace.json b/content/.obsidian/workspace.json index 3e33428..4357b4b 100644 --- a/content/.obsidian/workspace.json +++ b/content/.obsidian/workspace.json @@ -4,22 +4,29 @@ "type": "split", "children": [ { - "id": "abad0071a6be5701", + "id": "329dbf3048474732", "type": "tabs", "children": [ { - "id": "8b5977936f4ecf81", + "id": "3b2cd9884e9de93b", "type": "leaf", "state": { - "type": "markdown", + "type": "empty", + "state": {} + } + }, + { + "id": "f1067e4ded36bae9", + "type": "leaf", + "state": { + "type": "release-notes", "state": { - "file": "posts/multimedia_for_invisible.md", - "mode": "source", - "source": false + "currentVersion": "1.4.12" } } } - ] + ], + "currentTab": 1 } ], "direction": "vertical" @@ -85,7 +92,6 @@ "state": { "type": "backlink", "state": { - "file": "posts/multimedia_for_invisible.md", "collapseAll": false, "extraContext": false, "sortOrder": "alphabetical", @@ -102,7 +108,6 @@ "state": { "type": "outgoing-link", "state": { - "file": "posts/multimedia_for_invisible.md", "linksCollapsed": false, "unlinkedCollapsed": true } @@ -124,9 +129,7 @@ "type": "leaf", "state": { "type": "outline", - "state": { - "file": "posts/multimedia_for_invisible.md" - } + "state": {} } }, { @@ -144,9 +147,7 @@ "type": "leaf", "state": { "type": "file-properties", - "state": { - "file": "posts/multimedia_for_invisible.md" - } + "state": {} } } ], @@ -166,11 +167,22 @@ "command-palette:Open command palette": false } }, - "active": "8b5977936f4ecf81", + "active": "f1067e4ded36bae9", "lastOpenFiles": [ + "tils/tils.json", + "tils/struct_pattern_matching.md", + "til.md", + "index.md", + "tils/til.json", + "tils/example.md", + "tils", + "templates/til.md", + "templates/post.md", + "posts/til/example.md", + "posts/multimedia_for_invisible.md", + "posts/til", "images/multimedia_for_invisible.webp", "posts/where_to_thrive_in_colorado.md", - "posts/multimedia_for_invisible.md", "images/thrive-colorado.jpg", "posts/pronoun-monster.md", "posts/faetale-launch.md", diff --git a/content/index.md b/content/index.md index 672267e..8734587 100644 --- a/content/index.md +++ b/content/index.md @@ -12,4 +12,4 @@ description: Programming, art, design, and other queer things. Web Engineer by day who pretends to be a dog.\ Dog by night who pretends to be a programmer. -[Portfolio](https://gaiety.me/) — [Gitlab](https://gitlab.com/gaiety) — [Art](https://gaiety.gallery/) — [Youtube](https://www.youtube.com/channel/UCvgaIxGXIsEh8mVVlS50XWQ) +[TIL](/til) — [Portfolio](https://gaiety.me/) — [Gitlab](https://gitlab.com/gaiety) — [Art](https://gaiety.gallery/) — [Youtube](https://www.youtube.com/channel/UCvgaIxGXIsEh8mVVlS50XWQ) diff --git a/content/templates/post.md b/content/templates/post.md deleted file mode 100644 index bae7717..0000000 --- a/content/templates/post.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -title: {{title}} -description: -date: {{date}} -tags: - - Tech ---- - diff --git a/content/til.md b/content/til.md new file mode 100644 index 0000000..2cef1ef --- /dev/null +++ b/content/til.md @@ -0,0 +1,12 @@ +--- +eleventyExcludeFromCollections: true +layout: tilindexlayout +title: Gaiety's TIL +description: +--- + +# Gaiety's TIL + +Web Engineer Kobl + +[Blog](/) — [Portfolio](https://gaiety.me/) — [Gitlab](https://gitlab.com/gaiety) — [Art](https://gaiety.gallery/) — [Youtube](https://www.youtube.com/channel/UCvgaIxGXIsEh8mVVlS50XWQ) diff --git a/content/tils/struct_pattern_matching.md b/content/tils/struct_pattern_matching.md new file mode 100644 index 0000000..975b2c9 --- /dev/null +++ b/content/tils/struct_pattern_matching.md @@ -0,0 +1,16 @@ +--- +title: Struct Pattern Matching +date: Created +--- +[Pattern Matching in Elixir](https://elixir-lang.org/getting-started/pattern-matching.html) feels like half of the language and may consume half of my TIL before long. But, today was the first day I realized you could specify that a pattern match could not just verify the contents of a map, but that it comes from a specific struct. + +```elixir +defmodule Foo do + defstruct name: "Jade", age: 27 +end # Imagine similar for Bar and Baz... + +@spec my_example(%Foo{} | %Bar{}) :: %Baz() +def my_example(%Foo{} = foo), do:... +``` + +I'm finding this useful to be more specific in defining my expectations. As I continue to practice [TDD](https://www.agilealliance.org/glossary/tdd) I'm also practicing writing my [Elixir Typespecs](https://elixir-lang.org/getting-started/typespecs-and-behaviours.html) in the moment, rather than as an afterthought. \ No newline at end of file diff --git a/content/tils/tils.json b/content/tils/tils.json new file mode 100644 index 0000000..d15d2c7 --- /dev/null +++ b/content/tils/tils.json @@ -0,0 +1,2 @@ +{ "layout": "tillayout.njk" } +