This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ext.set("alwaysUpdateBuildId", false) | |
| val alwaysUpdateBuildId by extra { false } | |
| (this as ExtensionAware).extra["alwaysUpdateBuildId"] = false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| create("baseDebug") { | |
| isDebuggable = true | |
| matchingFallbacks = listOf("debug") | |
| signingConfig = signingConfigs.getByName("debug") | |
| ext.set("alwaysUpdateBuildId", false) | |
| } | |
| create("someStagingEnv") { | |
| initWith(getByName("baseDebug")) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @delegate:ColorInt | |
| val someColor: Int by lazy { | |
| ContextCompat.getColor(context, R.color.some_color) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| suspend fun <Response> Task<Response>.suspended(): Response = suspendCoroutine { continuation -> | |
| addOnSuccessListener { continuation.resume(it) } | |
| addOnFailureListener { continuation.resumeWithException(it) } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class TaskObservable<T>(private val task: Task<T>) : ObservableOnSubscribe<T> { | |
| override fun subscribe(emitter: ObservableEmitter<T>) { | |
| task | |
| .addOnSuccessListener { t -> | |
| if (!emitter.isDisposed) { | |
| emitter.onNext(t) | |
| emitter.onComplete() | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| val foo = Foo() | |
| .setSomething1(1) | |
| .setSomething2(2) | |
| .apply { | |
| if (aCondition == true) setSomething3(3) | |
| } | |
| .setSomething4(4) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| gradle.taskGraph.whenReady { graph -> | |
| // Be careful if you are also using --continue elsewhere. | |
| if (gradle.startParameter.continueOnFailure) { | |
| graph.allTasks.findAll { it.name ==~ /yourTestTask/ }*.ignoreFailures = true | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def postCommitStatus(params = [:]) { | |
| withCredentials([ | |
| string([credentialsId: 'your-credentials-id', variable: 'GITHUB_API_TOKEN']) | |
| ]) { | |
| def authHeaders = [[name: 'Authorization', value: "token ${GITHUB_API_TOKEN}"]] | |
| def commit = params.commit | |
| def requestBody = params.body | |
| def statusUrl = "https://api.github.com/repos/repo-owner/repo-name/statuses/${commit}" | |
| try { | |
| def response = httpRequest acceptType: 'APPLICATION_JSON', contentType: 'APPLICATION_JSON', httpMode: 'POST', requestBody: requestBody, url: statusUrl, customHeaders: authHeaders |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| CMD=$1 | |
| if [[ $ADB == "" ]]; then | |
| ADB=adb | |
| fi | |
| if [[ $CMD != "on" && $CMD != "off" ]]; then | |
| echo "Usage: $0 [on|off] [hhmm]" >&2 | |
| exit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class MainActivity extends AppCompatActivity { | |
| @Override | |
| protected void onCreate(Bundle savedInstanceState) { | |
| super.onCreate(savedInstanceState); | |
| setContentView( | |
| LithoView | |
| .create(this, ButtonContainer | |
| .create(new ComponentContext(this)) |