Skip to content

Instantly share code, notes, and snippets.

@crgarridos
crgarridos / settings.gradle.kts
Created August 19, 2021 15:34
Auto discover gradle modules
includeModulesDirs(
"features",
"usecases",
"repositories",
"libraries",
"templates",
)
/**
* Look into [dirs] for existing modules.
@crgarridos
crgarridos / beers.json
Created April 12, 2020 22:19
Extracted from on https://openbeerdb.com/ .cvs file
[
".38 Special Bitter",
"(512) ALT",
"(512) Bruin",
"(512) IPA",
"(512) Pale",
"(512) Pecan Porter",
"(512) Whiskey Barrel Aged Double Pecan Porter",
"(512) Wit",
"#17 Cream Ale",
package com.cristiangarrido.example.recyclerview
import com.google.gson.Gson
import com.google.gson.GsonBuilder
import okhttp3.mockwebserver.MockResponse
import okhttp3.mockwebserver.MockWebServer
import org.junit.Assert
import org.junit.Test
import retrofit2.Call
import retrofit2.Callback
@crgarridos
crgarridos / appBuildInstallLaunchAlias.sh
Created December 4, 2018 08:43 — forked from nisrulz/appBuildInstallLaunchAlias.sh
Append these aliases to your bashrc/zshrc and you will have access to commands which will allow you to install apk and launch apk
# I use ZSH, here is what I added to my .zshrc file (config file)
# at ~/.zshrc
# Have the adb accessible, by including it in the PATH
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:path/to/android_sdk/platform-tools/"
# Setup your Android SDK path in ANDROID_HOME variable
export ANDROID_HOME=~/sdks/android_sdk
# Setup aapt tool so it accessible using a single command
@crgarridos
crgarridos / release_apk.sh
Created November 5, 2018 20:37
Used to deliver apk
#!/bin/bash
while getopts dhv: option
do
case "${option}"
in
d) DEV_BUILD=true
echo "Running dev config..." ;;
v) TAG=${OPTARG};;
h) echo "Usage :"
@crgarridos
crgarridos / SuspendFunctionMockExtensions.kt
Created October 9, 2018 13:42
Able to mock a suspend function
fun <T : Any, R> KStubbing<T>.onBlocking(
m: suspend T.() -> R
): OngoingStubbing<R> {
return runBlocking { Mockito.`when`(mock.m()) }
}
@RequiresPermission("android.permission.READ_PHONE_STATE")
public static String getDeviceId(Context context) {
String androidId = Settings.Secure.getString(context.getContentResolver(), android.provider.Settings.Secure.ANDROID_ID);
if (androidId != null)
return androidId;
final TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
if (tm != null) {
if (tm.getDeviceId() != null)
return tm.getDeviceId();
else
<scheme name="Material Darcula" version="142" parent_scheme="Darcula">
<metaInfo>
<property name="created">2018-06-26T11:01:56</property>
<property name="ide">AndroidStudio</property>
<property name="ideVersion">3.2.0.18</property>
<property name="modified">2018-06-26T11:02:01</property>
<property name="originalScheme">Material Darcula</property>
</metaInfo>
<attributes>
<option name="LOGCAT_ASSERT_OUTPUT">
@crgarridos
crgarridos / get.js
Created January 16, 2018 15:21
Get names from a list of friends in facebook
names = [...document.querySelectorAll(".uiProfileBlockContent ._6a a[href$=friends_tab]")].map((it) => it.innerText)
JSON.stringify(names).replace(/["\[\]]/g,"")
package com.cristiangarrido.daggerandroid.base
import com.cristiangarrido.daggerandroid.di.DaggerAppComponent
import dagger.android.AndroidInjector
import dagger.android.support.DaggerApplication
/**
* Created by cristian on 21/11/17.
*/