This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Event: | |
| def __init__(self): | |
| self._subscribers = set() | |
| @property | |
| def subscribers(self): | |
| return self._subscribers.copy() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Allergen(models.Model): | |
| name = models.CharField(max_length=256, null=False, blank=False) | |
| class Ingredient(models.Model): | |
| name = models.CharField(max_length=255, null=False, blank=False) | |
| description = models.TextField(null=True, blank=False) | |
| allergens = models.ManyToManyField(Allergen) # -> this fields creates table | |
| may_contain = models.ManyToManyField(Extra) # between Ingredient and Allergen | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Singleton(object): | |
| _instance = None | |
| def __new__(cls, *args, **kwargs): | |
| if not cls._instance: | |
| cls._instance = super(Singleton, cls).__new__(cls, *args, **kwargs) | |
| return cls._instance |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <unistd.h> | |
| #define fx for(i = 0; i < x; i++) | |
| #define fy for(j = 0; j < y; j++) | |
| #define nl printf("\n"); | |
| #define apc ap[j * x + i] | |
| #define dc int i, j; |
NewerOlder