Skip to content

Instantly share code, notes, and snippets.

@jromero
jromero / spoon.gradle
Created August 27, 2014 04:55
A basic spoon task for Gradle to assemble debug apk, test apk, and execute spoon runner. (For a more robust implementation take a look at: https://github.com/stanfy/spoon-gradle-plugin)
def spoonRunner = "libs-uitests/spoon-runner-1.1.1-jar-with-dependencies.jar"
task spoon (dependsOn: ['assembleDebug', 'assembleDebugTest']) << {
def rootDir = project.rootDir
def localProperties = new File(rootDir, "local.properties")
def sdkDir
if (localProperties.exists()) {
Properties properties = new Properties()
localProperties.withInputStream { instr ->
{"error": "Deprecated: Use preview or live feed from ATC."}
@jromero
jromero / build-concorde-osx-0_2.sh
Last active August 29, 2015 14:02
Updated Concorde TSP build script (http://www.tsp.gatech.edu/ no longer available)
#################
# Moved to https://github.com/jromero/tsp_art_tools
#################
@jromero
jromero / custom_rules.xml
Created May 2, 2014 18:16
Ant build script xml for doing annotation preprocessing from Dagger. Port of https://github.com/excilys/androidannotations/wiki/Automating-the-Build-in-Jenkins-with-Ant
<?xml version="1.0" encoding="UTF-8"?>
<project name="******YOUR PROJECT NAME******" default="help">
<property name="apt_generated.dir" value="${basedir}/.apt_generated/" />
<target name="-pre-clean">
<delete dir="${apt_generated.dir}" verbose="${verbose}" />
<mkdir dir="${apt_generated.dir}" />
</target>
<target name="-pre-compile">
/*
* Copyright (C) 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
@jromero
jromero / BaseDriver.java
Last active August 29, 2015 14:00
Basic SQL Driver implementation used in Connect2SQL
import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import me.jromero.connect2sql.sql.ConnectionDetails;
@jromero
jromero / TextColorAnimator
Created March 3, 2014 19:02
Android: TextColorAnimator, animates the color of a given TextView.
class TextColorAnimator extends ValueAnimator implements AnimatorUpdateListener {
private TextView mTextView;
private TextColorAnimator(TextView textView, int startColor, int endColor) {
mTextView = textView;
setObjectValues(startColor, endColor);
setEvaluator(new ArgbEvaluator());
addUpdateListener(this);
}
@jromero
jromero / CalendarGson.java
Created March 2, 2014 19:30
DateDeserializer for Gson based on different SimpleDateFormats
package org.dallasmakerspace.kiosk.data.calendar;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import org.dallasmakerspace.kiosk.gson.DateDeserializer;
import java.text.SimpleDateFormat;
import java.util.Date;
@jromero
jromero / Parameterized Enum
Last active August 29, 2015 13:56
Example on how to use a parameterized Enum to maintain associated keys and values.
package com.github.unispeech.languageselect;
import com.rookery.web_api_translate.type.Language;
public enum SupportedSttLanguage {
ENGLISH_US("eng-AUS", "English", "US", Language.ENGLISH),
ENGLISH_UK("eng-GBR", "English", "UK", Language.ENGLISH),
ENGLISH_AUS("eng-USA", "English", "Australia", Language.ENGLISH),
ARABIC_EGYPT("ara-EGY", "Arabic", "Egypt", Language.ARABIC),
ARABIC_SAUDI("ara-SAU", "Arabic", "Saudi", Language.ARABIC),
@jromero
jromero / adb_db_pull.sh
Created February 11, 2014 17:16
Pull database from _debuggable_ Android application on device. (Credit to: http://stackoverflow.com/a/12914297/552902)
#!/bin/bash
REQUIRED_ARGS=2
PULL_DIR="./"
ADB_PATH=`which adb`
if [ $? -ne 0 ]
then
echo "Could not find adb!"
exit 1
fi;