Skip to content

Instantly share code, notes, and snippets.

View oogatta's full-sized avatar

Naohiro Oogata oogatta

View GitHub Profile
@oogatta
oogatta / kotlin-flow-retrying-forever-suspending-functions.kt
Last active September 14, 2020 16:21
kotlin flow retrying forever (suspending functions)
// suspending functions
flow {
emit(doSomethingSuspending())
}.mapNotNull {
if (it == null) {
throw Exception()
}
it
}.retryWhen { _, _ ->
delay(RETRY_INTERVAL)
@oogatta
oogatta / kotlin-flow-retrying-forever-callbacks.kt
Last active September 14, 2020 16:21
kotlin flow retrying forever (callbacks)
// kinds of callbacks
channelFlow {
do.something(object: SomethingListher {
override fun onSomething(something: Something?) {
send(something)
}
})
}.mapNotNull {
if (it == null) {
throw Exception()
{
"title": "oogatta",
"rules": [
{
"description": "右コントロールを単体で押したときに、カーソル上を送信する。",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "right_control",
<span style="color:#f00">test</span>
// ☁️ Admin node
admin.database().ref().child("test").child("Admin")
.orderByChild("hoge") // ソートキー
.endAt(2) // 切り取る範囲
.limitToLast(2) // 切り取る範囲
.on("child_added", snapshot => {
console.log(`(${snapshot.val().hoge}, ${snapshot.val().fuga})`);
});
// 🍎 iOS Swift
// ☁️ Admin node
admin.database().ref().child("test").child("Admin")
.orderByChild("hoge") // ソートキー
.startAt(2) // 切り取る範囲
.limitToFirst(2) // 切り取る範囲
.on("child_added", snapshot => {
console.log(`(${snapshot.val().hoge}, ${snapshot.val().fuga})`);
});
// 🍎 iOS Swift
@oogatta
oogatta / 9.txt
Last active October 3, 2017 12:37
// ☁️ Admin node
admin.database().ref().child("test").child("Admin")
.orderByChild("hoge") // ソートキー
.startAt(2) // 切り取る範囲
.endAt(4) // 切り取る範囲
.on("child_added", snapshot => {
console.log(`(${snapshot.val().hoge}, ${snapshot.val().fuga})`);
});
// 🍎 iOS Swift
// ☁️ Admin node
admin.database().ref().child("test").child("Admin")
.orderByChild("fuga") // ソートキー
.equalTo(4) // 切り取る範囲
.on("child_added", snapshot => {
console.log(`(${snapshot.val().hoge}, ${snapshot.val().fuga})`);
});
// 🍎 iOS Swift
Database.database().reference().child("test").child("iOS")
// ☁️ Admin node
admin.database().ref().child("test").child("Admin")
.orderByChild("fuga") // ソートキー
.endAt(2) // 切り取る範囲
.on("child_added", snapshot => {
console.log(`(${snapshot.val().hoge}, ${snapshot.val().fuga})`);
});
// 🍎 iOS Swift
Database.database().reference().child("test").child("iOS")
// ☁️ Admin node
admin.database().ref().child("test").child("Admin")
.orderByChild("fuga") // ソートキー
.startAt(4) // 切り取る範囲
.on("child_added", snapshot => {
console.log(`(${snapshot.val().hoge}, ${snapshot.val().fuga})`);
});
// 🍎 iOS Swift