Skip to content

Instantly share code, notes, and snippets.

View tmtrademarked's full-sized avatar

Tom Wilson tmtrademarked

View GitHub Profile
@tmtrademarked
tmtrademarked / upload_deobfuscation.sh
Created July 27, 2018 22:13
Manual Crashlytics Proguard uploader
#!/bin/sh
# Temporary work-around script for uploading a proguard file. Based on a version
# found here: https://gist.github.com/jakeouellette/608d934efaaf50b3cb15886e66009664
#
# NOTE - this file assumes you've already run the build, and that you are using
# Crashlytics via the Firebase plugin and Google Play Services. Your mileage may
# vary based on your needs.
# Copyright 2017 Google Inc.
@tmtrademarked
tmtrademarked / Fastfile
Created March 25, 2018 16:12
Preparing version notes for upload via supply
desc "Move the release notes to the correct location"
private_lane :prepare_release_notes do
versions = google_play_track_version_codes(
package_name: "com.blueapron.blueapron.release",
track: "rollout"
)
metadata_dir="blueapron-release/en-US/changelogs"
sh("cp #{metadata_dir}/CURRENT_VERSION.txt #{metadata_dir}/#{versions[0]}.txt")
# Create a new branch and upload a PR for it.
@tmtrademarked
tmtrademarked / FontTabLayout.java
Created January 5, 2017 00:10
SImple wrapper class to support fonts in TabLayout
/**
* Simple helper class which extends a TabLayout to allow us to customize the font of the tab.
*/
public final class FontTabLayout extends TabLayout {
// TODO - support customizing via XML rather than hardcoding.
private static final String FONT_PATH = "fonts/Roboto.ttf";
private Typeface mTypeface;
public FontTabLayout(Context context) {
@tmtrademarked
tmtrademarked / version2.gradle
Created January 3, 2017 00:03
Gradle Versioning, Redux
// In version.properties:
major=0
minor=1
// In root-level build.gradle:
def readVersion = { ->
def versionPropsFile = file('../version.properties')
def Properties versionProps = new Properties()
versionProps.load(new FileInputStream(versionPropsFile))
@tmtrademarked
tmtrademarked / version1.gradle
Last active January 3, 2017 00:04
Gradle Versioning
// In root-level build.gradle
def getBaseVersionCode = { ->
// Get the version code relative to the current branch. Will typically be slightly ahead of master.
def current = "git rev-parse --abbrev-ref HEAD".execute()
def cmd = "git rev-list " + current.text + " --first-parent --count"
def process = cmd.execute()
return process.text.toInteger()
}
def getBaseVersionName = { ->
@tmtrademarked
tmtrademarked / Portal.java
Last active December 12, 2016 16:47
Extended Portal class
package com.blueapron.service.cache;
import com.blueapron.service.models.NetworkModel;
import com.blueapron.service.models.network.JsonModelConverter;
import java.io.Closeable;
import java.util.Collection;
import java.util.List;
import io.realm.Realm;
@tmtrademarked
tmtrademarked / Recipe.java
Last active December 12, 2016 02:19
Simple Recipe example
public class Recipe extends RealmObject {
// Recipe overview - sent from overview endpoint.
@PrimaryKey
public String id;
public boolean available;
public String description;
public String url;
// Recipe detail - sent from detail endpoint, along with the ID.
public int calories_per_serving;
@tmtrademarked
tmtrademarked / Portal.java
Last active December 12, 2016 16:47
Portal example
package com.blueapron.service.cache;
import com.blueapron.service.models.NetworkModel;
import com.blueapron.service.models.network.JsonModelConverter;
import java.io.Closeable;
import java.util.Collection;
import java.util.List;
import io.realm.Realm;
@tmtrademarked
tmtrademarked / RealmGate.java
Created December 12, 2016 02:06
RealmGate example
import android.content.Context;
import com.blueapron.service.dagger.scopes.AppContext;
import com.blueapron.service.models.NetworkModel;
import java.util.List;
import io.realm.Realm;
import io.realm.RealmConfiguration;
import io.realm.RealmObject;