Skip to content

Commit

Permalink
Add initial project and slides
Browse files Browse the repository at this point in the history
  • Loading branch information
adam-arold committed May 25, 2024
1 parent 3a236d7 commit 1b9131b
Show file tree
Hide file tree
Showing 371 changed files with 76,069 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
build
.tsbuildinfo
53 changes: 53 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
"$schema": "https://json.schemastore.org/eslintrc.json",
"root": true,
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
}
},
"env": {
"browser": true,
"commonjs": true,
"es6": true
},
"extends": ["eslint:recommended"],
"overrides": [
{
"files": ["**/*.{ts,tsx}"],
"plugins": ["@typescript-eslint", "import"],
"parser": "@typescript-eslint/parser",
"settings": {
"import/internal-regex": "^~/",
"import/resolver": {
"node": {
"extensions": [".ts", ".tsx"]
},
"typescript": {
"alwaysTryTypes": true
}
}
},
"extends": [
"plugin:@typescript-eslint/recommended",
"plugin:import/recommended",
"plugin:import/typescript"
],
"rules": {
"import/no-unresolved": 0,
"import/export": 0
}
},
{
"files": [".eslintrc.cjs", "server.js"],
"env": {
"node": true
},
"rules": {
"import/no-unresolved": 0
}
}
]
}
43 changes: 43 additions & 0 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Simple workflow for deploying static content to GitHub Pages
name: Deploy static content to Pages

on:
# Runs on pushes targeting the default branch
push:
branches: ["master"]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

jobs:
# Single deploy job since we're just deploying
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
# Upload entire repository
path: './docs'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
59 changes: 59 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# See http://help.github.com/ignore-files/ for more about ignoring files.

# compiled output
dist/
build/
tmp/
/out-tsc
.tsbuildinfo

# dependencies
node_modules

# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace

# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json

# misc
/.sass-cache
/connect.lock
/coverage
/libpeerconnection.log
npm-debug.log
yarn-error.log
testem.log
/typings
/postgres-data
.env
package-lock.json

# System Files
.DS_Store
Thumbs.db

cache/
.cache/
sendgrid.env
scrap

# Slides

node_modules
.DS_Store
dist
*.local
.vite-inspect
.remote-assets
components.d.ts
Empty file added .nojekyll
Empty file.
13 changes: 13 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
engine-strict=true
use-node-version=20.11.1
# Peer dependencies are a nightmare. We set this to false to make them less so.
strict-peer-dependencies=false
# This prevents pnpm publish from running if we aren't on main, which can save you some headaches.
publish-branch=main
# This makes it so that exact versions are used when we run pnpm add.
save-prefix=""
# This option tells pnpm to only resolve local deps to the local files when the workspace: protocol is used,
# and to otherwise download published versions.
link-workspace-packages=false
shamefully-hoist=true
auto-install-peers=true
5 changes: 5 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Add files here to ignore them from prettier formatting

dist/
coverage/
build/
5 changes: 5 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"singleQuote": false,
"semi": true,
"tabWidth": 4
}
18 changes: 18 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"recommendations": [
"aaron-bond.better-comments",
"bierner.jsdoc-markdown-highlighting",
"christian-kohler.path-intellisense",
"dbaeumer.vscode-eslint",
"donjayamanne.git-extension-pack",
"eamodio.gitlens",
"esbenp.prettier-vscode",
"fabiospampinato.vscode-terminals",
"mikestead.dotenv",
"ms-azuretools.vscode-docker",
"ms-vscode-remote.remote-containers",
"ryanluker.vscode-coverage-gutters",
"rluvaton.vscode-vitest",
"vue.volar"
]
}
12 changes: 12 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"search.exclude": {
// Avoid polluting search results with lockfile content
"pnpm-lock.yaml": true
},
// Ensure VSCode uses pnpm instead of npm
"npm.packageManager": "pnpm",
// For those using file-nesting, nest the new files. E.g.:
"explorer.fileNesting.patterns": {
"package.json": "pnpm-workspace.yaml, pnpm-lock.yaml"
}
}
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
# effect-workshop
# Effect Workshop

