Skip to content

Instantly share code, notes, and snippets.

View Frescaso.md

Juanma tutorial for using Fresco as "Picasso"

La diferencia mas grande entre picasso y fresco es que (por si te preguntan):

Android <4.0 usa como vm Dalvik. De 4.0 a 4.4 esta Dalvik y ART (Beta). >5.0 ART.

Las mayor diferencia entre Dalvik y ART, es que dalvik tiene un solo heap uniforme y que, cada vez que corra el garbage collector, haltea TODOS los procesos para limpiar la memoria. Entonces en los celulares de dalvik, si empezas a usar mucha memoria y tiene que recolectarla, se te "freezea" el celular por unos ms.

Esto se nota demasiado en las listviews/gridviews/recyclerviews, ya que uno levanta muchisima memoria y se recolecta al toque, pero en dalvik esto haltea ;).

@saantiaguilera
saantiaguilera / commit
Created Oct 1, 2016
Commit with gpg without having to always remember -S
View commit
#!/bin/bash
EXISTS="`git config --global --list | sed -n "/.*signingkey.*/p"`"
if [ -z $EXISTS ]
then
echo "Woops ! It seems you dont have your git signed. Looking for an existing GPG key..."
SIGNING_KEY="`gpg --list-keys | sed -n '3p' | sed "s/.*\///" | sed "s/ .*//"`"
@saantiaguilera
saantiaguilera / .adb-aliases
Created Oct 20, 2016
Easy adb aliases for an easier life
View .adb-aliases
func_adbfilter() {
adb logcat | ggrep `adb shell ps | ggrep $1 | cut -c10-15`
}
alias adbfilter=func_adbfilter
func_adbphonedata() {
adb shell cat /proc/cpuinfo
}
@saantiaguilera
saantiaguilera / service_call_test.py
Last active Feb 15, 2018 — forked from ktnr74/service_call_test.py
*update_transaction_codes.py* parses Android services source code to find out transaction codes and saves them in YAML format for later use. *transaction_codes.yaml* is an example of the resulting file. *service_call_test.py* shows how it can be used
View service_call_test.py
#!/usr/bin/python
import os
import sys
import time
import yaml
import subprocess
import re
import struct
View webp-converter.gradle
// Root header to have dependencies
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath "com.android.tools.build:gradle:$gradleBuildToolsVersion"
classpath gradleApi()
@saantiaguilera
saantiaguilera / .zshrc
Created Oct 31, 2019
Volume manager for abstracting code sources
View .zshrc
# Add this in your .zshrc or .bash_profile or wherever you want
mount() {
# Note that I save all my sparse images in ~/Projects/
hdiutil attach ~/Projects/$1.dmg.sparseimage -mountpoint /Volumes/$1
}
unmount() {
hdiutil detach /Volumes/$1
}
View IntegrationTests.kt
package com.mercadolibre.dojo
import org.junit.Assert
import org.junit.Before
import org.junit.Test
class IntegrationTests {
lateinit var player1: Player
lateinit var player2: Player
View gist:0cff19305fd9186978b4a396326af530
{
{
"link": "https://kahoot.it/challenge/07478158?challenge-id=36dfa64c-d15a-4990-948c-0d8600cab278_1594751002787",
"leaderboard": "1. X - 100 puntos\n2. Y - 25 puntos\n3. Z - 5 puntos"
},
{
"link": "https://forms.gle/pS4w5MJ6t3zThH3t5",
"leaderboard": "1. X - 100 puntos\n2. Y - 25 puntos\n3. Z - 5 puntos"
}
}
@saantiaguilera
saantiaguilera / Result.kt
Created Jan 14, 2021
Result sealed class for kotlin error handling, allowing us to write safe code either in a functional or imperative format, without the use of exceptions. Since kotlin from 1.3 onwards changed their Result into an inline class, we can no longer use it for return values (which eliminates the bad smell of exceptions as errors, like most modern lang…
View Result.kt
package com.saantiaguilera
import com.saantiaguilera.Result.Failure
import com.saantiaguilera.Result.Success
import kotlin.contracts.ExperimentalContracts
import kotlin.contracts.InvocationKind
import kotlin.contracts.contract
/**
* A discriminated union that encapsulates successful outcome with a value of type [S]