Skip to content

Instantly share code, notes, and snippets.

View Extheoisah's full-sized avatar

Theophilus Extheoisah

  • @btrustbuilders
  • Nigeria
  • X @extheo
View GitHub Profile
@Extheoisah
Extheoisah / arch.md
Last active August 20, 2024 06:33
This gist describes my thoughts on the way to implement the LMS server

So after having a chat with my friend chatGPT on how best to structure the LMS infra, I decided to use the hexagonal architecture pattern. I have used this pattern in the past for two of my projects both of which are live in production with active usage and the benefits have been profound. I admit that at the beginning, using this pattern has some technical implementattion overhead, but overtime it pays off.

This architecture emphasizes a clean separation between the core business logic (domain) and the external services, ensuring that the application remains flexible, testable, and maintainable.

Brief Overview

In Hexagonal Architecture, the application is divided into three main layers:

@Extheoisah
Extheoisah / db.schema
Last active August 21, 2024 13:32
HXCKR proposed db schema
Users {
id string pk
github_username string
username string
email string
profile_pic_url string
role enum(UserRole)
created_at timestamp
updated_at timestamp
}
@Extheoisah
Extheoisah / generate_blocks.sh
Created January 25, 2024 08:30 — forked from System-Glitch/generate_blocks.sh
Tutorial for bitcoin regtest
# Script to generate a new block every minute
# Put this script at the root of your unpacked folder
#!/bin/bash
echo "Generating a block every minute. Press [CTRL+C] to stop.."
address=`./bin/bitcoin-cli getnewaddress`
while :
do
@Extheoisah
Extheoisah / apollo-client.ts
Created October 20, 2023 05:33
Apollo-client setup
import { createClient } from "graphql-ws"
import fetch from "node-fetch"
import {
ApolloClient,
HttpLink,
InMemoryCache,
split
} from "@apollo/client/core"
import { GraphQLWsLink } from "@apollo/client/link/subscriptions"
@Extheoisah
Extheoisah / quotes-currency.txt
Last active September 19, 2023 09:00
Pro's and Con's of using one generic for a Quote type with two currencies
When you use generics in TypeScript, it provides you with the flexibility to type certain properties or functions without committing to a specific type upfront. This can be beneficial for code reusability and to maintain strong typing throughout your application.
In your current implementation, you're using two generics `F` and `T` to represent the source currency and target currency, respectively. Let's explore whether you can reduce this to one generic and the implications:
### Using a Single Generic:
#### Pros:
1. **Simplicity**: The code signature becomes slightly simpler, and it's easier to understand at a glance.
2. **Less Overhead**: You won't need to pass or handle two separate generics.

Keybase proof

I hereby claim:

  • I am extheoisah on github.
  • I am extheo (https://keybase.io/extheo) on keybase.
  • I have a public key ASDZ-bvL6EDFsZf909266sKPgRdJryQ6e-zZhl8HYDw-Fwo

To claim this, I am signing this object: