Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Andrew Chen yongjhih

🏠
Working from home
View GitHub Profile
View gist:6895122
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| │·········
View couchbase-sync-gateway_init.d
#!/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 Aug 29, 2015
Android Animation Util
View AnimationUtils.java
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);
View pulse_out_repeat.xml
<?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"
View Sqluery.java
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.
View gist:96c8416915478b35aea6
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 Aug 29, 2015
build.gradle
View build.gradle
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.+'
}
}
View joey.conf
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^/$ /login.php [PT]
</IfModule>
View rxjava.java
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 Aug 8, 2016
OperatorGroupByGroup.java
View ObservableUtils.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.*;