diff --git a/archetypes/default.md b/archetypes/default.md index 8687d7a..4ea6ce3 100644 --- a/archetypes/default.md +++ b/archetypes/default.md @@ -1,5 +1,5 @@ --- -autor: "gnussy contributors" +author: "gnussy contributors" title: "{{ replace .Name "-" " " | title }}" date: {{ .Date }} draft: true diff --git a/content/projects/day1-aoc-daniel.md b/content/projects/day1-aoc-daniel.md new file mode 100644 index 0000000..91c5b5a --- /dev/null +++ b/content/projects/day1-aoc-daniel.md @@ -0,0 +1,37 @@ +--- +author: "Daniel Boll" +title: "AoC - Day 1" +date: 2023-12-01T09:44:14-03:00 +description: "Using Elixir & OCaml" +draft: false +--- + +Uh, hi? + +```elixir +defmodule Day1 do + @spec part_one(String.t()) :: integer() + def part_one(file) do + load_file(file) + |> Enum.map(fn calibration -> + numbers = + calibration + |> String.split("") + |> Enum.filter(&Regex.match?(~r/\d/, &1)) + + numbers + |> Kernel.hd() + |> Kernel.<>(List.last(numbers)) + |> String.to_integer() + end) + |> Enum.sum() + end + + @spec load_file(String.t()) :: [String.t()] + def load_file(file) do + File.read!(file) + |> String.trim_trailing() + |> String.split("\n") + end +end +``` diff --git a/themes/tuna/layouts/_default/list.html b/themes/tuna/layouts/_default/list.html index d18bd48..27a180c 100644 --- a/themes/tuna/layouts/_default/list.html +++ b/themes/tuna/layouts/_default/list.html @@ -12,14 +12,46 @@ {{ .Content }}

{{ range .Pages }} - {{ .Title }} -
+
+
+ [{{ .Params.author }}] +
+
+ {{ .Title }} :: {{ .Description }} +
+
- {{ .Date.Format "2006 January 2" }} - - {{ .Description }} + {{ .Date.Format "2006 January 2" }} + +
-
{{ end }}
+ {{ end }}