Skip to content

Instantly share code, notes, and snippets.

Avatar
🇺🇸

Xizhi Zhu xizzhu

🇺🇸
View GitHub Profile
View countries.json
[{
"name": "Afghanistan",
"code": "AF"
}, {
"name": "Åland Islands",
"code": "AX"
}, {
"name": "Albania",
"code": "AL"
}, {
@xizzhu
xizzhu / Triple.java
Created Dec 19, 2016
Triple for Java
View Triple.java
public class Triple<F, S, T> {
public final F first;
public final S second;
public final T third;
public Triple(F first, S second, T third) {
this.first = first;
this.second = second;
this.third = third;
}
@xizzhu
xizzhu / AutoValueSharedPreferencesExtension.java
Last active Jul 21, 2016
Auto Value Shared Preferences Extension
View AutoValueSharedPreferencesExtension.java
package com.github.xizzhu.auto.value.sharedpreferences;
import com.google.auto.service.AutoService;
import com.google.auto.value.extension.AutoValueExtension;
import com.squareup.javapoet.ClassName;
import com.squareup.javapoet.CodeBlock;
import com.squareup.javapoet.JavaFile;
import com.squareup.javapoet.MethodSpec;
import com.squareup.javapoet.ParameterSpec;
import com.squareup.javapoet.ParameterizedTypeName;
View MainActivity.java
public class MainActivity extends Activity implements
GooglePlayServicesClient.ConnectionCallbacks,
GooglePlayServicesClient.OnConnectionFailedListener,
LocationListener,
LocationClient.OnAddGeofencesResultListener {
private LocationClient mLocationClient;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@xizzhu
xizzhu / MainActivity.java
Created Feb 7, 2014
Check Availability of Google Play Services
View MainActivity.java
public class MainActivity extends Activity {
@Override
protected void onResume() {
super.onResume();
// code that doesn't require Google Play services
if (!checkGooglePlayServices())
return;