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
private fun <T> any(): T { | |
Mockito.any<T>() | |
return uninitialized() | |
} | |
private fun <T> uninitialized(): T = null as 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
class MyBroadcastReceiver(val listener : MyBroadcastListener) extends BroadcastReceiver() { | |
override fun onReceive(p0: Context?, p1: Intent?) { | |
listener.onSomeEventHappened() | |
} | |
interface MyBroadcastListener { | |
fun onSomeEventHappened() | |
} | |
} |
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
package com.feresr.wallpapers.wallpapers | |
class WallpapersAdapter(private val context: Context, private val inflater: LayoutInflater) : BaseAdapter<Wallpaper>() { | |
companion object { | |
val TYPE_WALLPAPER: Int = 0 | |
val TYPE_LOADING: Int = 1 | |
} | |
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, item: Wallpaper) { |
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
abstract class BasePresenter<I : MVI.Intent, S : MVI.ViewState> { | |
private val intents: PublishSubject<I> = PublishSubject.create<I>() | |
private var states: Observable<S>? = null | |
private var disposable: Disposable? = null | |
private var viewDisposable: Disposable? = null | |
fun onCreate() { | |
states = intents |
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
Fatal Exception: java.lang.IllegalStateException | |
Operation is already in progress | |
Fatal Exception: java.lang.IllegalStateException: Operation is already in progress | |
at kotlinx.coroutines.io.ByteBufferChannel.access$getReadOp$p(ByteBufferChannel.java:46) | |
at kotlinx.coroutines.io.ByteBufferChannel.access$flushImpl(ByteBufferChannel.java:157) | |
at kotlinx.coroutines.io.ByteBufferChannel.access$flushImpl(ByteBufferChannel.java:92) | |
at kotlinx.coroutines.io.ByteBufferChannel.access$flushImpl(ByteBufferChannel.java:75) | |
at kotlinx.coroutines.io.ByteReadChannelKt.discard(ByteReadChannelKt.java:3) | |
at io.ktor.client.response.HttpResponse$close$1.invokeSuspend(HttpResponse.java:3) | |
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.b + 6(BaseContinuationImpl.java:6) |
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
# sdl2 cmake project-config input for ./configure scripts | |
set(prefix "/usr/local/Cellar/sdl2/2.0.12_1") | |
set(exec_prefix "${prefix}") | |
set(libdir "${exec_prefix}/lib") | |
set(SDL2_PREFIX "/usr/local/Cellar/sdl2/2.0.12_1") | |
set(SDL2_EXEC_PREFIX "/usr/local/Cellar/sdl2/2.0.12_1") | |
set(SDL2_LIBDIR "${exec_prefix}/lib") | |
set(SDL2_INCLUDE_DIRS "${prefix}/include/SDL2") | |
set(SDL2_LIBRARIES "-L${SDL2_LIBDIR} -lSDL2") |
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
cmake_minimum_required(VERSION 3.16) | |
project(smb) | |
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/") | |
find_package(SDL2 REQUIRED) | |
find_package(SDL2_image REQUIRED) | |
add_executable(smb src/main.cpp) | |
target_link_libraries(smb ${SDL2} ${SDL2_IMAGE}) |
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
void checkCompileErrors(unsigned int object, std::string type) { | |
int success; | |
char infoLog[1024]; | |
if (type != "PROGRAM") { | |
glGetShaderiv(object, GL_COMPILE_STATUS, &success); | |
if (!success) { | |
glGetShaderInfoLog(object, 1024, NULL, infoLog); | |
std::cout << "| ERROR::SHADER: Compile-time error: Type: " << type << "\n" | |
<< infoLog << "\n -- --------------------------------------------------- -- " | |
<< std::endl; |
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
// `dependencies.gradle` | |
def jumio_version = "3.7.2" | |
jumio = [ | |
core : "com.jumio.android:core:${jumio_version}@aar", | |
netverify : "com.jumio.android:nv:${jumio_version}@aar", | |
face : "com.jumio.android:face:${jumio_version}@aar", | |
auth : "com.jumio.android:auth:${jumio_version}@aar", | |
zoom_authentication: "com.facetec:zoom-authentication:8.12.1@aar" | |
] |
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
// One of the strenghts of MVI is testing! | |
// 1) I'd love to use the VM API `viewModel.startOnBoarding()` instead of `handleIntents` :( | |
// 2) Why do we need to `handleIntent` before we can subscribe to the VM, how do I test a sequence of intenets? | |
@Test | |
fun `start onBoarding`() { | |
val testSubscriber = TestSubscriber<Any>() // Why <ANY> we shold be getting states? |