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
| #!/bin/bash | |
| set -e | |
| SCRIPT_DIR=$(cd $(dirname $0) ; pwd -P) | |
| TASK=$1 | |
| ARGS=${@:2} | |
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
| data class ContextA(val valueA: String, val valueB: Int) | |
| data class ContextB(val valueB: Int, val valueC: Int, val valueD: Double) | |
| val theReader: Reader<Int, String> = | |
| Reader().lift { b: Int -> "The number is $b!!!" } | |
| val theReaderInA: Reader<ContextA, String> = theReader | |
| .local(ContextA::valueB::get) |
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
| observer || observer.cleanUp() | |
| observer = (() => { | |
| // start config | |
| const THRESHOLD = 3000000 | |
| // end config | |
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
| require 'set' | |
| def hangman(secret_word, letters) | |
| Set[*secret_word.chars].subset? Set[*letters] | |
| end |
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
| package kotlin.jvm.functions | |
| // In this package, it contains Function1 - 22 | |
| public interface Function3<in P1, in P2, in P3, out R> : Function<R> { | |
| public operator fun invoke(p1: P1, p2: P2, p3: P3): R | |
| } | |
| // The (PhoneNumber, String, String) -> MessageCreator is actually just | |
| // Function3<PhoneNumber, String, String, MessageCreator> |
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
| // creating a wrapper around static method | |
| @Component | |
| class MessageWrapper { | |
| fun creator(phoneNumber: PhoneNumber, messageServiceSid: String, text: String) = | |
| Message.creator(phoneNumber, messageServiceSid, text) | |
| } | |
| @Service | |
| class NotificationService( | |
| private val restClient: TwilioRestClient, |
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
| typealias MessageCreatorFactory = (PhoneNumber, String, String) -> MessageCreator | |
| @Service | |
| class NotificationService( | |
| private val restClient: TwilioRestClient, | |
| private val secretRepository: SecretRepository | |
| ) { | |
| fun notify( | |
| notificationRequest: NotificationRequest, | |
| // Set default creator |
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 NotificationServiceTest : Spek({ | |
| describe(".notify") { | |
| context("when message creation fails") { | |
| // constants | |
| val messagingServiceId = "message-service-id" | |
| val errorCode = 9 | |
| val errorMessage = "error message" | |
| val restClient = mock<TwilioRestClient>() |
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 NotificationServiceTest : Spek({ | |
| describe(".notify") { | |
| context("when message creation fails") { | |
| // constants | |
| val messagingServiceId = "message-service-id" | |
| val errorCode = 9 | |
| val errorMessage = "error message" | |
| val restClient = mock<TwilioRestClient>() |
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 NotificationServiceTest : Spek({ | |
| describe(".notify") { | |
| context("when message creation fails") { | |
| // constants | |
| val messagingServiceId = "message-service-id" | |
| val errorCode = 9 | |
| val errorMessage = "error message" | |
| val restClient = mock<TwilioRestClient>() |