Skip to content

Instantly share code, notes, and snippets.

View Unit03's full-sized avatar

Jacek Kołodziej Unit03

View GitHub Profile
[
{
"abstract": null,
"authors": [
"Rodolfo Carvalho"
],
"conf_key": null,
"conf_url": "http://pl.pycon.org/2014/",
"contact": null,
"description": "So you need to expose data and functionality to mobile clients and a modern Javascript web applications? Deliver it fast and maintain it with ease by leveraging the power of Django REST Framework. In this talk I\u2019ll guide you through building a Web API using Python, Django and DRF.",
[
{
"abstract": null,
"authors": [
"Marek Glijer"
],
"conf_key": null,
"conf_url": "http://pl.pycon.org/2013/",
"contact": null,
"description": "Spos\u00f3b propagacji plik\u00f3w konfiguracyjnych na nieograniczonej liczbie maszyn (stworzenie za pomoc\u0105 Pythona mechanizmu dzia\u0142aj\u0105cego w architekturze rozproszonej i bez single-point-of-failure). Prezentacja od zamys\u0142u, przez proces tworzenia do przyk\u0142ad\u00f3w u\u017cycia w \u015brodowisku produkcyjnym.",

Keybase proof

I hereby claim:

  • I am unit03 on github.
  • I am unit03 (https://keybase.io/unit03) on keybase.
  • I have a public key whose fingerprint is A1D5 47C8 D361 C989 F11B 4784 BE05 D4A8 80DA 7936

To claim this, I am signing this object:

@Unit03
Unit03 / event.py
Last active October 8, 2019 20:53
Event Sourcing - event code sample
class MyEvent:
def __init__(self, foo: int):
"""For issuing new events in the application."""
self.foo = foo
@classmethod
def unserialize(cls, payload: dict) -> "MyEvent":
"""To use when fetching an existing event from the event log."""
return cls(foo=payload["foo"])
@Unit03
Unit03 / aggregate.py
Last active October 8, 2019 20:55
Event Sourcing - aggregate code sample
class MyAggregate:
@classmethod
def create(cls, ...) -> "MyAggregate":
"""For making a new aggregate. Should issue a "...Created" event."""
...
def do_stuff(self) -> None:
"""Command handler - for executing actions on the aggregate."""
...
@Unit03
Unit03 / repository.py
Created October 8, 2019 20:53
Event Sourcing - repository
class MyRepository:
def get(self, id_) -> MyAggregate:
"""Replay an aggregate from the event log."""
...
def persist(self, aggregate: MyAggregate) -> None:
self._insert_new_events(aggregate.pop_pending_events())