Skip to content

Instantly share code, notes, and snippets.


David Truxall davetrux

View GitHub Profile
davetrux / Static Inner Class API
Last active Dec 15, 2015
Using newer Android APIs in an older version
View Static Inner Class API
* Handles Gingerbread crash due to implementation change
private static Point getDisplaySize(final Display display) {
return APIv11.getDisplaySize(display);
} else {
final Point point = new Point();
point.x = display.getWidth();
davetrux / Android Multi-API Preference Saving
Created Mar 28, 2013
Another static Android API example
View Android Multi-API Preference Saving
public class Settings extends PreferenceActivity {
public void onCreate(Bundle savedInstanceState) {
davetrux / Android Dev Key
Created Apr 6, 2013
Command line call to get the Android dev key. Empty password.
View Android Dev Key
keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore -v -list
View Enum.TryParse
/// Takes a string that represents an enum member
/// and returns the enum member
/// </SUMMARY>
/// <TYPEPARAM name="T">An Enum</TYPEPARAM>
/// <PARAM name="input">The string that is the enum member name, case does not matter</PARAM>
/// <PARAM name="returnValue">The value from the enum that matches the string, or the first value of the enum</PARAM>
/// <RETURNS>True when there is a match, false when not </RETURNS>
/// - When no match the first item in the enum is returned
davetrux / DB Manager Launch
Created Feb 20, 2014
HSQLDB Manager Launch Code
View DB Manager Launch
org.hsqldb.util.DatabaseManagerSwing.main(new String[] {
"--url", "jdbc:hsqldb:mem:testdb", "--noexit"
View GrizzlyWebServletAndFilterTest
package com.truxall.demo;
import com.sun.jersey.api.client.WebResource;
import com.sun.jersey.spi.container.servlet.ServletContainer;
import com.sun.jersey.test.framework.AppDescriptor;
import com.sun.jersey.test.framework.JerseyTest;
import com.sun.jersey.test.framework.WebAppDescriptor;
import com.sun.jersey.test.framework.spi.container.TestContainerFactory;
import com.sun.jersey.test.framework.spi.container.grizzly2.web.GrizzlyWebTestContainerFactory;
import org.junit.Assert;
davetrux / GrizzlyWebServletAndFilterTest build.gradle
Created Mar 4, 2014
Build script for GrizzlyWebServletAndFilterTest gist
View GrizzlyWebServletAndFilterTest build.gradle
apply plugin: 'java'
apply plugin: 'war'
sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7
version = '1.0'
repositories {
davetrux / GuiceServletConfig
Created Mar 4, 2014
Configuration class for instantiation of Jersey Services with Guice
View GuiceServletConfig
import com.demo.DemoRestService;
import com.demo.BasicAuthFilter;
import com.sun.jersey.guice.JerseyServletModule;
davetrux / SQLiteDebugADB
Created Mar 24, 2014
Verbose Logging of SQLite statements in Android
View SQLiteDebugADB
adb shell setprop log.tag.SQLiteLog V
adb shell setprop log.tag.SQLiteStatements V
adb shell stop
adb shell start
View Profile
alias ll="ls -lahL"
alias con="tail -40 -f /var/log/system.log"
bind '"\e[A":history-search-backward'
bind '"\e[B":history-search-forward'