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
#include <memory> | |
template<typename Parameter> | |
class Consumer { | |
public: | |
virtual void call(const Parameter &obj) const = 0; | |
virtual ~Consumer() {} | |
}; | |
template<typename Callable, typename Parameter> |
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
import kotlinx.coroutines.Dispatchers | |
import kotlinx.coroutines.runBlocking | |
import kotlinx.coroutines.withContext | |
import java.util.concurrent.Executor | |
import java.util.concurrent.Executors | |
import kotlin.coroutines.suspendCoroutine | |
// Simulate what may happen in Spring WebFlux, where a Spring call your functions in their executors | |
suspend fun resumeOnSpecificJavaExecutor(javaExecutor: Executor) = suspendCoroutine<Int> { | |
javaExecutor.execute { it.resumeWith(Result.success(1)) } |
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
#include <iostream> | |
#include <optional> | |
#include <string> | |
#include <memory> | |
// Protocol oriented approach for lazy initialization. | |
// Would be better of course when Concepts would be released. | |
// Demonstrated in int, std::unique_ptr, and std::optional | |
template<typename T> |
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
import UIKit | |
class TryView: UIView { | |
let label: UILabel | |
let textField: UITextField | |
required init?(coder: NSCoder) { | |
fatalError("Not implemented") | |
} | |
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
{ | |
"environmentDescription": "(unspecified, hostname = tfb-all)", | |
"git": null, | |
"cachedQueryIntervals": [ | |
1, | |
10, | |
20, | |
50, | |
100 | |
], |
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
import Foundation | |
import NIO | |
import NIOHTTP1 | |
struct Message: Codable { | |
var message: String | |
} | |
let dateFormatter: DateFormatter = { | |
let ret = DateFormatter.init() |