Skip to content

Instantly share code, notes, and snippets.

@startuml
actor Actor
participant App
participant Email
participant Backend
participant DB
participant "Email Server" as EmailServer
== Actor Logs in ==
create table account
(
account_id int,
tenant_id int,
username varchar(20)
);
alter table account
add constraint username_must_be_unique
unique (
@supalogix
supalogix / movie_theater_definition.pls
Last active October 19, 2021 17:19
Movie Theater Definitions
-- Rule 1: No Seat Can Be Taken Twice
CREATE TABLE no_duplicate_seats_rule
(
showing_id integer,
seat_id integer
);
ALTER TABLE no_duplicate_seats_rule
ADD CONSTRAINT seat_is_already_taken
UNIQUE
#!/bin/bash
cpp event_sourcing_generator.dot -o event_sourcing.dot
dot -Tpng event_sourcing.dot -o event_sourcing.png
#define Actor(id, __label) \
id [label=__label fillcolor="yellow"];
#define Command(id, __label) \
id [label=__label fillcolor="lightblue"];
#define Event(id, __label) \
id [label=__label fillcolor="darkorange"];
#define Aggregate(id, __label) \
id [label=__label fillcolor="lightyellow"];
#define System(id, __label) \
id [label=__label fillcolor="pink"];
#include "common.dot"
digraph demo
{
node[shape=record style=filled]
Actor(Aa, "User")
Command(Ab, "Checkout")
Event(Ac, "Checkout\nSelected")
Event(Ac1, "Multiple\nOffers\nBundled")
digraph demo
{
node[shape=record style=filled]
Aa [label="User" fillcolor="yellow"];
Ab [label="Checkout" fillcolor="lightblue"];
Ac [label="Checkout\nSelected" fillcolor="darkorange"];
Ac1 [label="Multiple\nOffers\nBundled" fillcolor="darkorange"];
Ad [label="Mailing\nAddress\nProvided" fillcolor="darkorange"];
Ad1 [label="Billing\nAddress\nProvided" fillcolor="darkorange"];
@supalogix
supalogix / dijkstra.js
Created October 3, 2021 08:59 — forked from jpillora/dijkstra.js
Dijkstra's algorithm in JavaScript
//dijkstra solve graph starting at s
function solve(graph, s) {
var solutions = {};
solutions[s] = [];
solutions[s].dist = 0;
while(true) {
var parent = null;
var nearest = null;
var dist = Infinity;
function getCandidate(accumulator, word)
{
if(accumulator === "")
{
return word;
}
else
{
return accumulator + " " + word.trim();
}
Feature: Create Account
As a visitor
I want to create an account
So that I can use exclusive features of the site
Background: Fake data for Account Creation
Given the existing <account_name> and <email>
Examples: