Skip to content

Instantly share code, notes, and snippets.

Avatar
🇦🇷
https://feresr.github.io/

Fernando Raviola feresr

🇦🇷
https://feresr.github.io/
View GitHub Profile
View gist:3ddf25f38f97d01e9838ae2f2f660b6a
// `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"
]
@feresr
feresr / shaders.cpp
Created Aug 31, 2020
Simple openGL GLSL vertex+fragment shader
View shaders.cpp
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;
@feresr
feresr / CMakeLists.txt
Created Apr 18, 2020
Link SDL statically
View CMakeLists.txt
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})
View sdl.cmake
# 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")
View Ktor 1140
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)
@feresr
feresr / walpy_privacy_policy.md
Last active Jul 12, 2019
Walpy - Privacy Policy
View walpy_privacy_policy.md

Privacy Policy

This page is used to inform website visitors regarding my policies with the collection, use, and disclosure of Personal Information if anyone decided to use Walpy.

If you choose to use my Service, then you agree to the collection and use of information in relation to this policy. The Personal Information that I collect is used for providing and improving the Service. I will not use or share your information with anyone except as described in this Privacy Policy.

The terms used in this Privacy Policy have the same meanings as in our Terms and Conditions, which is accessible at Walpy unless otherwise defined in this Privacy Policy.

Information Collection and Use

View Presenter.kt
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
View adapter.kt
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) {
View gist:9d5b550caf443ea6da7b0092eb454c28
class MyBroadcastReceiver(val listener : MyBroadcastListener) extends BroadcastReceiver() {
override fun onReceive(p0: Context?, p1: Intent?) {
listener.onSomeEventHappened()
}
interface MyBroadcastListener {
fun onSomeEventHappened()
}
}
View gist:c2bc2ae8950907a618427d7381993f30
private fun <T> any(): T {
 Mockito.any<T>()
 return uninitialized()
 }
 private fun <T> uninitialized(): T = null as T