Skip to content

Instantly share code, notes, and snippets.

View Egorand's full-sized avatar
🔲
sup sup

Egor Andreevich Egorand

🔲
sup sup
View GitHub Profile
@dellisd
dellisd / Resource.kt
Last active December 28, 2023 11:33
Kotlin Multiplatform test resources
// Common
const val RESOURCE_PATH = "./src/commonTest/resources"
expect class Resource(name: String) {
val name: String
fun exists(): Boolean
fun readText(): String
}
@gabrielemariotti
gabrielemariotti / README.md
Last active February 24, 2021 10:52
How to manage the support libraries in a multi-module projects. Thanks to Fernando Cejas (http://fernandocejas.com/)

Centralize the support libraries dependencies in gradle

Working with multi-modules project, it is very useful to centralize the dependencies, especially the support libraries.

A very good way is to separate gradle build files, defining something like:

root
  --gradleScript
 ----dependencies.gradle
@chrisbanes
chrisbanes / CollapsingTitleLayout.java
Last active March 26, 2023 11:58
CollapsingTitleLayout
/*
* Copyright 2014 Chris Banes
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@dmarcato
dmarcato / strip_play_services.gradle
Last active December 21, 2022 10:10
Gradle task to strip unused packages on Google Play Services library
def toCamelCase(String string) {
String result = ""
string.findAll("[^\\W]+") { String word ->
result += word.capitalize()
}
return result
}
afterEvaluate { project ->
Configuration runtimeConfiguration = project.configurations.getByName('compile')
@ecgreb
ecgreb / CustomTestRunner.java
Last active July 11, 2016 14:01
CustomTestRunner (Robolectric 2.x) and Crashlytics shadow class
package com.example;
import com.example.shadows.ShadowCrashlytics;
import org.junit.runners.model.InitializationError;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.bytecode.ClassInfo;
import org.robolectric.bytecode.Setup;
import org.robolectric.bytecode.ShadowMap;
@metasim
metasim / repeat-until.scala
Created November 16, 2013 18:31
Example of creating a `repeat { ... } until (...)` like control structure.
import scala.annotation.tailrec
object controls {
def repeat(body: => Unit) = new {
@tailrec
def until(condition: => Boolean) {
body
if (condition) () else until(condition)
}
@swankjesse
swankjesse / RetrofitCachingExample.java
Created June 29, 2013 03:03
Demonstrate HTTP caching with OkHttp and Retrofit.
/*
* Copyright (C) 2013 Square, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@grantland
grantland / gist:3949145
Created October 24, 2012 21:50
Fix for "Dx warning: Ignoring InnerClasses attribute for an anonymous inner class"
To fix the following warning, you must add "-keepattributes EnclosingMethod" to your proguard config.
Dx warning: Ignoring InnerClasses attribute for an anonymous inner class
(me.kiip.internal.c.h) that doesn't come with an
associated EnclosingMethod attribute. This class was probably produced by a
compiler that did not target the modern .class file format. The recommended
solution is to recompile the class from source, using an up-to-date compiler
and without specifying any "-target" type options. The consequence of ignoring
this warning is that reflective operations on this class will incorrectly
indicate that it is *not* an inner class.