Skip to content

Instantly share code, notes, and snippets.

Yutaro Iino ytRino

View GitHub Profile
View AsyncOrderSafeObservableTest.java
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 Mar 28, 2016
RetrofitSingleSubscriber
View RetrofitSingleSubscriber.java
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 Aug 29, 2015
RxFibonacci
View Hoge.java
// 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());
}
});
}
View test.java
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 Aug 29, 2015
simple progress bar customize
View res\drawable\custom__progress.xml
<?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"
/>
View log
pulic static void logd(String format, Object... args) {
Log.d(TAG, String.format(Locale.getDefault(), format, args));
}
View IO transfer by FileChannel .java
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 Nov 12, 2012
形式言語理論 3 認識問題 命題3.1
View FormalLanguageTheory3.md

形式言語理論 3 認識問題

定義とか

  • Σ: アルファベット(有限集合)
  • Ω = Σ ∪ { [, ]}
  • Ω^* : Ω上の語全体からなる集合
  • L_p : Ω上の言語 (括弧言語)
    • 基底 : Σの元と空語λ
    • 帰納ステップ : u,vL_pの元ならば uv[u]L_pの元
@ytRino
ytRino / Hoge.java
Created Sep 28, 2012
assetsが許されるのは、sy(
View Hoge.java
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();
View gist:3760595

##ListView読み込み

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

##AsyncTask

  • 結果のコールバック
You can’t perform that action at this time.