TIL
This commit is contained in:
parent
cadb93010e
commit
68305711b2
14 changed files with 177 additions and 31 deletions
|
@ -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",
|
||||
|
|
3
.obsidian/app.json
vendored
3
.obsidian/app.json
vendored
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"legacyEditor": false,
|
||||
"livePreview": true
|
||||
"livePreview": true,
|
||||
"vimMode": true
|
||||
}
|
48
.obsidian/workspace.json
vendored
48
.obsidian/workspace.json
vendored
|
@ -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",
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<html lang="en" class="bg-slate-700">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
pagination:
|
||||
data: collections.all
|
||||
data: collections.posts
|
||||
size: 9
|
||||
alias: posts
|
||||
reverse: true
|
||||
|
|
21
_includes/tilindexlayout.njk
Normal file
21
_includes/tilindexlayout.njk
Normal file
|
@ -0,0 +1,21 @@
|
|||
{% extends "baselayout.njk" %}
|
||||
|
||||
{% block main %}
|
||||
<main class="mt-12 max-w-md mx-auto grid gap-5 grid-cols-2 text-sm">
|
||||
<h3 class="text-center text-xs col-span-2 text-white">Inspired by <a class="underline" href="https://leebyron.com/til/">Lee Byron's TIL entry log</a> to <a class="underline" href="https://www.swyx.io/learn-in-public/">learn in public.</h3>
|
||||
{%- for post in collections.tils -%}
|
||||
<div class="flex flex-row text-white">
|
||||
<a href="{{ post.url }}">
|
||||
<h3 class="font-semibold">
|
||||
{{ post.data.title }}
|
||||
</h3>
|
||||
</a>
|
||||
</div>
|
||||
<div class="text-gray-300 text-right">
|
||||
<time datetime="{{ post.date.toISOString() }}">
|
||||
{{ post.date.toDateString() }}
|
||||
</time>
|
||||
</div>
|
||||
{%- endfor -%}
|
||||
</main>
|
||||
{% endblock %}
|
35
_includes/tillayout.njk
Normal file
35
_includes/tillayout.njk
Normal file
|
@ -0,0 +1,35 @@
|
|||
{% extends "baselayout.njk" %}
|
||||
|
||||
{% block header %}
|
||||
<div class="prose lg:prose-xl prose-invert m-auto text-center">
|
||||
<p class="text-left">
|
||||
<a href="/til" class="pt-4 pr-1 inline-flex items-center text-sm font-medium text-slate-300 hover:text-slate-100">
|
||||
<!-- Heroicon name: solid/arrow-narrow-left -->
|
||||
<svg class="mr-3 h-5 w-5 text-gray-400" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
|
||||
<path fill-rule="evenodd" d="M7.707 14.707a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 1.414L5.414 9H17a1 1 0 110 2H5.414l2.293 2.293a1 1 0 010 1.414z" clip-rule="evenodd" />
|
||||
</svg>
|
||||
Back
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<h1>{{ title }}</h1>
|
||||
<p>{{ description }}</p>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block main %}
|
||||
<main class="flex flex-col rounded-lg shadow-lg overflow-hidden mx-auto max-w-lg lg:max-w-xl mt-8">
|
||||
<div class="flex-1 bg-white p-6 flex flex-col justify-between prose prose-slate">
|
||||
{{ content | safe }}
|
||||
</main>
|
||||
{% endblock %}
|
||||
|
||||
{% block footer %}
|
||||
<a href="/til" class="pt-4 pr-1 inline-flex items-center text-sm font-medium text-slate-300 hover:text-slate-100">
|
||||
<!-- Heroicon name: solid/arrow-narrow-left -->
|
||||
<svg class="mr-3 h-5 w-5 text-gray-400" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
|
||||
<path fill-rule="evenodd" d="M7.707 14.707a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 1.414L5.414 9H17a1 1 0 110 2H5.414l2.293 2.293a1 1 0 010 1.414z" clip-rule="evenodd" />
|
||||
</svg>
|
||||
Back
|
||||
</a>
|
||||
{% endblock %}
|
3
content/.obsidian/templates.json
vendored
Normal file
3
content/.obsidian/templates.json
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"folder": ""
|
||||
}
|
46
content/.obsidian/workspace.json
vendored
46
content/.obsidian/workspace.json
vendored
|
@ -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",
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
---
|
||||
title: {{title}}
|
||||
description:
|
||||
date: {{date}}
|
||||
tags:
|
||||
- Tech
|
||||
---
|
||||
|
12
content/til.md
Normal file
12
content/til.md
Normal file
|
@ -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)
|
16
content/tils/struct_pattern_matching.md
Normal file
16
content/tils/struct_pattern_matching.md
Normal file
|
@ -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.
|
2
content/tils/tils.json
Normal file
2
content/tils/tils.json
Normal file
|
@ -0,0 +1,2 @@
|
|||
{ "layout": "tillayout.njk" }
|
||||
|
Loading…
Add table
Reference in a new issue