Commit graph

552 commits

Author SHA1 Message Date
Oliver Davies 92a3e001e1 feat: add links to common searches
Refs: #25
2022-10-19 22:02:54 +01:00
Oliver Davies 362f2335ec feat: add search functionality
Refs: #25
2022-10-19 22:01:11 +01:00
Oliver Davies 7ee59c28df feat: initial implementation of recommendations
An inititla implementation to add recommendations to the Daily List
page.

This is intentionally hidden until the feature is completed and the
styling is applied to each testimonial.
2022-10-19 21:17:10 +01:00
Oliver Davies dfdce8f144
docs(daily-email): add 2022-10-18 2022-10-19 12:35:17 +01:00
Oliver Davies dc72cbc91c
docs(daily-email): add 2022-10-12 2022-10-18 23:55:09 +01:00
Oliver Davies a9a64beb07 fix(daily-emails): change pubDate 2022-10-17 22:12:05 +01:00
Oliver Davies 1e7237ebea docs(daily-email): add 2022-10-17 2022-10-17 22:06:21 +01:00
Oliver Davies e25bc7007a docs: add missing syntax highlighting 2022-10-16 13:10:16 +01:00
Oliver Davies 52836ee597 fix: duplicate background color in code blocks 2022-10-16 13:07:59 +01:00
Oliver Davies 7d91a71917 fix: add the correct import 2022-10-16 12:52:45 +01:00
Oliver Davies f9df869c24 refactor: remove unused import 2022-10-16 12:52:23 +01:00
Oliver Davies 1ed365b129 refactor: extract getSlugFromFile() 2022-10-16 11:13:09 +01:00
Oliver Davies ee4f48abcd refactor(talks): use flatMap and size methods 2022-10-16 01:01:01 +01:00
Oliver Davies 217e98b7e3
docs(daily-email): add 2022-10-11 2022-10-15 17:24:18 +01:00
Oliver Davies 490aafca9b feat: re-add About Me block 2022-10-15 16:50:48 +01:00
Oliver Davies 535b4fef45 docs(talks): add mob programming talk 2022-10-15 16:14:54 +01:00
Oliver Davies 9e2b8196bd feat(talks): make talk count dynamic 2022-10-15 16:14:41 +01:00
Oliver Davies d2244d084c docs(talks): mark talks as online 2022-10-15 16:14:41 +01:00
Oliver Davies ad3c9171f7 refactor(talks): extract talk components 2022-10-15 16:14:37 +01:00
Oliver Davies d34d3415c1 feat: re-add events to talk pages 2022-10-15 00:33:17 +01:00
Oliver Davies 6e94d52f90 fix: re-add description 2022-10-15 00:03:28 +01:00
Oliver Davies 43ef7c2c70
docs(daily-emails): add 2022-10-10 2022-10-14 23:54:41 +01:00
Oliver Davies 6d7adf8c35 feat: re-add 404 page 2022-10-13 09:14:22 +01:00
Oliver Davies 5c4e54152a refactor: extract a Markdown component 2022-10-13 08:55:38 +01:00
Oliver Davies 18a1dd0e03 fix: remove unwanted URLs for daily emails 2022-10-13 08:49:55 +01:00
Oliver Davies 69112f3976 fix: add article content to description 2022-10-13 00:15:24 +01:00
Oliver Davies 5efaf23eca chore(daily-email): re-add form 2022-10-10 23:02:27 +01:00
Oliver Davies 5f7acceb93 docs(daily-email): add email 2022-10-10 22:58:04 +01:00
Oliver Davies 1cedd10c90 chore: re-add Plausible Analytics 2022-10-10 21:07:51 +01:00
Oliver Davies d1b76dda33 chore: replace Sculpin with Astro 2022-10-10 20:50:54 +01:00
Oliver Davies d0ef96dead
fix(daily-emails): typo 2022-10-08 22:44:27 +01:00
Oliver Davies fd8975c2b3
docs(daily-email): add 2022-10-08 2022-10-08 22:43:32 +01:00
Oliver Davies 3407a052b0
docs(daily-email): add 2022-10-03 2022-10-05 07:33:26 +01:00
Oliver Davies 1c317feeac
docs(daily-email): add 2022-10-02 2022-10-04 00:57:10 +01:00
Oliver Davies c935c174b0
docs(daily-email): add 2022-10-01.md 2022-10-03 00:55:57 +01:00
Oliver Davies f99561e66a docs(daily-email): add post
diff --git a/ansible/ansible.cfg b/ansible/ansible.cfg
deleted file mode 100644
index cc79c59..0000000
--- a/ansible/ansible.cfg
+++ /dev/null
@@ -1,2 +0,0 @@
-[defaults]
-inventory = ./hosts.ini
diff --git a/ansible/deploy.yml b/ansible/deploy.yml
deleted file mode 100644
index ea5647a..0000000
--- a/ansible/deploy.yml
+++ /dev/null
@@ -1,14 +0,0 @@
----
-- hosts: web
-  gather_facts: false
-
-  tasks:
-    - name: Update the code
-      git:
-        repo: https://github.com/opdavies/oliverdavies.uk
-        dest: ~/oliverdavies.uk
-
-    - name: Pull the latest images and re-generate the site.
-      shell: ./run run-production
-      args:
-        chdir: ~/oliverdavies.uk
diff --git a/ansible/hosts.ini b/ansible/hosts.ini
deleted file mode 100644
index 01a3341..0000000
--- a/ansible/hosts.ini
+++ /dev/null
@@ -1,5 +0,0 @@
-[web]
-18.132.197.147
-
-[web:vars]
-ansible_user=ubuntu
diff --git a/website/source/_daily_emails/2022-09-30.md b/website/source/_daily_emails/2022-09-30.md
new file mode 100644
index 0000000..f5a63eb
--- /dev/null
+++ b/website/source/_daily_emails/2022-09-30.md
@@ -0,0 +1,83 @@
+---
+title: "Store Wars: different state management in Vue.js"
+date: "2022-09-30"
+permalink: "/archive/2022/09/30/store-wars-vuejs"
+tags: ["vue"]
+---
+
+I'm currently working on a Vue.js application that I started building in Vue 2 before starting to use the Composition API, and then moved it to Vue 3.
+
+In the original version, I was using Vuex for state management within the application, and interacting with Vuex directly within my Vue components - calling `getters` and `dispatch` to retrieve and update data.
+
+As part of moving to Vue 3, I wanted to evaluate any new options, like Pinia which is now the default state management library for Vue.
+
+But because I was integrating with Vuex directly, switching to an alternative would mean changing code within my components.
+
+## Defining a Store interface
+
+This is a situation that often occurs in back-end development - where you may need to switch to a different type of database or a different payment provider in an eCommerce application.
+
+In that situation, you need a generic interface that can be used by different implementations. Because they have consistent methods, one implementation can be replaced with another or multiple can be added at the same time. This is called the Strategy design pattern, and related to the open-closed principle in SOLID.
+
+This is what I did by adding a `Store` interface:
+
+```javascript
+export default interface Store {
+  actions: {
+    addRow(): void;
+    init(): void;
+    removeRow(index: Number): void;
+  };
+
+  state: {
+    isLoading: boolean;
+    selection: {
+      items: [];
+    };
+  };
+}
+```
+
+Any store that I want to work with needs to have these defined actions and state values, so I can use them within my components knowing that they will always be available.
+
+## Creating a native Vue store
+
+This is one implementation of the `Store` interface, using just Vue's `reactive` function from the Composition API:
+
+```javascript
+let state = reactive({
+  isLoading: false,
+  selection: {
+    items: [],
+  },
+});
+
+let actions = {
+  addRow(): void {
+    state.selection.items.push({
+      // ...
+    });
+  },
+
+  init(): void {
+    state.isLoading = true;
+
+    // ...
+  },
+
+  removeRow(index: number): void {
+    state.selection.items.splice(index, 1);
+  },
+};
+
+const vueStore: Store = {
+  actions,
+  state: readonly(state),
+};
+
+export default vueStore;
+```
+
+If I needed to add a Pinia version or another library, I can create another implementation that complies with same interface.
+
+Each implementation being responsible for any specifics for that library - extracting that logic from the component code making it more flexible and reusable.
2022-10-01 22:54:10 +01:00
Oliver Davies 3c7db24f1c ci: re-add deploy job
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index e4202a6..c0598b0 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -14,7 +14,7 @@ env:
   DOCKER_TAG: ${{ github.sha }}

 jobs:
