Skip to content

Instantly share code, notes, and snippets.

View mrtry's full-sized avatar
🥳

Shinnosuke Yamamoto mrtry

🥳
View GitHub Profile
@inyl
inyl / Rx.java
Created October 14, 2016 06:05
RxJava await example
Completable som1 = Completable.fromAction(() -> System.out.println("Hello World")).subscribeOn(Schedulers.io());
Completable som2 = Completable.fromAction(() -> System.out.println("Foo bar")).subscribeOn(Schedulers.io());
Completable.merge(som1, som2).await();
System.out.println("await done");
@hiroyuki-seto
hiroyuki-seto / ContextMenu.md
Created November 10, 2016 12:35
Android Nで変わったContextMenuまわり

Android Nで変わったContextMenuまわり

知りたかった点

  • Nでは長押しした位置にContextMenuが出るがどうやっているか
  • View#performLongClick(int,int)View#showContextMenu(int,int)が追加されている
  • View#performLongClickInternalで指の位置があるかによってshowContextMenu(int,int)showContextMenu()を呼び分け
  • NではDarkThemeにするとPopupWindowが黒背景になるが、どうにかならんのか
  • M以前はDialogだったのでテーマを書き換えられた。NはPopupかつcom.android.internal.R.attr.contextPopupMenuStyleを使っているのできびしそう?

追ってみた

@mauidude
mauidude / index.ios.js
Created December 15, 2016 22:43
react-native ListView with RefreshControl and infinite scrolling
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View,
ListView,
RefreshControl
} from 'react-native';
@pratikbutani
pratikbutani / EndlessRecyclerOnScrollListener.java
Last active December 15, 2023 13:05
Endless RecyclerView OnScrollListener for pagination
public abstract class EndlessRecyclerViewScrollListener extends RecyclerView.OnScrollListener {
// The minimum amount of items to have below your current scroll position
// before loading more.
private int visibleThreshold = 5;
// The current offset index of data you have loaded
private int currentPage = 0;
// The total number of items in the dataset after the last load
private int previousTotalItemCount = 0;
@ryugoo
ryugoo / Either.java
Last active October 1, 2017 14:42
Either class using Lightweight Stream API
public final class Either<Left, Right> {
private final Optional<Left> left;
private final Optional<Right> right;
private Either(Optional<Left> left, Optional<Right> right) {
this.left = left;
this.right = right;
}
public static <Left, Right> Either<Left, Right> left(@NonNull Left value) {
@shyouhei
shyouhei / chart.png
Last active September 29, 2017 05:50
chart.png
@konifar
konifar / android_unused_resource_remover.py
Created April 20, 2018 04:31
android_unused_resource_remover.py
# -*- coding: utf-8 -*-
import commands
import glob
import os
import xml.etree.ElementTree as ElementTree
# http://stackoverflow.com/questions/33573807/faithfully-preserve-comments-in-parsed-xml-python-2-7
class CommentedTreeBuilder(ElementTree.TreeBuilder):
def __init__(self, *args, **kwargs):
@JofArnold
JofArnold / Login.m
Last active October 26, 2022 13:31
Using promises in React Native modules with Swift
// Created by react-native-create-bridge
// import RCTBridgeModule
#if __has_include(<React/RCTBridgeModule.h>)
#import <React/RCTBridgeModule.h>
#elif __has_include(“RCTBridgeModule.h”)
#import “RCTBridgeModule.h”
#else
#import “React/RCTBridgeModule.h” // Required when used as a Pod in a Swift project
#endif
@tyrcho
tyrcho / howto.md
Last active November 22, 2023 02:04
Git secret and CI