Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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 / 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
#################
{"error": "Deprecated: Use preview or live feed from ATC."}
@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 ->
@jromero
jromero / NO NONSENSE BEERWARE LICENSE
Created October 11, 2014 18:39
Based on the poorly worded "THE BEER-WARE LICENSE" by Poul-Henning Kamp.
NO NONSENSE BEERWARE LICENSE
Version 1
You can do whatever you want with this stuff. If we meet some day, and
you think this stuff is worth it, you can buy me/us a beer in return.
@jromero
jromero / jquery.jplayerskin.js
Created November 10, 2010 11:34
Update for dynamic content to jplayerskin from blacknroll
/**
* jPlayerSkin - Class to handle with jplayer initialization and skin behavior
*
* @author BlackNRoll
* @update J.Romero
* @version 1.2 (Unofficial)
* @uses jQuery 1.4.2
* @uses jScrollPane
* @param array myPlayList = Array of json objects. Ex.: var myPlayList = [ {artist:"",name:"",mp3:"",cover:""} ];
* @param string container = The id of the container where the player will be build
@jromero
jromero / jquery.jplayerskin.js
Created November 10, 2010 11:26
Update for proper dynamic content functionality
/**
* jPlayerSkin - Class to handle with jplayer initialization and skin behavior
*
* @author BlackNRoll
* @update J.Romero
* @version 1.2 (Unofficial)
* @uses jQuery 1.4.2
* @uses jScrollPane
* @param array myPlayList = Array of json objects. Ex.: var myPlayList = [ {artist:"",name:"",mp3:"",cover:""} ];
* @param string container = The id of the container where the player will be build
/*
* 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