> 💡 Note that this workshop is partially based on [this](https://www.youtube.com/watch?v=Lz2J1NBnHK4) workshop from Effect Days
77 changes: 77 additions & 0 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# Effect Workshop

## Best Practices

- Don't run effects in effects
- Function composition enables tree shaking
- Use `Effect` everywhere where it makes sense (don't use `Either`, `Option` if it is not necessary)
- `Either`/`Option` makes sense when interoping with non-effect code
- `Effect` is lazy, `Option` and `Either` are eager
- `Effect.*` functions accept `Option`/`Either` as parameters (overload)
- Don't block the executor (no `while(true)`)
- Whenever something is not clear check the type signatures

## Extras

## Traits

Like an `Iterator`

- Equal
- Can be used to implement deep equality
- Hash
- Data
- `Data.case` -> Implements `Equal` and `Hash` for you
- `Data.class` -> Same but with classes
- `Data.TaggedClass` -> Same but adds a tag
- `Data.TaggedEnum` -> Unions of case classes
- `Data.TaggedError` -> can `yield*` errors (no wrap)
- Branded types
- Creates distinct types that are specializations of primitive types
- Created with a constructor function that validates the input (eg `NonNegativeNumber`)
- Use `Brand.Brand<"<name>">
- Brand.nominal -> empty constructor function
- Brand.refined -> constructor with validation
-> use `Brand.error` to signal an error

## Testing ???

## Config Management ???

## How to handle nesting

- Use `gen`
- Use `Do`

## Useful functions

- `zip`: 2 effects -> 2 results in tuple
- `zipLeft`: 2 effects -> result of left
- `zipRight`: 2 effects -> result of right
- `flatMap` vs `zipRight` (depend or don't depend on result of previous result)
- `tap` vs `zipLeft`
- `andThen` -> combination of above
- Effect.all (with `mode`)

### Creating a `Context` manually

- `Context.empty`
- `pipe` + `Context.add`

### Using Deferred To Create a CountDownLatch

### Schema

- Explain `<A, I, R>`
- Simple types like `S.number`
- transform / S.transformOrFail
- Input: S.To
- Output: `S.From`
- is -> synchronous
- asserts -> throws
- validate -> Effectful validation
- encode / encodeSync / encodeEither / encodePromise / encodeOption
- decode ... -> does only transformation
- encodeUnknown ... -> does validation too
- decodeUnknown ... -> does validation too
- struct, union, array
84 changes: 84 additions & 0 deletions apps/eisenhower/INSTRUCTIONS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# Eisenhower Matrix App

An Eisenhower Matrix holds todos in four quadrants: Urgent and Important, Not Urgent and Important, Urgent and Not Important, and Not Urgent and Not Important.

The goal is to create a simple app that allows users to use the features listed below. No authentication is necessary. The app should be accessible through a HTTP API. No UI is necessary, simple CLI access (via `curl` for example) is sufficient.

## Features

### Create New Matrix

As a user I want to be able to create a new Eisenhower Matrix.

Parameters:

- name

No tasks should be present initially.

### List Matrices

As a user I want to be able to see a list of all matrices.

Parameters: none

This should return a summary of the matrices (id, name).

### List Tasks in Matrix

As a user I want to be able to list all my tasks in a matrix.

Parameters:

- id of the matrix

### Create New Task

As a user I want to be able to create a new Task in a quadrant (combination of urgency and importance).

Parameters:

- title
- description
- due date
- urgency
- importance

### Complete Task

As a user I want to be able to mark a Task as completed.

Parameters:

- id of the Task

### Delete Task

As a user I want to be able to delete a Task.

Parameters:

- id of the Task

### Get Task Notifications

As a user I want to get task notifications whenever there is a task that's past its due date. This notification should arrive via email.

> Note: This feature can be stubbed, i.e. it doesn't have to actually send an email. It's enough to print a message to the console.
### Create Excel Export

As a user I want to be able to create an Excel export of the matrices in the app.
Each matrix should have its own tab in the excel file, and tasks should be represented as rows.
The excel export is generated asynchronously and the file is written to the path specified by the user.

## Other Tasks

> Do these, if there is time left.
- Apart from the features above, the app should also be observable, and traces should be sent to Prometheus.
- The services should be unit tested
- Data should be persisted to an external database (e.g. PostgreSQL, SQLite, etc.)
- Use config management to import external configuration (PORT)
- Validate the input parameters using Schema
- Return an evelope from the endpoints (eg: `{data: [], success: true}`)
Loading

0 comments on commit 1b9131b

Please sign in to comment.