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
import sun.security.x509.* | |
import java.io.File | |
import java.math.BigInteger | |
import java.security.* | |
import java.security.cert.X509Certificate | |
import java.util.* | |
/** | |
* Simple script for generating keys and certificates as needed to connect to the ING API. |
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
// 1 - provider creation | |
let provider = MoyaProvider<MyRouter>( | |
manager: AlamofireSessionManagerBuilder().build() | |
) | |
// 2 - session manager builder | |
class AlamofireSessionManagerBuilder { | |
var policies: [String: ServerTrustPolicy]? | |
var configuration = URLSessionConfiguration.default |
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
protocol State {} | |
struct Transition<From: State, To: State> { | |
let transition: () -> To | |
} | |
struct Machine<CurrentState: State> { | |
var state: CurrentState | |
Author: Chris Lattner
- Proposal: SE-XXXX
- Authors: Chris Lattner, Joe Groff
Modern Cocoa development involves a lot of asynchronous programming using closures and completion handlers, but these APIs are hard to use. This gets particularly problematic when many asynchronous operations are used, error handling is required, or control flow between asynchronous calls gets complicated. This proposal describes a language extension to make this a lot more natural and less error prone.
This paper introduces a first class Coroutine model to Swift. Functions can opt into to being async, allowing the programmer to compose complex logic involving asynchronous operations, leaving the compiler in charge of producing the necessary closures and state machines to implement that logic.
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
struct ComposeTransformer<T, R> { | |
let transformer: (Observable<T>) -> Observable<R> | |
init(transformer: @escaping (Observable<T>) -> Observable<R>) { | |
self.transformer = transformer | |
} | |
func call(_ observable: Observable<T>) -> Observable<R> { | |
return transformer(observable) | |
} | |
} |
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
Latency Comparison Numbers (~2012) | |
---------------------------------- | |
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns 14x L1 cache | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
Compress 1K bytes with Zippy 3,000 ns 3 us | |
Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
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
@RunWith(AndroidJUnit4::class) | |
class MainViewTests { | |
val mockUserAction = mock(MainContract.UserAction::class.java) | |
@get:Rule | |
val activityTestRule = object : ActivityTestRule<MainActivity>(MainActivity::class.java, true, true) { | |
override fun beforeActivityLaunched() { | |
super.beforeActivityLaunched() | |
val myApp = InstrumentationRegistry.getTargetContext().applicationContext as MyApp | |
myApp.dispatchingActivityInjector = createFakeActivityInjector<MainActivity> { |
NewerOlder