100 lines
No EOL
12 KiB
JSON
100 lines
No EOL
12 KiB
JSON
{
|
|
"uuid": [
|
|
{
|
|
"value": "d6363924-78ee-4086-8cf0-41e07c030fd4"
|
|
}
|
|
],
|
|
"langcode": [
|
|
{
|
|
"value": "en"
|
|
}
|
|
],
|
|
"type": [
|
|
{
|
|
"target_id": "daily_email",
|
|
"target_type": "node_type",
|
|
"target_uuid": "8bde1f2f-eef9-4f2d-ae9c-96921f8193d7"
|
|
}
|
|
],
|
|
"revision_timestamp": [
|
|
{
|
|
"value": "2025-05-11T08:59:58+00:00"
|
|
}
|
|
],
|
|
"revision_uid": [
|
|
{
|
|
"target_type": "user",
|
|
"target_uuid": "b8966985-d4b2-42a7-a319-2e94ccfbb849"
|
|
}
|
|
],
|
|
"revision_log": [],
|
|
"status": [
|
|
{
|
|
"value": true
|
|
}
|
|
],
|
|
"uid": [
|
|
{
|
|
"target_type": "user",
|
|
"target_uuid": "b8966985-d4b2-42a7-a319-2e94ccfbb849"
|
|
}
|
|
],
|
|
"title": [
|
|
{
|
|
"value": "A reason why I like static site generators"
|
|
}
|
|
],
|
|
"created": [
|
|
{
|
|
"value": "2025-05-03T00:00:00+00:00"
|
|
}
|
|
],
|
|
"changed": [
|
|
{
|
|
"value": "2025-05-11T08:59:58+00:00"
|
|
}
|
|
],
|
|
"promote": [
|
|
{
|
|
"value": false
|
|
}
|
|
],
|
|
"sticky": [
|
|
{
|
|
"value": false
|
|
}
|
|
],
|
|
"default_langcode": [
|
|
{
|
|
"value": true
|
|
}
|
|
],
|
|
"revision_translation_affected": [
|
|
{
|
|
"value": true
|
|
}
|
|
],
|
|
"path": [
|
|
{
|
|
"alias": "\/daily\/2025\/05\/03\/like",
|
|
"langcode": "en"
|
|
}
|
|
],
|
|
"body": [
|
|
{
|
|
"value": "\n <p>Static site generators <a href=\"https:\/\/www.oliverdavies.uk\/presentations\/sculpin\">like Sculpin<\/a> don't have a database like Drupal.<\/p>\n\n<p>The files are the database.<\/p>\n\n<p>In [my website repository][3], the <code>source\/_presentations<\/code> directory contains the files for my presentation pages, so these could be considered the presentations table and rows.<\/p>\n\n<p>But, because my content is in plain text files, they're very easy and quick to search in a text editor or on the command line using tools like <code>grep<\/code>.<\/p>\n\n<p>It's very easy and fast for me to find an old daily email, blog post or article I've written when I need to.<\/p>\n\n<p>This is also why I use <a href=\"https:\/\/www.oliverdavies.uk\/presentations\/rst2pdf\">rst2pdf for my presentation slides<\/a> and write them in reStructured text. It's very fast to find and re-use content.<\/p>\n\n<h2 id=\"counting-my-presentations\">Counting my presentations<\/h2>\n\n<p>Another example is being able to quickly count the number of presentations I've given.<\/p>\n\n<p>Here's an example of the front matter section from one of my presentations:<\/p>\n\n<pre><code class=\"markdown\">events:\n - name: PHP South West\n date: 2024-02-14\n location: Bristol, UK\n urls:\n video: https:\/\/www.youtube.com\/watch?v=axy6ltc9meA\n demo: https:\/\/phpsw-sculpin-demo.oliverdavies.uk\n - name: BrumPHP\n date: 2024-05-23\n location: Birmingham, UK\n url: https:\/\/www.eventbrite.com\/e\/brumphp-23rd-may-2024-tickets-803037766577\n - name: PHP Berkshire\n date: 2024-08-28\n location: Reading, UK\n urls:\n slides: \/files\/presentations\/sculpin\/php-berkshire.pdf\n website: https:\/\/www.meetup.com\/php-berkshire\/events\/301850284\n - name: PHP Thames Valley\n date: 2026-03-20\n location: Oxford, UK\n urls:\n slides: \/files\/presentations\/sculpin\/php-thames-valley.pdf\n code: https:\/\/code.oliverdavies.uk\/opdavies\/sculpin-demo\/src\/branch\/php-thames-valley\n website: https:\/\/www.meetup.com\/php-thames-valley\/events\/305915971\n<\/code><\/pre>\n\n<p>Each presentation has a list of events, as most presentations I've given multiple times.<\/p>\n\n<p>Each event has a <code>date<\/code> that I can extract with <code>grep<\/code>:<\/p>\n\n<pre><code class=\"plain\">grep -r \"date:\" source\/_presentations\/*.md\n\nsource\/_presentations\/tdd-test-driven-drupal.md: date: 2020-12-08\nsource\/_presentations\/tdd-test-driven-drupal.md: date: 2023-10-17\nsource\/_presentations\/tdd-test-driven-drupal.md: date: 2024-05-10\nsource\/_presentations\/tdd-test-driven-drupal.md: date: 2024-11-20\nsource\/_presentations\/test-drive-twig-with-sculpin.md: date: 2015-07-25\nsource\/_presentations\/things-you-should-know-about-php.md: date: 2019-01-28\nsource\/_presentations\/things-you-should-know-about-php.md: date: 2022-03-09\nsource\/_presentations\/things-you-should-know-about-php.md: date: 2023-01-12\nsource\/_presentations\/upgrading-your-site-drupal-9.md: date: 2020-09-02\nsource\/_presentations\/upgrading-your-site-drupal-9.md: date: 2020-09-23\nsource\/_presentations\/upgrading-your-site-drupal-9.md: date: 2021-04-22\nsource\/_presentations\/using-illuminate-collections-outside-laravel.md: date: 2017-12-21\nsource\/_presentations\/using-illuminate-collections-outside-laravel.md: date: 2018-08-28\nsource\/_presentations\/working-without-workspace.md: date: 2023-04-06\nsource\/_presentations\/working-with-workspace.md: date: 2020-08-11\nsource\/_presentations\/working-with-workspace.md: date: 2020-09-09\nsource\/_presentations\/working-with-workspace.md: date: 2021-02-02\n<\/code><\/pre>\n\n<p>To count them, I can add <code>| wc -l<\/code> to count the number of lines.<\/p>\n\n<p>But what if I have presentations in the future I don't want to count?<\/p>\n\n<p>To show just the dates, I can pipe the output to <code>awk<\/code> and only print the last item:<\/p>\n\n<pre><code class=\"plain\">grep -r \"date:\" source\/_presentations\/*.md | awk '{ print $NF }'\n\n2020-12-08\n2023-10-17\n2024-05-10\n2024-11-20\n2015-07-25\n2019-01-28\n2022-03-09\n2023-01-12\n2020-09-02\n2020-09-23\n2021-04-22\n2017-12-21\n2018-08-28\n2023-04-06\n2020-08-11\n2020-09-09\n2021-02-02\n<\/code><\/pre>\n\n<p>I can sort them by adding <code>| sort<\/code>, but that doesn't matter in this case.<\/p>\n\n<p>To remove any future presentations, I can pass the current date to <code>awk<\/code>, filter based on the date and count the number of lines in the result:<\/p>\n\n<pre><code class=\"plain\">grep -r \"date:\" source\/_presentations\/*.md | awk -v today=\"$(date +%Y-%m-%d)\" '{ if ($NF < today) print $NF }' | wc -l\n\n104\n<\/code><\/pre>\n\n<p>This isn't how I'm calculating this on my website (I'm using a <a href=\"https:\/\/www.oliverdavies.uk\/daily\/2025\/05\/02\/extend\">custom Twig extension in Sculpin<\/a> for that), but this is an example of how multiple command line utilities can work together to perform a task - made possible using the static files from my website.<\/p>\n\n ",
|
|
"format": "full_html",
|
|
"processed": "\n <p>Static site generators <a href=\"https:\/\/www.oliverdavies.uk\/presentations\/sculpin\">like Sculpin<\/a> don't have a database like Drupal.<\/p>\n\n<p>The files are the database.<\/p>\n\n<p>In [my website repository][3], the <code>source\/_presentations<\/code> directory contains the files for my presentation pages, so these could be considered the presentations table and rows.<\/p>\n\n<p>But, because my content is in plain text files, they're very easy and quick to search in a text editor or on the command line using tools like <code>grep<\/code>.<\/p>\n\n<p>It's very easy and fast for me to find an old daily email, blog post or article I've written when I need to.<\/p>\n\n<p>This is also why I use <a href=\"https:\/\/www.oliverdavies.uk\/presentations\/rst2pdf\">rst2pdf for my presentation slides<\/a> and write them in reStructured text. It's very fast to find and re-use content.<\/p>\n\n<h2 id=\"counting-my-presentations\">Counting my presentations<\/h2>\n\n<p>Another example is being able to quickly count the number of presentations I've given.<\/p>\n\n<p>Here's an example of the front matter section from one of my presentations:<\/p>\n\n<pre><code class=\"markdown\">events:\n - name: PHP South West\n date: 2024-02-14\n location: Bristol, UK\n urls:\n video: https:\/\/www.youtube.com\/watch?v=axy6ltc9meA\n demo: https:\/\/phpsw-sculpin-demo.oliverdavies.uk\n - name: BrumPHP\n date: 2024-05-23\n location: Birmingham, UK\n url: https:\/\/www.eventbrite.com\/e\/brumphp-23rd-may-2024-tickets-803037766577\n - name: PHP Berkshire\n date: 2024-08-28\n location: Reading, UK\n urls:\n slides: \/files\/presentations\/sculpin\/php-berkshire.pdf\n website: https:\/\/www.meetup.com\/php-berkshire\/events\/301850284\n - name: PHP Thames Valley\n date: 2026-03-20\n location: Oxford, UK\n urls:\n slides: \/files\/presentations\/sculpin\/php-thames-valley.pdf\n code: https:\/\/code.oliverdavies.uk\/opdavies\/sculpin-demo\/src\/branch\/php-thames-valley\n website: https:\/\/www.meetup.com\/php-thames-valley\/events\/305915971\n<\/code><\/pre>\n\n<p>Each presentation has a list of events, as most presentations I've given multiple times.<\/p>\n\n<p>Each event has a <code>date<\/code> that I can extract with <code>grep<\/code>:<\/p>\n\n<pre><code class=\"plain\">grep -r \"date:\" source\/_presentations\/*.md\n\nsource\/_presentations\/tdd-test-driven-drupal.md: date: 2020-12-08\nsource\/_presentations\/tdd-test-driven-drupal.md: date: 2023-10-17\nsource\/_presentations\/tdd-test-driven-drupal.md: date: 2024-05-10\nsource\/_presentations\/tdd-test-driven-drupal.md: date: 2024-11-20\nsource\/_presentations\/test-drive-twig-with-sculpin.md: date: 2015-07-25\nsource\/_presentations\/things-you-should-know-about-php.md: date: 2019-01-28\nsource\/_presentations\/things-you-should-know-about-php.md: date: 2022-03-09\nsource\/_presentations\/things-you-should-know-about-php.md: date: 2023-01-12\nsource\/_presentations\/upgrading-your-site-drupal-9.md: date: 2020-09-02\nsource\/_presentations\/upgrading-your-site-drupal-9.md: date: 2020-09-23\nsource\/_presentations\/upgrading-your-site-drupal-9.md: date: 2021-04-22\nsource\/_presentations\/using-illuminate-collections-outside-laravel.md: date: 2017-12-21\nsource\/_presentations\/using-illuminate-collections-outside-laravel.md: date: 2018-08-28\nsource\/_presentations\/working-without-workspace.md: date: 2023-04-06\nsource\/_presentations\/working-with-workspace.md: date: 2020-08-11\nsource\/_presentations\/working-with-workspace.md: date: 2020-09-09\nsource\/_presentations\/working-with-workspace.md: date: 2021-02-02\n<\/code><\/pre>\n\n<p>To count them, I can add <code>| wc -l<\/code> to count the number of lines.<\/p>\n\n<p>But what if I have presentations in the future I don't want to count?<\/p>\n\n<p>To show just the dates, I can pipe the output to <code>awk<\/code> and only print the last item:<\/p>\n\n<pre><code class=\"plain\">grep -r \"date:\" source\/_presentations\/*.md | awk '{ print $NF }'\n\n2020-12-08\n2023-10-17\n2024-05-10\n2024-11-20\n2015-07-25\n2019-01-28\n2022-03-09\n2023-01-12\n2020-09-02\n2020-09-23\n2021-04-22\n2017-12-21\n2018-08-28\n2023-04-06\n2020-08-11\n2020-09-09\n2021-02-02\n<\/code><\/pre>\n\n<p>I can sort them by adding <code>| sort<\/code>, but that doesn't matter in this case.<\/p>\n\n<p>To remove any future presentations, I can pass the current date to <code>awk<\/code>, filter based on the date and count the number of lines in the result:<\/p>\n\n<pre><code class=\"plain\">grep -r \"date:\" source\/_presentations\/*.md | awk -v today=\"$(date +%Y-%m-%d)\" '{ if ($NF < today) print $NF }' | wc -l\n\n104\n<\/code><\/pre>\n\n<p>This isn't how I'm calculating this on my website (I'm using a <a href=\"https:\/\/www.oliverdavies.uk\/daily\/2025\/05\/02\/extend\">custom Twig extension in Sculpin<\/a> for that), but this is an example of how multiple command line utilities can work together to perform a task - made possible using the static files from my website.<\/p>\n\n ",
|
|
"summary": null
|
|
}
|
|
],
|
|
"feeds_item": [
|
|
{
|
|
"imported": "1970-01-01T00:33:45+00:00",
|
|
"guid": null,
|
|
"hash": "d941624a5b449961e856801045bb330f",
|
|
"target_type": "feeds_feed",
|
|
"target_uuid": "90c85284-7ca8-4074-9178-97ff8384fe76"
|
|
}
|
|
]
|
|
} |