Skip to content

Instantly share code, notes, and snippets.

View mitchwongho's full-sized avatar
:atom:
Build > Test > Deploy

Mitchell Wong Ho mitchwongho

:atom:
Build > Test > Deploy
View GitHub Profile
@mitchwongho
mitchwongho / AlphaNumericSorter.java
Created December 12, 2013 09:07
Java implementation of a Comparator that sorts a list of Objects (using Object.toString() ) alphanumerically (case-insensitive)
import java.text.NumberFormat;
import java.text.ParseException;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
/**
* Sorts list of {@code Object} entries alphanumerically.
*/
public class AlphaNumericSorter {
@mitchwongho
mitchwongho / slide_in_bottom.xml
Created March 7, 2014 12:01
Android anim to animate a view sliding in from the bottom. Companion to slide_out_bottom.xml
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate android:fromYDelta="100%p" android:toYDelta="0%p" android:duration="600"/>
<alpha android:fromAlpha="5.0" android:toAlpha="1.0" />
</set>
@mitchwongho
mitchwongho / slide_out_bottom.xml
Created March 7, 2014 12:02
Android anim to animate a view sliding in from the bottom. Companion to slide_in_bottom.xml
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate android:fromYDelta="0%p" android:toYDelta="100%p" android:duration="600"/>
<alpha android:fromAlpha="1.0" android:toAlpha="5.0" />
</set>
@mitchwongho
mitchwongho / gist:9524857
Last active August 29, 2015 13:57
Android ProTip: AsyncTask info
Beginning with Android 3.0 (API level 11), an extra feature is available in AsyncTask
so you can enable it to run across multiple processor cores. Instead of calling execute()
you can specify executeOnExecutor() and multiple requests can be executed at the same time
depending on the number of cores available.
@mitchwongho
mitchwongho / CropCircleTransformation.java
Created April 7, 2014 21:00
A Bitmap transformation used with Picasso to product round/circular-cropped bitmaps
package com.goald.twooceans.util;
import android.graphics.Bitmap;
import android.graphics.BitmapShader;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
@mitchwongho
mitchwongho / Docker
Last active November 29, 2023 06:36
Docker 'run' command to start an interactive BaSH session
# Assuming an Ubuntu Docker image
$ docker run -it <image> /bin/bash
@mitchwongho
mitchwongho / gittin.it
Last active December 28, 2015 13:51
Handy Git commands
# Configuration
## disable mergetool backup files
$ git config --global mergetool.keepBackup false
# Branch
## Show Tracking Branch
$ git remote show origin
## Create a new branch
$ git checkout -b <branch> <remote>/<branch>
@mitchwongho
mitchwongho / vaadin_spring_tomcat.txt
Last active August 29, 2015 14:01
SpringVaadinIntegration ad-on
add-on : http://vaadin.xpoft.ru/
Issues:
java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
see: http://stackoverflow.com/questions/6210757/java-lang-classnotfoundexception-org-springframework-web-context-contextloaderl
@mitchwongho
mitchwongho / jenkins.config
Last active August 29, 2015 14:04
Jenkins config
# Android SDK update
(for i in {1..30}; do echo y; sleep 1; done) | /opt/android/android-sdk-linux/tools/android update sdk -u -a
@mitchwongho
mitchwongho / docker-nsenter
Last active November 29, 2017 15:45
Docker: nsenter
$ docker inspect --format {{.State.Pid}} <CONTAINER_PID>
e.g. $ PID=%(docker inspect --format {{.State.Pid}} <CONTAINER PID>)
$ sudo nsenter --target <pid> --mount --uts --ipc --net --pid /bin/sh