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
TARGET = stm32template | |
DEBUG = 1 | |
OPT = -Og | |
BUILD_DIR = build | |
C_SOURCES = $(shell find * -type f -name "*.c" | sed ':a;N;$!ba;s/\n/ /g') | |
CXX_SOURCES = $(shell find * -type f -name "*.cpp" | sed ':a;N;$!ba;s/\n/ /g') | |
ASM_SOURCES = startup_stm32f103xb.s |
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.liberaid.mvprecyclerview.recyclerview | |
import android.support.v7.widget.RecyclerView | |
import android.view.LayoutInflater | |
import android.view.View | |
import android.view.ViewGroup | |
/** | |
* RecyclerView adapter template for MVP pattern |
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
CC=g++ | |
CFLAGS=-c -Wall -std=c++17 -g -O0 | |
LDFLAGS= | |
LIBS= | |
SRCDIR=src | |
OBJDIR=obj | |
SOURCES=$(wildcard $(SRCDIR)/*.cpp) | |
OBJECTS=$(patsubst $(SRCDIR)/%.cpp,$(OBJDIR)/%.o,$(SOURCES)) |
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.CompletableDeferred | |
import kotlinx.coroutines.CoroutineScope | |
import kotlinx.coroutines.GlobalScope | |
import kotlinx.coroutines.channels.* | |
import kotlinx.coroutines.launch | |
import kotlinx.coroutines.selects.select | |
class TaskPool<T, R> (private val taskChannel: ReceiveChannel<T>, private val taskHandler: suspend CoroutineScope.(T) -> R, poolCapacity: Int = 5) { | |
private val resultChannel = Channel<R>(poolCapacity) |
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.CoroutineScope | |
import kotlinx.coroutines.Dispatchers | |
import kotlinx.coroutines.launch | |
import kotlinx.coroutines.withContext | |
fun CoroutineScope.launchUI(block: suspend CoroutineScope.() -> Unit) = this.launch(Dispatchers.Main, block = block) | |
suspend fun <T> CoroutineScope.withUI(block: suspend CoroutineScope.() -> T) = withContext(Dispatchers.Main, block = block) | |
fun CoroutineScope.launchCatching(block: suspend CoroutineScope.() -> Unit, onError: (ctx: CoroutineContext, throwable: Throwable) -> Unit) = launch(CoroutineExceptionHandler(onError), block = block) | |
fun CoroutineScope.launchUICatching(block: suspend CoroutineScope.() -> Unit, onError: (ctx: CoroutineContext, throwable: Throwable) -> Unit) = launch(CoroutineExceptionHandler(onError) + Dispatchers.Main, block = block) |
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 android.Manifest | |
import android.annotation.SuppressLint | |
import android.content.Context | |
import android.graphics.Bitmap | |
import android.graphics.ImageFormat | |
import android.hardware.camera2.CameraCaptureSession | |
import android.hardware.camera2.CameraCharacteristics | |
import android.hardware.camera2.CameraDevice | |
import android.hardware.camera2.CameraManager | |
import android.media.ImageReader |