Skip to content

Instantly share code, notes, and snippets.

View DevPicon's full-sized avatar
🎯
Looking for new ways to improve my job

Armando Picón DevPicon

🎯
Looking for new ways to improve my job
View GitHub Profile
package la.devpicon.android.composenavigationapplication
import androidx.compose.runtime.Composable
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.compose.ui.Modifier
import androidx.lifecycle.ViewModel
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.asStateFlow
@DevPicon
DevPicon / AdbCommands
Created August 9, 2023 18:39 — forked from Pulimet/AdbCommands
Adb useful commands list
adb help // List all comands
== Adb Server
adb kill-server
adb start-server
== Adb Reboot
adb reboot
adb reboot recovery
adb reboot-bootloader
@DevPicon
DevPicon / AdbCommands
Created August 9, 2023 18:39 — forked from ernestkamara/AdbCommands
Adb useful commands list
== Adb Server
adb kill-server
adb start-server
== Adb Reboot
adb reboot
adb reboot recovery
adb reboot-bootloader
== Shell
fun addDestinationOnMap(
googleMap: GoogleMap,
shopperLocation: Location,
destinationLocation: LatLng
) {
lifecycle.coroutineScope.launchWhenCreated {
googleMap.clear()
val latLngBounds = LatLngBounds.Builder()
@DevPicon
DevPicon / FlowExample.kt
Created January 9, 2021 19:36
StateFlow and Sharedflow... the end of LiveData?
package sharedflow.macao.flow
import flow.others.log
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.collect
import kotlinx.coroutines.flow.filter
import kotlinx.coroutines.flow.flow
import kotlinx.coroutines.launch
import kotlinx.coroutines.runBlocking
import kotlin.random.Random
package com.cornershopapp.shopper.android.ui
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import kotlinx.coroutines.*
class Demo : ViewModel() {
fun login(name: String, pass: String
) = viewModelScope.launch {
@DevPicon
DevPicon / clean_code.md
Created April 12, 2019 02:06 — forked from wojteklu/clean_code.md
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

import android.os.Environment
import android.util.Log
import java.io.BufferedWriter
import java.io.File
import java.io.FileWriter
import java.io.IOException
object LocalLogger {
// USAGE: LocalLogger.INSTANCE.log(TAG, "------ updateProduct() -----");
import android.graphics.BitmapFactory
import android.net.Uri
class ImageUtils {
companion object {
@JvmStatic
fun getImageInfoFromUri(fileUri: Uri): ImageInfo {
val options = BitmapFactory.Options().apply {
inJustDecodeBounds = true
import android.content.Context;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.util.AttributeSet;
import android.view.View;