-  build-and-push-images:
+  build:
     runs-on: ubuntu-latest
     steps:
       - uses: actions/checkout@5a4ac9002d # v2.3.4
@@ -33,4 +33,22 @@ jobs:
       - run: |
           just push-images ${{ github.sha }}

+  deploy:
+    runs-on: ubuntu-latest
+    needs:
+      - build
+    steps:
+      - uses: actions/checkout@5a4ac9002d # v2.3.4
+      - uses: extractions/setup-just@95b912dc5d # 1.5.0
+
+      - name: Add the deployment SSH key
+        uses: shimataro/ssh-key-action@3c9b0fc6f2 # 2.3.1
+        with:
+          key: ${{ secrets.SSH_PRIVATE_KEY }}
+          name: id_rsa
+          known_hosts: ${{ secrets.SSH_KNOWN_HOSTS }}
+
+      - run: |
+          just deploy ${{ github.sha }}
+
 # vim: sw=2 ts=2
diff --git a/justfile b/justfile
index e4916d1..5afe23d 100644
--- a/justfile
+++ b/justfile
@@ -12,11 +12,11 @@ create-daily:
   touch "${filepath}/${filename}"
   eval "${EDITOR}" "${filepath}/${filename}"

-deploy:
+deploy sha:
   rm -fr _deploy
   docker container rm oliverdavies.uk-build || true

