Skip to content

Instantly share code, notes, and snippets.

View feresr's full-sized avatar

Fernando Raviola feresr

View GitHub Profile
open class SliderContextualViewModel(
val filterFlow: StateFlow<Map<FILTER, FloatArray>>,
val onFilterChanged: (FILTER, FloatArray) -> Unit,
val onFilterCommitted: () -> Unit = {}
)
@Composable
fun SliderContextual(modifier: Modifier, viewModel: SliderContextualViewModel) {
val sliding = remember { mutableStateOf(false) }
Card(
@feresr
feresr / presets.json
Created June 25, 2021 15:27
presets.json
{
"home": {
"packOfTheDay": 212,
"featured": [
1,
4,
5,
9,
11,
13,
@feresr
feresr / MainActivity.kt
Created June 1, 2021 18:10
Android update underlying bitmap
package com.feresr.composebitmap
import android.graphics.Bitmap
import android.graphics.Color
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.wrapContentSize
import androidx.compose.material.Button
Once I’ve updated the dependencies I set off to test it:
= I set my user Feature flags to be on
= Connected to the VPN and reset the user idverification  data from the database using this guide
= Try to login, wasn’t able to because of some backend problem affecting other devs as well
= Took a few hours to fix the problem, but only for my specific user, not sure if the more general problem is fixed (I think backend is investigating)
= But now I’m also getting an error while refreshing profile, it’s showing a message to the user “Unknown error” (started debugging, after a while I found out this courier has no cc and that might be the reason)
= Added a credit card using glovotest.com , but the issue wasn’t resolved
= Logged out to try logging in again and now I’m getting an empty toast in the screen, can’t log back in (empty message showing up, recorded a video and let the team know about it)
//manifest.xml
...
<activity
android:name="com.jumio.nv.NetverifyActivity"
android:configChanges="orientation|screenSize|screenLayout|keyboardHidden|uiMode|layoutDirection"
android:hardwareAccelerated="true"
android:theme="@style/CustomNetverifyTheme"
android:windowSoftInputMode="adjustResize" />
...
@feresr
feresr / DP.kt
Created December 6, 2020 20:58
Gist
package com.feresr.threedp
import android.os.Bundle
import android.view.MotionEvent
import androidx.appcompat.app.AppCompatActivity
import androidx.compose.foundation.layout.size
import androidx.compose.material.Surface
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
@feresr
feresr / Test.kt
Last active November 12, 2020 10:59
// 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?
// `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 August 31, 2020 23:30
Simple openGL GLSL vertex+fragment shader
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 April 18, 2020 16:57
Link SDL statically
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})