Skip to content

Commit

Permalink
Improve some of the Blog articles (#60)
Browse files Browse the repository at this point in the history
* Improve some of the Blog articles

Fix some typos, add some nuances and fix some broken links
  • Loading branch information
skydread1 authored Aug 17, 2024
1 parent df9fcde commit e2df9a1
Show file tree
Hide file tree
Showing 21 changed files with 298 additions and 394 deletions.
Binary file added resources/public/assets/mcts/ucb1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/public/assets/mcts/ucb1_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/public/assets/mcts/ucb_bt.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 32 additions & 2 deletions resources/public/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,12 @@ p {
margin: 1rem 0rem;
}

pre {
margin: 1rem 0;
}

code {
color: var(--text-primary-color);
font-size: 1rem;
}

pre code {
Expand All @@ -167,14 +170,16 @@ a {
ul {
list-style-type: disc;
list-style-position: inside;
padding: 0.5rem 0;
}

ol {
list-style-position: inside;
padding: 0.5rem 0;
}

li {
padding-bottom: 0.5rem;
padding: 0.3rem 0;
}

li a {
Expand Down Expand Up @@ -975,3 +980,28 @@ section#about a {
section#about li {
padding: 1rem;
}

/* blog article specifics */

@media (min-width: 1024px) {

img[alt="Trunked Based Dev"] {
width: 50%;
}

img[alt="Feature Branching"] {
width: 50%;
}

img[alt="UCB1 formula"] {
width: 50%;
}

img[alt="UCB1 formula parts"] {
width: 50%;
}

img[alt="UCB1 applied to BT"] {
width: 50%;
}
}
78 changes: 40 additions & 38 deletions resources/public/main.js

Large diffs are not rendered by default.

128 changes: 26 additions & 102 deletions src/loicb/server/content/blog/clj-in-unity.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
:page :blog
:date ["2022-04-22"]
:title "Pack, Push and Import Clojure to Unity"
:repos [["Magic" "https://github.com/nasser/magic"]
["Nostrand" "https://github.com/nasser/nostrand"]
["Magic.Unity" "https://github.com/nasser/Magic.Unity"]]
:css-class "blog-clj-in-unity"
:tags ["Clojure" "Compiler" "CLR" "Unity"]
:image #:image{:src "/assets/loic-blog-logo.png"
Expand All @@ -11,7 +14,16 @@
+++
## Prerequisites

- Read the article: [Port your Clojure lib to the CLR with MAGIC](https://www.loicblanchard.me/#/blog/port-clojure-to-clr-with-magic)
Your Clojure library is assumed to be already compiled to dotnet.

To know how to do this, refer to the article: [Port your Clojure lib to the CLR with MAGIC](https://www.loicblanchard.me/blog/port-clj-lib-to-clr)

## Goal

In this article, I will show you:
- how to package your lib to nuget
- push it in to your host repo
- import in Unity in this article

## Build the dlls with Nostrand

Expand Down Expand Up @@ -73,7 +85,7 @@ You can find an example here: [clr.test.check.nuspec](https://github.com/skydrea

The `dependency` tag is required to indicate the targeted framework.

The `file` (using a wild card to avoid adding the files one by one) is required to add the dlls files that will be available for the consumer. So the target must be `lib\{TFM}`.
The `file` (using a wild card to avoid adding the files one by one) is required to add the dlls files that will be available for the consumer. So the target must be `lib\TFM`.

In our case, Unity recommends to use `netstandard2.0` so our target is `lib\netstandard2.0`.

Expand Down Expand Up @@ -257,107 +269,8 @@ nuget restore -NoCache
Here is the packages tree of our project for instance:

```bash
~/workspaces/unity-projects/hjdcdd/Assets/ClojureLibs:tree
~/workspaces/unity-projects/my-proj:
.
├── Magic.Unity.1.0.0
│   ├── Magic.Unity.1.0.0.nupkg
│   ├── content
│   │   ├── Editor
│   │   │   ├── Shell.cs
│   │   │   └── Window.cs
│   │   └── Magic.Unity.cs
│   └── lib
│   └── netstandard2.0
│   ├── Clojure
│   │   ├── clojure.clr.io.clj.dll
│   │   ├── clojure.clr.shell.clj.dll
│   │   ├── clojure.core.clj.dll
│   │   ├── clojure.core.protocols.clj.dll
│   │   ├── clojure.core.reducers.clj.dll
│   │   ├── clojure.core.server.clj.dll
│   │   ├── clojure.core.specs.alpha.clj.dll
│   │   ├── clojure.core_clr.clj.dll
│   │   ├── clojure.core_deftype.clj.dll
│   │   ├── clojure.core_print.clj.dll
│   │   ├── clojure.core_proxy.clj.dll
│   │   ├── clojure.data.clj.dll
│   │   ├── clojure.datafy.clj.dll
│   │   ├── clojure.edn.clj.dll
│   │   ├── clojure.genclass.clj.dll
│   │   ├── clojure.gvec.clj.dll
│   │   ├── clojure.instant.clj.dll
│   │   ├── clojure.main.clj.dll
│   │   ├── clojure.pprint.cl_format.clj.dll
│   │   ├── clojure.pprint.clj.dll
│   │   ├── clojure.pprint.column_writer.clj.dll
│   │   ├── clojure.pprint.dispatch.clj.dll
│   │   ├── clojure.pprint.pprint_base.clj.dll
│   │   ├── clojure.pprint.pretty_writer.clj.dll
│   │   ├── clojure.pprint.print_table.clj.dll
│   │   ├── clojure.pprint.utilities.clj.dll
│   │   ├── clojure.repl.clj.dll
│   │   ├── clojure.set.clj.dll
│   │   ├── clojure.spec.alpha.clj.dll
│   │   ├── clojure.spec.gen.alpha.clj.dll
│   │   ├── clojure.stacktrace.clj.dll
│   │   ├── clojure.string.clj.dll
│   │   ├── clojure.template.clj.dll
│   │   ├── clojure.test.clj.dll
│   │   ├── clojure.tools.analyzer.ast.clj.dll
│   │   ├── clojure.tools.analyzer.clj.dll
│   │   ├── clojure.tools.analyzer.env.clj.dll
│   │   ├── clojure.tools.analyzer.passes.cleanup.clj.dll
│   │   ├── clojure.tools.analyzer.passes.clj.dll
│   │   ├── clojure.tools.analyzer.passes.elide_meta.clj.dll
│   │   ├── clojure.tools.analyzer.passes.source_info.clj.dll
│   │   ├── clojure.tools.analyzer.passes.trim.clj.dll
│   │   ├── clojure.tools.analyzer.utils.clj.dll
│   │   ├── clojure.uuid.clj.dll
│   │   ├── clojure.walk.clj.dll
│   │   └── clojure.zip.clj.dll
│   ├── Clojure.Runtime
│   │   └── Clojure.dll
│   ├── IL2CPP
│   │   ├── Magic.IL2CPP.CLI.exe
│   │   ├── Magic.IL2CPP.CLI.exe.config
│   │   ├── Magic.IL2CPP.CLI.pdb
│   │   ├── Magic.IL2CPP.Patches.dll
│   │   ├── Magic.IL2CPP.Patches.pdb
│   │   ├── Mono.Cecil.Mdb.dll
│   │   ├── Mono.Cecil.Pdb.dll
│   │   ├── Mono.Cecil.Rocks.dll
│   │   └── Mono.Cecil.dll
│   ├── Magic
│   │   ├── LineEditor.dll
│   │   ├── mage.core.clj.dll
│   │   ├── magic.analyzer.analyze_host_forms.clj.dll
│   │   ├── magic.analyzer.binder.clj.dll
│   │   ├── magic.analyzer.clj.dll
│   │   ├── magic.analyzer.collect_closed_overs.clj.dll
│   │   ├── magic.analyzer.errors.clj.dll
│   │   ├── magic.analyzer.generated_types.clj.dll
│   │   ├── magic.analyzer.intrinsics.clj.dll
│   │   ├── magic.analyzer.literal_reinterpretation.clj.dll
│   │   ├── magic.analyzer.loop_bindings.clj.dll
│   │   ├── magic.analyzer.novel.clj.dll
│   │   ├── magic.analyzer.reflection.clj.dll
│   │   ├── magic.analyzer.remove_local_children.clj.dll
│   │   ├── magic.analyzer.typed_passes.clj.dll
│   │   ├── magic.analyzer.types.clj.dll
│   │   ├── magic.analyzer.uniquify.clj.dll
│   │   ├── magic.analyzer.untyped_passes.clj.dll
│   │   ├── magic.analyzer.util.clj.dll
│   │   ├── magic.api.clj.dll
│   │   ├── magic.core.clj.dll
│   │   ├── magic.emission.clj.dll
│   │   ├── magic.flags.clj.dll
│   │   ├── magic.interop.clj.dll
│   │   ├── magic.intrinsics.clj.dll
│   │   ├── magic.spells.lift_keywords.clj.dll
│   │   ├── magic.spells.lift_vars.clj.dll
│   │   └── magic.util.clj.dll
│   └── Magic.Runtime
│   └── Magic.Runtime.dll
├── clr.test.check-legacy.1.1.1
│   ├── clr.test.check-legacy.1.1.1.nupkg
│   └── lib
Expand All @@ -378,6 +291,17 @@ Here is the packages tree of our project for instance:
│      └── domain.my_prate_lib.core.utils.clj.dll
```

Finally, You can add Magic.Unity (runtime for magic inside Unity) in the manifest.json like so:

```json
{
"dependencies": {
...,
"sr.nas.magic.unity": "https://github.com/nasser/Magic.Unity.git"
}
}
```

## Conclusion

Once you have the proper required config files ready, you can use `Nostrand` to
Expand Down
30 changes: 16 additions & 14 deletions src/loicb/server/content/blog/clj-mono-repo.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
:alt "Logo referencing Aperture Science"}}
+++
+++
## 🔸 Context
## Context

Our app [skydread1/flybot.sg](https://github.com/skydread1/flybot.sg) is a full-stack Clojure **web** and **mobile** app.

Expand All @@ -22,11 +22,11 @@ Note that the web app does not use NPM at all. However, the React Native mobile

By using only one `deps.edn`, we can easily starts the different parts of the app.

## 🔸 Goal
## Goal

The goal of this document is to highlight the mono-repo structure and how to run the different parts (dev, test, build etc).

## 🔸 Repo structure
## Repo structure

```
├── client
Expand Down Expand Up @@ -61,15 +61,15 @@ The goal of this document is to highlight the mono-repo structure and how to run
- `common` dir the `.cljc` files
- `clients` dir the `.cljs` files.

## 🔸 Deps Management
## Deps Management

You can have a look at the [deps.edn](https://github.com/skydread1/flybot.sg/blob/master/deps.edn).

We can use namespaced aliases in `deps.edn` to make the process clearer.

I will go through the different aliases and explain their purposes and how to I used them to develop the app.

## 🔸 Common libraries
## Common libraries

### clj and cljc deps

Expand Down Expand Up @@ -110,15 +110,15 @@ However, when you work on the frontend, you need to load the backend deps to hav

You can see that the **common** `cljc` files are being watched in both scenarios which makes sense since they "become" clj or cljs code depending on what REPL type you are currently working in.

## 🔸 Server aliases
## Server aliases

Following are the aliases used for the server:

- `:jvm-base`: JVM options to make datalevin work with java version > java8
- `:server/dev`: clj paths for the backend systems and tests
- `:server/test`: Run clj tests

## 🔸 Client common aliases
## Client common aliases

Following is the alias used for both web and mobile clients:

Expand All @@ -128,16 +128,16 @@ The extra-paths contains the `cljs` files.

We can note the `client/common/src` path that contains most of the `re-frame` logic because most subscriptions and events work on both web and react native right away!

The main differences between the re-frame logic for Reagent and Reagent Native are have to do with how to deal with Navigation and oauth2 redirection. That is the reason we have most of the logic in a **common** dir in `client`.
The main differences between the re-frame logic for Reagent and Reagent Native have to do with how to deal with Navigation and oauth2 redirection. That is the reason we have most of the logic in a **common** dir in `client`.

## 🔸 Mobile Client
## Mobile Client

Following are the aliases used for the **mobile** client:

- `:mobile/rn`: contains the cljs deps only used for react native. They are added on top of the client deps.
- `:mobile/ios`: starts the figwheel REPL to work on iOS.

## 🔸 Web Client
## Web Client

Following are the aliases used for the **web** client:

Expand All @@ -146,7 +146,7 @@ Following are the aliases used for the **web** client:
- `:web/test`: runs the cljs tests
- `:web/test-headless`: runs the headless cljs tests (fot GitHub CI)

## 🔸 CI/CD aliases
## CI/CD aliases

### build.clj

Expand All @@ -166,21 +166,23 @@ Following is the alias used to build an image and push it to local docker or AWS

- `:jib`: build image and push to image repo

## 🔸 Antq
## Antq

Following is the alias used to points out outdated dependencies

- `:outdated`: prints the outdated deps and their last available version


## 🔸 Notes on Mobile CD
## Notes on Mobile CD

We have not released the mobile app yet, that is why there is no aliases related to CD for react native yet.

## 🔸 Conclusion
## Conclusion

This is one solution to handle server and clients in the same repo.

Feel free to consult the complete [deps.edn](https://github.com/skydread1/flybot.sg/blob/master/deps.edn) content.

It is important to have a clear directory structure to only load required namespaces and avoid errors.

Using `:extra-paths` and `:extra-deps` in deps.edn is important because it prevent deploying unnecessary namespaces and libraries on the server and client.
Expand Down
2 changes: 1 addition & 1 deletion src/loicb/server/content/blog/datomic-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ However, this will not work right away as we need to add a few configurations to

Regarding the transactor properties (datomic provides a template for a transactor with Cassandra storage), when we use docker, we need to pay attention to 3 properties:

- The [`localhost`](http://localhost) is now 0.0.0.0
- The `localhost` is now 0.0.0.0
- `alt-host` must be added with the container name (or IP) or the container running the app.
- `storage-access` must be set to `remote`

Expand Down
3 changes: 2 additions & 1 deletion src/loicb/server/content/blog/deploy-clj-app-to-aws.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
:page :blog
:date ["2023-01-20"]
:title "Deploy full stack Clojure website to AWS"
:repos [["Flybot" "https://github.com/skydread1/flybot.sg"]]
:css-class "blog-deploy-clj-aws"
:tags ["Clojure" "AWS" "Full-Stack"]
:image #:image{:src "/assets/loic-blog-logo.png"
:src-dark "/assets/loic-blog-logo.png"
:alt "Logo referencing Aperture Science"}}
+++
+++
This is an example of how to deploy a containerised full-stack Clojure app in AWS EC2.
This is an example of how to deploy a containerized full-stack Clojure app in AWS EC2.

I will use the [flybot.sg website](https://github.com/skydread1/flybot.sg) as example of app to deploy.

Expand Down
Loading

0 comments on commit e2df9a1

Please sign in to comment.