-  docker image pull ghcr.io/opdavies/oliverdavies.uk-build
+  docker image pull ghcr.io/opdavies/oliverdavies.uk-build:{{ sha }}
   docker container run --entrypoint sh --name oliverdavies.uk-build ghcr.io/opdavies/oliverdavies.uk-build
   docker container cp oliverdavies.uk-build:/app/ _deploy
2022-09-30 00:20:19 +01:00
Oliver Davies 7baf281e8a ci: start replacing run with just 2022-09-29 23:19:08 +01:00
Oliver Davies 6d551e354d docs(daily-email): add a link to GitHub
diff --git a/website/source/_daily_emails/2022-09-28.md b/website/source/_daily_emails/2022-09-28.md
index e9f6378..44a5770 100644
--- a/website/source/_daily_emails/2022-09-28.md
+++ b/website/source/_daily_emails/2022-09-28.md
@@ -13,6 +13,8 @@ We worked on the FizzBuzz kata in PHP, using Pest for our automated tests.

 We followed the Driver and Navigator model, with one person responsible for the typing and interpreting the instructions from the Navigators, and switched roles every ten minutes.

+You can [see the code that we wrote](1da5dd5a79/php/tests/FizzBuzzTest.php) on my code katas GitHub repository.
+
 It was a fun experience and nice to code with some people who I hadn't coded with before.

 We did some code kata sessions during our online meetups which also seemed to go well, so coding nights on katas or personal or open-source projects might be something that we do more of in the future.
2022-09-29 22:26:06 +01:00
Oliver Davies ae023bc09e docs(daily-email): add post
diff --git a/website/source/_daily_emails/2022-09-28.md b/website/source/_daily_emails/2022-09-28.md
new file mode 100644
index 0000000..e9f6378
--- /dev/null
+++ b/website/source/_daily_emails/2022-09-28.md
@@ -0,0 +1,18 @@
+---
+title: "Mob programming at PHP South Wales"
+date: "2022-09-28"
+permalink: "/archive/2022/09/28/mob-programming-php-south-wales"
+tags: []
+---
+
+Tonight was our September meetup for the PHP South Wales user group, where I ran a hands-on session on mob programming.
+
+I created [a small slide deck](https://speakerdeck.com/opdavies/an-introduction-to-mob-programming) before we started a mob session with the group.
+
+We worked on the FizzBuzz kata in PHP, using Pest for our automated tests.
+
+We followed the Driver and Navigator model, with one person responsible for the typing and interpreting the instructions from the Navigators, and switched roles every ten minutes.
+
+It was a fun experience and nice to code with some people who I hadn't coded with before.
+
+We did some code kata sessions during our online meetups which also seemed to go well, so coding nights on katas or personal or open-source projects might be something that we do more of in the future.
2022-09-29 22:22:37 +01:00
Oliver Davies a0681d966b docs(daily-email): add post 2022-09-28 22:56:36 +01:00
Oliver Davies 0f471622cf docs(daily-email): add post 2022-09-27 08:25:03 +01:00
Oliver Davies 35d778bd79 docs(daily-email): add post 2022-09-26 10:28:05 +01:00
Oliver Davies ac54cda1a6 fix(daily-email): add content 2022-09-25 00:21:13 +01:00
Oliver Davies 14055e8eb0 docs(daily-email): add post
diff --git a/website/source/_daily_emails/2022-09-23.md b/website/source/_daily_emails/2022-09-23.md
new file mode 100644
index 0000000..3c5edb5
--- /dev/null
+++ b/website/source/_daily_emails/2022-09-23.md
@@ -0,0 +1,7 @@
+---
+title: "ADRs and Technical Design Documents"
+date: "2022-09-23"
+permalink: "/archive/2022/09/23/adrs-technical-design-documents"
+tags: []
+---
+
2022-09-25 00:15:44 +01:00
Oliver Davies d4e0439a6d chore: update redirects 2022-09-23 12:24:53 +01:00
Oliver Davies bed1b899cf chore: update page URL 2022-09-23 12:15:36 +01:00
Oliver Davies 2d213ba656 docs(daily-email): add post 2022-09-23 08:14:26 +01:00
Oliver Davies 3560fd0e9c docs: mark posts as draft 2022-09-22 00:30:17 +01:00
Oliver Davies abfdc6b079 docs(daily-email): add post 2022-09-22 00:11:38 +01:00