Skip to content

Instantly share code, notes, and snippets.

public void concatEager() {
final TestSubscriber<List<String>> testSubscriber = new TestSubscriber<>();
final long startTime = new Date().getTime();
System.out.println("Start.");
Observable.concatEager( //
asyncObservable("uno", 4), //
asyncObservable("dos", 3), //
@ytRino
ytRino / RetrofitSingleSubscriber.java
Last active March 28, 2016 08:16
RetrofitSingleSubscriber
public abstract class RetrofitSingleSubscriber<T> extends SingleSubscriber<T> {
public abstract void onHttpError(HttpException e);
public abstract void onNonHttpError(Throwable e);
@Override public void onError(Throwable error) {
if (error instanceof HttpException) {
onHttpError((HttpException) error);
} else {
@ytRino
ytRino / Hoge.java
Last active August 29, 2015 14:14
RxFibonacci
// in android :p
private void printFib(int l) {
fib(l).subscribe(new Action1<List<Long>>() {
@Override
public void call(List<Long> fib) {
Log.v(TAG, fib.toString());
}
});
}
@ytRino
ytRino / test.java
Last active August 29, 2015 14:08
package secret
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebView;
@ytRino
ytRino / res\drawable\custom__progress.xml
Last active August 29, 2015 14:05
simple progress bar customize
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@android:id/background">
<shape android:shape="line">
<stroke
android:width="4dp"
android:color="#474747"
/>
@ytRino
ytRino / log
Created February 26, 2013 09:44
pulic static void logd(String format, Object... args) {
Log.d(TAG, String.format(Locale.getDefault(), format, args));
}
public static long copyFileStream(FileInputStream is, FileOutputStream os)
throws IOException {
FileChannel srcChannel = null;
FileChannel destChannel = null;
try {
srcChannel = is.getChannel();
destChannel = os.getChannel();
return srcChannel.transferTo(0, srcChannel.size(), destChannel);
} finally {
@ytRino
ytRino / FormalLanguageTheory3.md
Created November 12, 2012 17:29
形式言語理論 3 認識問題 命題3.1

形式言語理論 3 認識問題

定義とか

  • Σ: アルファベット(有限集合)
  • Ω = Σ ∪ { [, ]}
  • Ω^* : Ω上の語全体からなる集合
  • L_p : Ω上の言語 (括弧言語)
    • 基底 : Σの元と空語λ
    • 帰納ステップ : u,vL_pの元ならば uv[u]L_pの元
@ytRino
ytRino / Hoge.java
Created September 28, 2012 09:08
assetsが許されるのは、sy(
public static Twitter getTwitter(Context ctx) {
InputStream is = null;
TwitterFactory tf;
try {
is = ctx.getResources().getAssets().open("twitter4j.properties");
PropertyConfiguration conf = new PropertyConfiguration(is);
tf = new TwitterFactory(conf);
} catch (IOException e) {
tf = new TwitterFactory();
@ytRino
ytRino / gist:3760595
Created September 21, 2012 09:33
lib

##ListView読み込み

  • 件数指定
  • 自動・手動
  • 追加ボタン・オーバースクロール
  • リストアイテム非同期読み込みとか

##AsyncTask

  • 結果のコールバック