defaults write com.apple.LaunchServices LSHandlers -array-add '{LSHandlerContentType=public.plain-text;LSHandlerRoleAll=com.sublimetext.4;}' |
public abstract class CustomizedTypeAdapterFactory<C> | |
implements TypeAdapterFactory { | |
private final Class<C> customizedClass; | |
public CustomizedTypeAdapterFactory(Class<C> customizedClass) { | |
this.customizedClass = customizedClass; | |
} | |
@SuppressWarnings("unchecked") // we use a runtime check to guarantee that 'C' and 'T' are equal | |
public final <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { |
Prereq:
apt-get install zsh
apt-get install git-core
Getting zsh to work in ubuntu is weird, since sh
does not understand the source
command. So, you do this to install zsh
wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | zsh
If one module has a dependency on version 1.1 of library X and another module on version 2.0 of the same library, gradle will use the latest version.
To make gradle fail the build on encountering a conflict, we can do the following:
configurations.all {
resolutionStrategy {
The default behavior of Gradle to pick the newest version also applies if a lower version has been declared locally, but another dependency transitively pulls in a newer version. This is in contrast with Maven, where a locally declared version will always win.
For example, if your build.gradle
specifies the dependency org.springframework:spring-tx:3.2.3.RELEASE
, and another dependency declares 4.0.5.RELEASE
as a transitive dependency, then 4.0.5.RELEASE
will take precedence:
dependencies {
compile("org.springframework.data:spring-data-hadoop:2.0.0.RELEASE")
compile("org.springframework:spring-tx:3.2.3.RELEASE")
// will select org.springframework:spring-tx:4.0.5.RELEASE
#!/bin/sh | |
# License for any modification to the original (linked below): | |
# ---------------------------------------------------------------------------- | |
# "THE BEER-WARE LICENSE" (Revision 42): | |
# Sebastiano Poggi wrote this file. As long as you retain | |
# this notice 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 us a beer in return. | |
# | |
# Based on http://bit.ly/295BHLx |
// Make a custom Gson instance, with a custom TypeAdapter for each wrapper object. | |
// In this instance we only have RealmList<RealmInt> as a a wrapper for RealmList<Integer> | |
Type token = new TypeToken<RealmList<RealmInt>>(){}.getType(); | |
Gson gson = new GsonBuilder() | |
.setExclusionStrategies(new ExclusionStrategy() { | |
@Override | |
public boolean shouldSkipField(FieldAttributes f) { | |
return f.getDeclaringClass().equals(RealmObject.class); | |
} |
import android.animation.ValueAnimator; | |
import android.graphics.ColorMatrix; | |
import android.graphics.ColorMatrixColorFilter; | |
import android.view.animation.AccelerateDecelerateInterpolator; | |
import android.view.animation.Interpolator; | |
import android.widget.ImageView; | |
import java.lang.ref.SoftReference; | |
public class PhotographicPrintAnimator { |