Skip to content

Instantly share code, notes, and snippets.

@abdyer
abdyer / fladle.gradle
Last active March 7, 2020 13:45
Configuring the benchmark test task with Fladle
fladle {
// credentials and other general config...
configs {
benchmarkTests {
resultsHistoryName = "benchmark-tests-${getDateString()}"
directoriesToPull = [
"/sdcard/Download"
]
filesToDownload = [ ".*/sdcard/Download/.*" ]
@abdyer
abdyer / BenchmarkTest.kt
Created March 7, 2020 13:24
Benchmark test annotation
@Retention(AnnotationRetention.RUNTIME)
@Target(AnnotationTarget.CLASS, AnnotationTarget.FILE, AnnotationTarget.FUNCTION)
annotation class BenchmarkTest
@abdyer
abdyer / build.gradle
Created March 7, 2020 13:23
Configuring a custom BenchmarkRunner
android {
defaultConfig {
testInstrumentationRunner "org.andydyer.example.benchmark.test.BenchmarkRunner"
}
}
@abdyer
abdyer / BenchmarkRunner.kt
Last active March 7, 2020 13:22
A custom AndroidBenchmarkRunner for benchmarks on CI
class BenchmarkRunner : AndroidBenchmarkRunner() {
override fun newApplication(
cl: ClassLoader?,
className: String?,
context: Context?
): Application {
// Create an instance of our custom Application class for benchmark tests
return super.newApplication(cl, BenchmarkApp::class.java.name, context)
}
@abdyer
abdyer / InlineClassIssueComponentSpec.kt
Created April 2, 2019 14:37
Misleading error message when passing a Kotlin inline class as a @prop to a Litho component that also uses @State
package com.example
import com.facebook.litho.Component
import com.facebook.litho.ComponentContext
import com.facebook.litho.StateValue
import com.facebook.litho.annotations.LayoutSpec
import com.facebook.litho.annotations.OnCreateInitialState
import com.facebook.litho.annotations.OnCreateLayout
import com.facebook.litho.annotations.Prop
import com.facebook.litho.annotations.State
@abdyer
abdyer / flutter_dropdownbutton_example.dart
Created April 5, 2018 09:25
Flutter DropdownButton Example
class _DropdownButtonBugState extends State<DropdownButtonBug> {
final List<String> _items = ['One', 'Two', 'Three', 'Four'].toList();
String _selection;
@override
void initState() {
_selection = _items.first;
super.initState();
@abdyer
abdyer / chromecast_screensaver.js
Created September 23, 2016 17:31
Chromecast Screensaver
javascript:(function(){var w=window.innerWidth;var h=window.innerHeight;var scale=Math.max(w/1280,h/720);var e=document.createElement("div");e.style.border="0";e.style.position="fixed";e.style.top="0";e.style.left="0";e.style.width="100%";e.style.height="100%";e.style.zIndex="999999999";var i=document.createElement("iframe");i.src="https://clients3.google.com/cast/chromecast/home/v/c9541b08";i.frameBorder=0;e.style.border="0";i.style.width="1280px";i.style.height="720px";i.style.pointerEvents="none";i.style.webkitTransform="scale("+scale+")";i.style.webkitTransformOrigin="top left";e.style.overflow="hidden";e.addEventListener("click",function(n){n.preventDefault();this.parentNode.removeChild(this)},false);document.body.appendChild(e);e.appendChild(i)})();
@abdyer
abdyer / JiraTransitionTask.groovy
Created May 26, 2016 16:23
Gradle Jira Transition Task
package com.glasstowerstudios.gruel.tasks.jira
import com.glasstowerstudios.gruel.tasks.GruelTask
import net.rcarz.jiraclient.BasicCredentials
import net.rcarz.jiraclient.Issue
import net.rcarz.jiraclient.Issue.FluentTransition
import net.rcarz.jiraclient.JiraClient
import org.gradle.api.tasks.TaskAction
class JiraTransitionTask extends GruelTask {
@abdyer
abdyer / CreditCardEditText.java
Created July 1, 2015 16:52
CreditCardEditText
package org.andydyer.example;
import android.content.Context;
import android.text.Editable;
import android.text.InputFilter;
import android.text.TextWatcher;
import android.util.AttributeSet;
import android.widget.EditText;
### Keybase proof
I hereby claim:
* I am abdyer on github.
* I am andydyer (https://keybase.io/andydyer) on keybase.
* I have a public key whose fingerprint is 13AD 574C D830 D4B3 4742 9DC9 F137 5A70 2B3A 7E6B
To claim this, I am signing this object: