Skip to content

Instantly share code, notes, and snippets.

query PageSummary($search: String!) {
page(project:"en", title: $search) {
summary {
displaytitle
extract
}
}
}
@maiatoday
maiatoday / Dependencies.kt
Created March 30, 2018 22:28
Dependencies in buildSrc/src/main/java
object Versions {
val gradlePluginVersion = "3.2.0-alpha08"
val okhttpVersion = "3.9.0"
val retrofitVersion = "2.3.0"
val supportLibVersion = "27.1.0"
val kotlinVersion = "1.2.31"
val ktxVersion = "0.1"
val constraintLayoutVersion = "1.0.2"
val junitVersion = "4.12"
@maiatoday
maiatoday / doggoDonations.js
Created March 29, 2018 18:12
Root code to donate to the animal welfare when I drink a coffee
// This runs before the deduct
function beforeTransaction(transaction) {
return true; // Approve transaction
}
// This runs after the deduct
function afterTransaction(transaction) {
var amountString = zarString(transaction.amount);
var balanceString = zarString(root.account().balance);
var shopString = transaction.merchant.name;
@maiatoday
maiatoday / hasStarCount.kt
Created January 26, 2018 13:17
starcountCustomMatcher
fun hasStarCount(i: Int): Matcher<ContrivedParams> {
return object : TypeSafeMatcher<ContrivedParams>() {
override fun describeTo(description: Description) {
description.appendText("starCount should return ").appendValue(i)
}
override fun describeMismatchSafely(item: ContrivedParams, mismatchDescription: Description) {
mismatchDescription.appendText(" was ").appendValue(item.starCount)
}
@maiatoday
maiatoday / intended.kt
Created January 26, 2018 13:16
intendedTest
intended(allOf(
hasComponent(StarActivity::class.java.name),
hasExtras(
hasEntry(StarActivity.EXTRA_PARAMS, allOf(isA(ContrivedParams::class.java),
equalTo(expectedParams))))))
@maiatoday
maiatoday / ContrivedParams.kt
Created January 26, 2018 13:15
ContrivedParams
@Parcelize data class ContrivedParams(val title:String,
val starCount:Int,
val colour:String) : Parcelable
@maiatoday
maiatoday / gist:2df1e24224b9def4fa0b11cd2d5a6ff6
Last active April 26, 2017 15:20
android signing config solution

in ~/.gradle/gradle.properties APP.signing=/home/user/.signing/appname/prefix

in /home/user/.signing/appname put 2 files prefix.keystore the keystore and a gradle snippet with name prefix.gradle prefix.gradle:

android {
    buildTypes {
        debug {
            buildConfigField 'String', 'BASE_URL', '"https://api-debug.example.com"'
class ArrayMapAdapter extends BaseAdapter {
private final ArrayMap<String, String> mData;
public ArrayMapAdapter(ArrayMap<String, String> map) {
mData = map;
}
@Override
public int getCount() {
return mData.size();
@maiatoday
maiatoday / getdb
Last active December 7, 2015 10:10
getdb - little shell script to pull the db for an app on an android emulator or device.
#!/bin/bash
display_usage() {
echo -e "\nUsage:\n`basename $0` -p [package] -n [dbname] \n"
}
# if less than two arguments supplied, display usage
if [ $# -le 2 ]
then
display_usage

Keybase proof

I hereby claim:

  • I am maiatoday on github.
  • I am maiatoday (https://keybase.io/maiatoday) on keybase.
  • I have a public key whose fingerprint is 0911 58E2 03B1 2CBA 7534 C9CA D4FE 1C84 9718 E27F

To claim this, I am signing this object: