Skip to content

Instantly share code, notes, and snippets.

View yshrsmz's full-sized avatar

Yasuhiro SHIMIZU yshrsmz

View GitHub Profile
@pyricau
pyricau / OomExceptionHandler.java
Created May 6, 2015 17:18
Dump the heap on OutOfMemoryError crashes in your debug builds.
import android.content.Context;
import android.os.Debug;
import java.io.File;
public class OomExceptionHandler implements Thread.UncaughtExceptionHandler {
private static final String FILENAME = "out-of-memory.hprof";
public static void install(Context context) {
Thread.UncaughtExceptionHandler defaultHandler = Thread.getDefaultUncaughtExceptionHandler();
@zaki50
zaki50 / RealmUtils.java
Last active August 29, 2015 14:19
Realm インスタンスを取得するためのユーティリティクラスはこんな感じか? Application#onCreate() で setupDatabase() を呼んで、 Activity/Fragment#onCreate() で getRealm() して onDestroy() で Realm#close()
import android.content.Context;
import java.io.File;
import io.realm.Realm;
import io.realm.RealmMigration;
import io.realm.exceptions.RealmMigrationNeededException;
public class RealmUtils {
Applicati
@alex-shpak
alex-shpak / Interceptor.java
Last active June 24, 2025 03:32
Refreshing OAuth token with okhttp interceptors. All requests will wait until token refresh finished, and then will continue with the new token.
private class HttpInterceptor implements Interceptor {
@Override
public Response intercept(Chain chain) throws IOException {
Request request = chain.request();
//Build new request
Request.Builder builder = request.newBuilder();
builder.header("Accept", "application/json"); //if necessary, say to consume JSON
@almozavr
almozavr / ObjectGsonParceler.java
Last active September 30, 2020 16:53
Parcelable helper to wrap object convertable with gson
public class ObjectGsonParceler {
private final Gson gson;
public ObjectGsonParceler(Gson gson) {
this.gson = gson;
}
public Parcelable wrap(Object instance) {
try {
String json = encode(instance);
@mizchi
mizchi / フロントエンドを楽にするために.md
Last active June 21, 2025 08:07
フロントエンドを楽にするために

フロントエンドを楽にするために

Qiitaを支えたい技術 at 時雨祭

About

  • HN: mizchi
  • Qiitaの方からきました(入社半年たったらしい)
  • Reactオジサンはそろそろ飽きてきた
  • Angularに興味が無いのでこっちにきた
@Ryann10
Ryann10 / TitledEditText.java
Last active February 1, 2020 21:46
TitledEditText allows to write a large font sized title with a content like done in SimpleNote.
import android.content.Context;
import android.text.Editable;
import android.text.Spannable;
import android.text.TextWatcher;
import android.text.style.RelativeSizeSpan;
import android.util.AttributeSet;
import android.widget.EditText;
public class TitledEditText extends EditText implements TextWatcher{
@tmknom
tmknom / fabfile.py
Created January 17, 2015 07:11
超速でCentOS6.6(さくらのVPS)をセキュアにセットアップするFabricスクリプト
# -*- encoding:utf-8 -*-
#
# CentOSをセキュアにセットアップするFabricスクリプト
#
# This software is released under the MIT License, see LICENSE.txt.
#####################################################################
from fabric.api import env, run, sudo, put
from fabric.colors import green
from fabric.decorators import task
@polbins
polbins / README.md
Last active February 29, 2024 09:58
Simple RecyclerView Divider

Simple RecyclerView Divider

Simple Horizontal Divider Item Decoration for RecyclerView

    mRecyclerView.addItemDecoration(new SimpleDividerItemDecoration(
            getApplicationContext()
    	));

NOTE: Add item decoration prior to setting the adapter

@JvmName
JvmName / Android CI
Created October 28, 2014 23:57
Android CI
#Android and CI and Gradle (A How-To)
There are tech stacks in this world that make it dead simple to integrate a <abbr title="Continuous Integration">CI</abbr> build system. <br>
The Android platform is not one of them.
Although Gradle is getting better, it's still a bit non-deterministic, and some of the fixes you'll need will start to feel more like black magic than any sort of programming.
But fear not! It can be done!
Before we embark on our journey, you'll need a few things to run locally: