Skip to content

Instantly share code, notes, and snippets.

View yongjhih's full-sized avatar
🏠
Working from home

Andrew Chen yongjhih

🏠
Working from home
View GitHub Profile
@yongjhih
yongjhih / RetroWeibo_SimpleWeibo.java
Created August 28, 2015 20:31
RetroWeibo_SimpleWeibo.java
package com.sina.weibo.simple;
import rx.Observable;
import android.util.Log;
import com.bluelinelabs.logansquare.LoganSquare;
import com.sina.weibo.sdk.auth.*;
import com.sina.weibo.sdk.auth.sso.*;
import com.sina.weibo.sdk.exception.*;
#!/bin/sh
#
# Startup / shutdown script for the couchbase sync_gateway
#
if [ "$(id -u)" != "0" ]; then
echo "Must run as root"
exit 1
fi
@yongjhih
yongjhih / AnimationUtils.java
Last active August 29, 2015 14:04
Android Animation Util
private static void pulse(View view) {
animateFromResource(view, R.anim.pulse_out_repeat);
}
private static void fadein(View view) {
animateFromResource(view, android.R.anim.fade_in);
}
private static void fadeout(View view) {
animateOutFromResource(view, android.R.anim.fade_out);
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<scale
android:fromXScale="0.1"
android:fromYScale="0.1"
android:toXScale="1"
android:toYScale="1"
android:pivotX="50%"
android:pivotY="50%"
android:duration="1500"
package com.story.util;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
//import android.database.sqlite.SQLiteQueryBuilder;
/**
* The selection and selectionArgs helper, SQLiteQueryBuilder.appendWhere(where) whereClause alternative.
android-gradle-plugin
Import from aosp https://android.googlesource.com/platform/tools/base
Usage
build.gradle:
android {
defaultConfig {
multiDexEnabled true
multiDexKeepProguard file('multiDexKeep.pro') // keep specific classes using proguard syntax
@yongjhih
yongjhih / build.gradle
Last active August 29, 2015 14:11
build.gradle
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.+'
}
}
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^/$ /login.php [PT]
</IfModule>
@yongjhih
yongjhih / ParseQueryTest.java
Created March 6, 2015 16:38
ParseQueryTest
public class MyActivity extends Activity {
@Override public void onResume() {
super.onResume();
ParseQuery<ParseObject> query = ParseQuery.getQuery(ParseObject.class);
query.findInBackground(new FindCallback() {
@Override done(List<ParseObject> objects, ParseException e) {
getActivity().runOnUiThread(new Runnable() {
@Override public void run() {
@yongjhih
yongjhih / Optional.java
Last active August 29, 2015 14:16
Optional Observable
public class Optional<T> {
Observable<T> obs;
public Optional(Observable<T> obs) {
this.obs = obs;
}
public static <T> Optional<T> of(T value) {
if (value == null) {
throw new NullPointerException();