From 05f7011266dec2ad0340754e40add8463d9091d4 Mon Sep 17 00:00:00 2001 From: skydread1 Date: Sat, 31 Aug 2024 00:02:54 +0800 Subject: [PATCH] Fix rss validator warning. They were due to missing blank line before code block and unescaped & in li and youtube link. --- src/loicb/server/content/blog/clj-in-unity.md | 4 ++++ .../server/content/blog/datomic-setup.md | 2 +- .../content/blog/deploy-clj-app-to-aws.md | 1 + .../content/blog/deploy-django-beanstalk.md | 1 - src/loicb/server/content/blog/fun-map.md | 1 - .../server/content/blog/juxt-tick-lib.md | 5 +++++ .../content/blog/lasagna-pull-flybot.md | 20 +++++++++---------- src/loicb/server/content/blog/lasagna-pull.md | 1 + .../content/blog/port-clj-lib-to-clr.md | 2 ++ .../server/content/blog/testing-in-clojure.md | 1 + 10 files changed, 25 insertions(+), 13 deletions(-) diff --git a/src/loicb/server/content/blog/clj-in-unity.md b/src/loicb/server/content/blog/clj-in-unity.md index f99ed64..1a00992 100644 --- a/src/loicb/server/content/blog/clj-in-unity.md +++ b/src/loicb/server/content/blog/clj-in-unity.md @@ -307,13 +307,17 @@ Finally, You can add Magic.Unity (runtime for magic inside Unity) in the manifes Once you have the proper required config files ready, you can use `Nostrand` to Build your dlls: + ``` nos dotnet/build ``` + Pack your dlls in a nuget package and push to a remote host: + ``` nos dotnet/nuget-push ``` + Import your packages in Unity: ``` nuget restore diff --git a/src/loicb/server/content/blog/datomic-setup.md b/src/loicb/server/content/blog/datomic-setup.md index d3dd520..3012131 100644 --- a/src/loicb/server/content/blog/datomic-setup.md +++ b/src/loicb/server/content/blog/datomic-setup.md @@ -18,7 +18,7 @@ While working on [flybot.sg](http://flybot.sg) , I experimented with `datomic-fr You can read the rationale of Datomic from their [on-prem documentation](https://docs.datomic.com/on-prem/getting-started/brief-overview.html) -Stuart Sierra explained very well how datomic works in the video [Intro to Datomic](https://www.youtube.com/watch?v=R6ObrDWTlYA&t=2776s). +Stuart Sierra explained very well how datomic works in the video [Intro to Datomic](https://www.youtube.com/watch?v=R6ObrDWTlYA). Basically, Datomic works as a layer on top of your underlying storage (in this case, we will use Cassandra db). diff --git a/src/loicb/server/content/blog/deploy-clj-app-to-aws.md b/src/loicb/server/content/blog/deploy-clj-app-to-aws.md index d2f845c..35eaf95 100644 --- a/src/loicb/server/content/blog/deploy-clj-app-to-aws.md +++ b/src/loicb/server/content/blog/deploy-clj-app-to-aws.md @@ -59,6 +59,7 @@ Example of jibbit config to just create a local docker image: ``` Then we can run the container: + ``` docker run \ --rm \ diff --git a/src/loicb/server/content/blog/deploy-django-beanstalk.md b/src/loicb/server/content/blog/deploy-django-beanstalk.md index b4532d8..81d886a 100644 --- a/src/loicb/server/content/blog/deploy-django-beanstalk.md +++ b/src/loicb/server/content/blog/deploy-django-beanstalk.md @@ -29,7 +29,6 @@ python -m venv blog_venv # activate env (mac) source blog_venv/bin/activate - ``` ### Install Django diff --git a/src/loicb/server/content/blog/fun-map.md b/src/loicb/server/content/blog/fun-map.md index f8a1b0f..1e7920b 100644 --- a/src/loicb/server/content/blog/fun-map.md +++ b/src/loicb/server/content/blog/fun-map.md @@ -175,7 +175,6 @@ As explained above, we could add some more diverse values, it wouldn’t be perc m ;=> {:numbers [3 4] :cnt 2 :multiply 12 :average 7/2} - ``` ### System diff --git a/src/loicb/server/content/blog/juxt-tick-lib.md b/src/loicb/server/content/blog/juxt-tick-lib.md index 428964b..a3a951b 100644 --- a/src/loicb/server/content/blog/juxt-tick-lib.md +++ b/src/loicb/server/content/blog/juxt-tick-lib.md @@ -43,6 +43,7 @@ The obvious advantage is the universal simplicity of representing time. The disa The local time is the time in a specific time zone, usually represented using a date and time-of-day without any time zone information. In java it is called `java.time.LocalDateTime`. However, `tick` mentioned that when you asked someone the time, it is always going to be "local", so they prefer to call it `date-time` as the local part is implicit. So if we ask Alice for the time and date, she will reply: + ```clojure (-> (t/time "12:00") (t/on "2024-01-20")) @@ -95,6 +96,7 @@ So far we have the following components to define a time: However, counter-intuitively, the UTC offset for Alice is not the same all year long. Sometimes it is `UTC+0` (`Z`) in winter (as we saw earlier) but sometimes it is `UTC+1` in summer. Let me prove it to you: + ```clojure ;; time for Alice in winter (-> (t/time "12:00") @@ -136,6 +138,7 @@ So we now have a complete way to describe the time: - a zone (that includes the location and the UTC encapsulating the DST) So the time for Bob is: + ```clojure (-> (t/time "12:00") (t/on "2024-01-20") @@ -176,6 +179,7 @@ We can see in the example above, that since Singapore is 8 hours ahead of London The `instant` is the human-friendly time representation of the timestamp (time since epoch). You can then store that format in your DB or do operation on it such as adding/substituting duration or period to it (more on this later). The `epoch` in time-since-epoch is equivalent to #time/instant "1970-01-01T00:00:00Z": + ```clojure (t/epoch) ;=> #time/instant "1970-01-01T00:00:00Z" @@ -236,6 +240,7 @@ We now know that we need to use `instant` to perform operations on time. However ``` They are not interchangeable: + ```clojure (t/new-period 10 :seconds) ; Execution error (IllegalArgumentException) at tick.core/new-period (core.cljc:649). diff --git a/src/loicb/server/content/blog/lasagna-pull-flybot.md b/src/loicb/server/content/blog/lasagna-pull-flybot.md index d172a8d..0fe7c1f 100644 --- a/src/loicb/server/content/blog/lasagna-pull-flybot.md +++ b/src/loicb/server/content/blog/lasagna-pull-flybot.md @@ -55,7 +55,7 @@ In our backend, we have a structure representing all our endpoints: This resembles a REST API structure. -Since the API “route” information is contained within the pattern keys themselves, all the http requests with a pattern as params can hit the same backend URI. +Since the API "route" information is contained within the pattern keys themselves, all the http requests with a pattern as params can hit the same backend URI. So we have a single route for all pattern http request: @@ -76,7 +76,7 @@ Therefore the pull pattern: ## Example: pull a post -For instance, getting a specific post, meaning with the “route”: `:posts :post`, can be done this way: +For instance, getting a specific post, meaning with the "route": `:posts :post`, can be done this way: ```clojure ((pull/qfn @@ -151,10 +151,10 @@ We decided to fetch all the information of the post in our pattern but we could {:post/id '? :post/page '?}}} '&?)) -=> {:posts - {:post - {:post/id #uuid "64cda032-b4e4-431e-bd85-0dbe34a8feeb" - :post/page :home}}} +;=> {:posts + {:post + {:post/id #uuid "64cda032-b4e4-431e-bd85-0dbe34a8feeb" + :post/page :home}}} ``` The function `(fn [post-id] (get-post db post-id))` returned **all** the post keys but we only select the `post/id` and `post/page`. @@ -242,9 +242,9 @@ It corresponds to the pattern part: (list :post :with [s/post-1-id]) ``` -And `lasagna-pull` provides validation of the function’s params which is very good to be sure the proper data is sent to the server! +And `lasagna-pull` provides validation of the function's params which is very good to be sure the proper data is sent to the server! -Plus, in case the params given to one of the routes are not valid, the function won’t even be executed. +Plus, in case the params given to one of the routes are not valid, the function won't even be executed. So now we have a way to do post request to our backend providing a pull-pattern as the request body and our server can validate this pattern format and content as the data is being pulled. @@ -331,7 +331,7 @@ In our case, we have a `mk-query` function that uses a `modifier` and `finalizer ### Example of post creation -Let’s have a look at an example: +Let's have a look at an example: We want to add a new post. When we make a request for a new post, if everything works fine, the pullable-data function at the route `:new-post` returns a map such as: @@ -371,7 +371,7 @@ Running this pattern with the pattern **context** above returns: :context/sessions {}} ``` -- the response has been returned from the :with function to the pattern in the ‘&? key +- the response has been returned from the :with function to the pattern in the `'&?` key - the effects have been accumulated and assoc in `:context/effects` - there was no data to be added to the session diff --git a/src/loicb/server/content/blog/lasagna-pull.md b/src/loicb/server/content/blog/lasagna-pull.md index 24841b2..e99783c 100644 --- a/src/loicb/server/content/blog/lasagna-pull.md +++ b/src/loicb/server/content/blog/lasagna-pull.md @@ -82,6 +82,7 @@ Let’s compare datomic pull and lasagna pull query with a simple example: ``` - Lasagna pull + ```clojure ((pull/query '[{:a ? :b {:b1 ?}}]) sample-data) diff --git a/src/loicb/server/content/blog/port-clj-lib-to-clr.md b/src/loicb/server/content/blog/port-clj-lib-to-clr.md index 97a1cc2..dfbe9de 100644 --- a/src/loicb/server/content/blog/port-clj-lib-to-clr.md +++ b/src/loicb/server/content/blog/port-clj-lib-to-clr.md @@ -238,6 +238,7 @@ Note the vector required with the **splicing** reader conditional `#?@`. Since magic was created before `tools.deps` or `leiningen`, it has its own deps management system and the dedicated file for it is `project.edn`. Here is an example of a project.edn: + ```clojure {:name "My project" :source-paths ["src" "test"] @@ -273,6 +274,7 @@ In my case I named my nostrand namespace `dotnet.clj`. You cna have a look at the [clr.test.check/dotnet.clj](https://github.com/skydread1/clr.test.check/blob/magic/dotnet.clj), it is a port of clojure/test.check that compiles in both JVM and CLR. We have the following require: + ```clojure (:require [clojure.test :refer [run-all-tests]] [magic.flags :as mflags]) diff --git a/src/loicb/server/content/blog/testing-in-clojure.md b/src/loicb/server/content/blog/testing-in-clojure.md index 3627e4a..95750e0 100644 --- a/src/loicb/server/content/blog/testing-in-clojure.md +++ b/src/loicb/server/content/blog/testing-in-clojure.md @@ -151,6 +151,7 @@ After I `jack-in` using my *dev* alias form the `deps.edn` file, I can load the 3. *ctrl+alt+c* *t* (in the `fib-test` namespace): run the tests In the REPL, we see: + ```clojure clj꞉user꞉> ; Evaluating file: fib_test.clj