This file contains 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
version: "2.1" | |
services: | |
mysql: | |
image: mysql:5.6 | |
restart: always | |
environment: | |
MYSQL_ROOT_PASSWORD: PM-DBPassw0rd | |
networks: | |
- pm-net |
This file contains 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
public class OrderTest { | |
/** | |
* This test shows that a rich model gurantees that it is in a legal state | |
* at any time. | |
*/ | |
@Test | |
public void richDomainModelMustEnsureToBeConsistentAtAnyTime() { | |
Order order = new Order(); | |
BigDecimal total = order.getTotal(); |
This file contains 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
public class Order { | |
private BigDecimal total; | |
private List<OrderItem> items = new ArrayList<OrderItem>(); | |
/** | |
* The total is defined as the sum of all {@link OrderItem#getTotal()}. | |
* | |
* @return the total of this {@link Order}. | |
*/ |
This file contains 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 LocationManagerStub: LocationService { | |
var isLocationServiceAuthorized: Bool | |
init(isLocationServiceAuthorized: Bool) { | |
self.isLocationServiceAuthorized = isLocationServiceAuthorized | |
} | |
func isAuthorized() -> Bool { | |
return isLocationServiceAuthorized |
This file contains 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 MapViewModel { | |
// MARK: - Private Vars | |
private let locationService: LocationService | |
private let dateProviderService: DateProviderService | |
// MARK: - Init | |
init(locationService: LocationService, dateProviderService: DateProviderService) { | |
self.locationService = locationService |
This file contains 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 LocationManager: LocationService { | |
//.... | |
func isAuthorized() -> Bool { | |
switch authorizationStatus() { | |
case .authorizedAlways, | |
.authorizedWhenInUse: | |
return true | |
default: | |
return false |
This file contains 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
protocol LocationService { | |
//.... | |
func isAuthorized() -> Bool | |
func requestUserLocation(completion: ...) | |
//.... | |
} | |
protocol DateProviderService { | |
//.... | |
var date: Date { get } |
This file contains 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 LocationManager { | |
//.... | |
static func isAuthorized() -> Bool { | |
switch authorizationStatus() { | |
case .authorizedAlways, | |
.authorizedWhenInUse: | |
return true | |
default: | |
return false |
This file contains 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
# Python3 program to check for | |
# balanced brackets. | |
# function to check if | |
# brackets are balanced | |
def areBracketsBalanced(expr): | |
stack = [] |
This file contains 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
from telegram.ext import Updater, CommandHandler, MessageHandler, Filters | |
# Define a few command handlers. These usually take the two arguments update and | |
# context. Error handlers also receive the raised TelegramError object in error. | |
def start(update, context): | |
"""Send a message when the command /start is issued.""" | |
update.message.reply_text('Hi!') |
NewerOlder