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
diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb │··············
index 39c1b7c2..e645bd5 100644 │··············
--- a/config/initializers/devise.rb │··············
+++ b/config/initializers/devise.rb │··············
@@ -224,6 +224,8 @@ Devise.setup do |config| │·········
#!/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 / rxjava.java
Last active August 8, 2016 03:43
RxJava
Observable.merge(Observable.from(getRawSelfPosts()), Observable.from(getRawFriendPosts()), Observable.from(getRawNearbyPosts(activity)))
.distinct((post) -> post.getObjectId())
.subscribeOn(Schedulers.io());
getRawPostsObs(activity).map((post) -> postToCardModel(post));
new RxList(getRawPostsObs(activity));
getPostsObs(activity).toList().toBlocking().single();
@yongjhih
yongjhih / ObservableUtils.java
Last active August 8, 2016 04:51
OperatorGroupByGroup.java
package rx.util;
import rx.schedulers.*;
import rx.Observable;
import rx.android.schedulers.*;
import rx.android.observables.*;
import rx.functions.*;
import rx.observables.*;
import rx.util.*;