Skip to content

Instantly share code, notes, and snippets.

View cutmail's full-sized avatar
🏠
Working from home

Tatsuya Arai cutmail

🏠
Working from home
View GitHub Profile
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.nein37.syncadaptersample" >
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.USE_CREDENTIALS" />
<uses-permission android:name="android.permission.WRITE_SYNC_SETTINGS" />
<application
android:icon="@drawable/ic_launcher"
@benvium
benvium / retrofit-custom-error-handling.java
Created August 29, 2014 19:45
Fairly simply Retrofit custom error handling example. Is set up so that you don't need to do much work in the 'failure' handler of a retrofit call to get the user-visible error message to show. Works on all endpoints. There's lots of exception handling as our server folks like to keep us on our toes by sending all kinds of random stuff..!
// on error the server sends JSON
/*
{ "error": { "data": { "message":"A thing went wrong" } } }
*/
// create model classes..
public class ErrorResponse {
Error error;
@ktx2207
ktx2207 / Git_ファイルの履歴を完全に削除する.md
Last active February 17, 2024 05:32
Git ファイルの履歴を完全に削除する

Git ファイルの履歴を完全に削除する

秘密鍵など誤ってコミットしてしまった場合に履歴を完全に削除する手順
参考:6.4 Git のさまざまなツール - 歴史の書き換え

動作確認用にブランチを作成して試す

$ git checkout -b clean-key-file

動作確認用にブランチでgit filter-branchを実行

@mizchi
mizchi / 「フロントエンドデベロッパー面接時の質問事項」への解答.md
Last active April 19, 2025 08:46
「フロントエンドデベロッパー面接時の質問事項」への解答
@hagino3000
hagino3000 / plot_retention_sample.py
Created August 16, 2014 19:33
リテンション率のグラフをmatplotlibで描画する
import numpy as np
import matplotlib.pyplot as plt
# それっぽいデータを作る処理
from datetime import datetime, timedelta
import scipy
import scipy.stats
def create_dummy_data(days):
x = np.linspace(2, 2 + days, days)
y = scipy.stats.norm.pdf(x, loc=0, scale=4) * 4 + 0.15
@gabrielemariotti
gabrielemariotti / Readme.md
Last active August 5, 2025 08:11
A SimpleSectionedRecyclerViewAdapter: use this class to realize a simple sectioned `RecyclerView.Adapter`.

You can use this class to realize a simple sectioned RecyclerView.Adapter without changing your code.

The RecyclerView should use a LinearLayoutManager. You can use this code also with the TwoWayView with the ListLayoutManager (https://github.com/lucasr/twoway-view)

This is a porting of the class SimpleSectionedListAdapter provided by Google

Screen

Example:

@matsubo
matsubo / credit_card_bin_codes.md
Last active October 1, 2025 04:39
Credit Card Bin Codes

概要

クレジットカード番号には法則があり、先頭6桁でカードの種類を識別、分類することができる。

詳細はISO/IEC 7812で規定されている。

ISO/IEC 7812 - Wikipedia https://ja.wikipedia.org/wiki/ISO/IEC_7812

先頭の6桁を銀行識別番号(Bank Identification Number、略称:BIN)ないしは発行者識別番号(Issuer Identification Number、略称:IIN)と呼び、この先頭6桁でカード発行会社(イシュア、issuer)が判るようになっている。

@gfx
gfx / swfit-methods.md
Last active July 17, 2017 03:04
swiftでメソッドシグネチャどう書く問題

ドキュメントを書くとき、ObjCの setTile:forState: を Swfitでどう書くか。

setTitle(_: String!, forState: UIControlState)

フルパターン。

メリット:

  • 情報量が多くてわかりやすい
  • オーバーロードしていても曖昧でない
@laiso
laiso / ViewController.m
Created July 23, 2014 07:12
神経系に訴えかける同意ボタン http://youtu.be/JfzJ_RkizIo
@interface ViewController ()
@property (nonatomic, weak) IBOutlet UIButton *button;
@end
@implementation ViewController
- (void)viewDidLoad
{
@burgalon
burgalon / AccountAuthenticator.java
Last active November 12, 2025 22:46
Implementing OAuth2 with AccountManager, Retrofit and Dagger
public class AccountAuthenticator extends AbstractAccountAuthenticator {
private final Context context;
@Inject @ClientId String clientId;
@Inject @ClientSecret String clientSecret;
@Inject ApiService apiService;
public AccountAuthenticator(Context context) {
super(context);