Skip to content

Instantly share code, notes, and snippets.

package packge.for.you
import android.view.View
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleOwner
import autodispose2.CompletableSubscribeProxy
import autodispose2.FlowableSubscribeProxy
import autodispose2.MaybeSubscribeProxy
import autodispose2.ObservableSubscribeProxy
import autodispose2.ScopeProvider
import io.reactivex.Observable
/**
* RxJavaのStreamに流れる一つ前の値と現在の値をひとまとめにするための型
*/
data class Change<T : Any>(
val previous: T?,
val current: T,
)
import io.reactivex.Single
import io.reactivex.rxkotlin.Singles
fun <T1 : Any, T2 : Any> Singles.zipDelayError(
s1: Single<T1>,
s2: Single<T2>,
): Single<Pair<T1, T2>> {
abstract class Value(val sortOrder: Int) {
abstract val value: Any
}
@crimsonwoods
crimsonwoods / Android.mk
Last active February 14, 2017 15:33
Sample makefile for building a shared library using mruby for Android.
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := mruby
LOCAL_SRC_FILES := /path/to/your/prebuilt/$(TARGET_ARCH_ABI)/libmruby.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
@crimsonwoods
crimsonwoods / MysteryCodeBroken.swift
Created February 3, 2016 03:35
Xcode 7.2で謎の現象が起きるコード
//
// このコードをXcode 7.2(7.2.1ではない)でDeployment Targetを7でビルドして、
// iOS7.1.2のデバイスで実行するとfatalErrorが発生する。
//
import UIKit
class Logger {
func put(message: String) {
print(message)
@crimsonwoods
crimsonwoods / kosenconf-100tokyoの交通費等支援の募集要項.md
Last active December 21, 2015 15:26
Kosenconf-100tokyoの交通費等支援の募集要項

KCFunds ってなに?

高専カンファレンスとお酒が大好きな人達がはじめた個人的なプロジェクトです。KCFundsでは、経済的困難などの問題により、関東での高専カンファレンスに参加できない学生さんを支援します。

更新情報

  • 第一回目の応募を締め切りました。
  • 第二回目の応募も締め切りました。
  • 高専カンファレンス100 in 東京は無事に終了いたしました。
@crimsonwoods
crimsonwoods / build_config.rb
Created February 20, 2015 09:07
Sample build script for custom mruby based on "1.1.0" (multi-threading supported version)
MRuby::Build.new do |conf|
# load specific toolchain settings
# Gets set by the VS command prompts.
if ENV['VisualStudioVersion'] || ENV['VSINSTALLDIR']
toolchain :visualcpp
else
toolchain :gcc
end
@crimsonwoods
crimsonwoods / LGL25_Fx0_config.txt
Created December 29, 2014 13:12
Kernel configuration for LGL25 named as Fx0
#
# Automatically generated file; DO NOT EDIT.
# Linux/arm 3.4.0 Kernel Configuration
#
CONFIG_ARM=y
CONFIG_ARM_HAS_SG_CHAIN=y
CONFIG_SYS_SUPPORTS_APM_EMULATION=y
CONFIG_GENERIC_GPIO=y
# CONFIG_ARCH_USES_GETTIMEOFFSET is not set
CONFIG_GENERIC_CLOCKEVENTS=y
@crimsonwoods
crimsonwoods / fib39_mt.rb
Created April 19, 2014 05:53
perform fib39 concurrently
# Fib 39
def fib n
return n if n < 2
fib(n-2) + fib(n-1)
end
t1 = Thread.new do
fib(39)
end
@crimsonwoods
crimsonwoods / thread.c
Created November 17, 2013 15:38
This is experimental implementation to add thread support into mruby.
#include "mruby.h"
#include "mruby/thread.h"
#include "mruby/variable.h"
#include "mruby/gc.h"
#ifdef ENABLE_THREAD
typedef struct mrb_thread_impl {
mrb_state *mrb;
mrb_gem_thread_t thread;