Skip to content

Instantly share code, notes, and snippets.

Avatar

Vincent Hauser vincenthauser

  • Bern Hauser
  • Sweden
View GitHub Profile
@vincenthauser
vincenthauser / java
Created Aug 22, 2018
Formatted Milliseconds
View java
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);
View Arduino: led_blink_schemes
View square mask android
<?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">
View circle mask android
<?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">
View gist:417331e1228bd8ea1bf4
// 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 Feb 2, 2015
List apps installed on android via ADB
View gist:751477dd96e1bcdb42ad
adb shell 'pm list packages -f'
View reset_properties
git status | grep .properties | awk '{print $2}' | xargs git checkout
View Alpha Transparency codes
100% — FF
95% — F2
90% — E6
85% — D9
80% — CC
75% — BF
70% — B3
65% — A6
60% — 99
55% — 8C