Skip to content

Instantly share code, notes, and snippets.

View vincenthauser's full-sized avatar

Vincent Hauser vincenthauser

  • Bern Hauser
  • Sweden
View GitHub Profile
@vincenthauser
vincenthauser / java
Created August 22, 2018 13:33
Formatted Milliseconds
public static String msToString(long ms) {
long totalSecs = ms/1000;
long hours = (totalSecs / 3600);
long mins = (totalSecs / 60) % 60;
long secs = totalSecs % 60;
String hrsString = (hours == 0)
? "00"
: ((hours < 10)
? "0" + hours
: "" + hours);
<?xml version="1.0" encoding="utf-8" ?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<!-- view background color -->
<solid android:color="@color/transparent">
</solid>
<!-- view border color and width -->
<stroke android:width="100dp" android:color="@color/white">
</stroke>
<!-- If you want to add some padding -->
<padding android:left="0dp" android:top="0dp" android:right="0dp" android:bottom="0dp">
<?xml version="1.0" encoding="utf-8" ?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="ring">
<!-- view background color -->
<solid android:color="@color/transparent">
</solid>
<!-- view border color and width -->
<stroke android:width="56dp" android:color="@color/white">
</stroke>
<!-- If you want to add some padding -->
<padding android:left="0dp" android:top="0dp" android:right="0dp" android:bottom="0dp">
// Immutable -- returns an unmodifiable List instead
public class SafeStates {
private final String[] states = new String[] { "Alabama", "Alaska", ... };
private final List statesAsList
= new AbstractList() {
public Object get(int n) {
return states[n];
}
@vincenthauser
vincenthauser / gist:751477dd96e1bcdb42ad
Created February 2, 2015 16:24
List apps installed on android via ADB
adb shell 'pm list packages -f'
git status | grep .properties | awk '{print $2}' | xargs git checkout
100% — FF
95% — F2
90% — E6
85% — D9
80% — CC
75% — BF
70% — B3
65% — A6
60% — 99
55% — 8C