Skip to content

Instantly share code, notes, and snippets.

View danhawkins's full-sized avatar

Danny Hawkins danhawkins

View GitHub Profile
@danhawkins
danhawkins / dataflowexample.md
Last active February 16, 2025 15:52
Data Flow Example

Data flow Example

POST /api/fulfilment/orders

Request is received using a dedicated request struct CreateOrderRequest this request struct has all the relevant annotations and validations for that request ONLY, it can use shared records, something like types.AddressRequest but shared types MUST be setup for request validation also.

IMPORTANT do not use data from order service or API here as it will make it easy to break API contracts

the CreateOrderRequest will be validated using go validator and there is example code on how to use that. It will automatically run any nested validations, for available validations check go validator docs

module Webhooks
class HmacSignature
DIGEST = OpenSSL::Digest.new('sha1').freeze
def initialize(secret_token, payload_body)
@secret_token = secret_token
@payload_body = payload_body.to_s
end
def generate

This is an example of github rendering mermaidjs

sequence TD
  one --> two
  two --> three
  two --> four
@danhawkins
danhawkins / vail-webhook.md
Created December 20, 2022 02:51
Vail Webhook.md

Vail Webhook Ideas

In order to get more insights that can make for more interesting live and post game stats, we would like to get more information from the webhook

Terms

To avoid abigutiy for the sake of these examples

  • Lobby is the a lobby that has been created, regardless of how many maps played until the lobby is closed
  • Map full map played to 11 points
@danhawkins
danhawkins / command.ex
Created September 7, 2022 04:31
Command macro
defmodule Cmd.Command do
@moduledoc """
Utility for command definition, wrapping a design pattern into code
For our commands we will used type_embedded_schema to design an in memory schema
which will be used for the command payload
As well as this we require the developer to implement a changeset/2 function
"""
@danhawkins
danhawkins / reset_projections.ex
Created August 29, 2022 11:39
Reset Commanded projections (domain specific)
defmodule Mix.Tasks.ResetProjections do
@moduledoc """
Reset all system projects from events
"""
use Mix.Task
@projection_modules ~w(
Ivrl.Tournaments.Projectors.Tournament
Ivrl.Teams.Projectors.Team
Ivrl.Players.Projectors.Player
@danhawkins
danhawkins / rules.yaml
Last active August 1, 2022 10:03
Rules yaml
rules:
- index: 1
title: Code of Conduct
rules:
- text: |
Every participant in the International Virtual Reality League
("IVRL" or "the league") is expected to behave with respect towards
other players (not just league players), IVRL staff, officials,
production team, and game developers. By joining IVRL you become a
representative of the league and shall act accordingly. The
#!/bin/sh
# Name for the pod
LIVEBOOK_NAME="danny-livebook"
echo "Starting livebook"
kubectl run $LIVEBOOK_NAME \
--image=livebook/livebook
@danhawkins
danhawkins / start-livebook-pod.sh
Last active April 27, 2022 15:56
Start Livebook Pod
#!/bin/sh
# Name of our app/service and executable name from the release
SVC_NAME="test-svc"
EXEC_NAME="test_svc"
# Name for the pod
LIVEBOOK_NAME="danny-livebook"
# Fetch the require env from the service pod
@danhawkins
danhawkins / deploy.yaml
Last active April 19, 2022 15:36
K8s Deploy for test_svc
apiVersion: apps/v1
kind: Deployment
spec:
template:
spec:
containers:
- env:
- name: PHX_SERVER
value: "true"
- name: PHX_HOST