Skip to content

Instantly share code, notes, and snippets.

View danielgomezrico's full-sized avatar

Daniel Gomez danielgomezrico

  • Medellin, Colombia
View GitHub Profile
@danielgomezrico
danielgomezrico / AndroidDevice.kt
Created January 18, 2017 16:56
Android - how to get logcat File
class AndroidDevice(val activity: AppCompatActivity) {
/**
* Source: http://stackoverflow.com/a/22174245/273119
*/
fun readLogFile(): String {
val fullName = "appLog.log"
val file = File(activity.cacheDir, fullName)
val pid = android.os.Process.myPid().toString()
@danielgomezrico
danielgomezrico / Function.java
Created May 9, 2015 16:05
Android - check if running on main thread
public boolean runningOnMainThread() {
return Looper.getMainLooper().getThread() == Thread.currentThread();
}
@danielgomezrico
danielgomezrico / phoronix-cmd.md
Created November 27, 2018 16:11 — forked from anshula/phoronix-cmd.md
Phoronix Test Suite Cheat Sheet
@danielgomezrico
danielgomezrico / result.dart
Created March 20, 2024 19:59
Example - Study: check if typedef works for type checks
import 'dart:async';
typedef FutureResult<T> = Future<Result<T>>;
typedef FutureOrResult<T> = FutureOr<Result<T>>;
typedef ConcatResult<F, S> = ({F first, S second});
abstract class Result<T> {
const Result();
@danielgomezrico
danielgomezrico / jacoco.gradle
Last active June 18, 2024 13:23
Jacoco setup to merge coverage for android when you run unit tests + integration tests and get a mixed result
// Merge of
// https://github.com/mgouline/android-samples/blob/master/jacoco/app/build.gradle
// and https://github.com/pushtorefresh/storio/blob/master/gradle/jacoco-android.gradle
// Requires Jacoco plugin in build classpath.
apply plugin: 'jacoco'
jacoco {
toolVersion = "0.8.3"
}
@danielgomezrico
danielgomezrico / pubspec.yaml
Created May 2, 2024 21:20
Flutter - Built Value - Build Runner: script to update pubscpec with the files to autogenerate
targets:
$default:
builders:
built_value_generator:built_value:generate_for:
generate_for:
- HERE
@danielgomezrico
danielgomezrico / readme.md
Created January 5, 2024 17:21
i18n performance test using i18n.Of, temporal variables and i18n.current

Results are:

With Current

  • direclty access to i18n(RunTime): 55185442.5 us.
  • indireclty access to i18n(RunTime): 55758307.0 us.
  • indireclty outside access to i18n(RunTime): 56177293.5 us.

With BuildContext

  • direclty access to i18n(RunTime): 92459941.0 us.
  • indireclty access to i18n(RunTime): 83667963.5 us.
@danielgomezrico
danielgomezrico / result_monad_2.dart
Last active December 15, 2023 15:06
Result Monad Example 2
///
/// The Result Monad
///
abstract class Result<T> {
bool isSuccess() {
return this is Success;
}
Success<T> asSuccess() {
return this as Success<T>;
@danielgomezrico
danielgomezrico / Manifest.xml
Created December 13, 2023 21:47
Flutter · Dart: web server to start a local webserver
<!-- Attribute to add on android -->
<app
....
android:usesCleartextTraffic="true">
...
</app>
@danielgomezrico
danielgomezrico / Checkbox.xml
Created September 14, 2015 03:21
Android - Checkbox as star/favorite view.
<CheckBox
android:id="@+id/item_card_check_favorite"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:padding="@dimen/activity_margin"
style="?android:attr/starStyle"/>