This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.kikermo.util; | |
import android.text.Editable; | |
import android.text.TextWatcher; | |
public class TextWatcherWrapper implements TextWatcher { | |
private OnTextChanged onTextChanged; | |
private AfterTextChange afterTextChange; | |
private BeforeTextChanged beforeTextChanged; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
android { | |
... | |
defaultConfig { | |
... | |
buildConfigField "String", "API_URL", "http://default-url.com" | |
buildConfigField "String", "THIRD_PARTY_API_KEY", "rAnDomKeYF0rS3rV1ce" | |
} | |
productFlavors { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
android { | |
... | |
defaultConfig { | |
... | |
buildConfigField "String", "API_URL", "http://default-url.com" | |
buildConfigField "String", "THIRD_PARTY_API_KEY", "rAnDomKeYF0rS3rV1ce" | |
} | |
flavorDimensions "skin", "env" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
android { | |
... | |
def keys = new Properties() | |
file("../keys.properties").withInputStream { | |
stream -> keys.load(stream) | |
} | |
productFlavors { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
inline fun <reified FirebaseObject : FirebaseIdentifiableModel> FirebaseFirestore.getSimpleFirebaseList( | |
path: String | |
): Single<List<FirebaseObject>> = Single.create<List<FirebaseObject>> { emitter -> | |
val listenerRegistration: ListenerRegistration = collection(path).addSnapshotListener { querySnapshot, exception -> | |
querySnapshot?.run { | |
emitter.onSuccess(toFirebaseObjectList()) | |
} ?: exception?.run { | |
emitter.onError(this) | |
} ?: kotlin.run { emitter.onError(FirebaseUnexpectedException()) } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data class MyFirebaseModel(val aProperty: Int):FirebaseIdentifiableModel() | |
firebaseFirestore.getFirebaseList<MyFirebaseModel>(path = "mymodel") | |
.map{ ... } // Maybe map to a non firebase specific model | |
.subscribeOn(...) | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun FirebaseFirestore.getFirstDocument( | |
path: String, | |
page: FirebasePage | |
): Maybe<DocumentSnapshot> = Maybe.create { emitter -> | |
val collectionReference = collection(path) | |
.orderBy(page.orderBy, page.direction) | |
.limit(page.size * page.number + 1) | |
val listenerRegistration: ListenerRegistration = collectionReference.addSnapshotListener { querySnapshot, exception -> | |
querySnapshot?.run { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
inline fun <reified FirebaseObject : FirebaseIdentifiableModel> FirebaseFirestore.getPaginatedFirebaseList( | |
path: String, | |
page: FirebasePage | |
): Single<List<FirebaseObject>> { | |
val firstDocumentMaybe = getFirstDocument(path, page) | |
return firstDocumentMaybe.isEmpty.flatMap { | |
return@flatMap if (it) { | |
Single.just(emptyList()) | |
} else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <bluefruit.h> | |
#include <Adafruit_LittleFS.h> | |
#include <InternalFileSystem.h> | |
#include <Arduino.h> | |
uint32_t vbat_pin = PIN_VBAT; // A7 for feather nRF52832, A6 for nRF52840 | |
int moistureSensorPin = A0; | |
#define DEBUG_MODE true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env | |
var express = require('express'); | |
const http = require('http'); | |
var app = express(); | |
var exec = require('exec'); | |
const sensorMac = "<YOUR-DEVICE-MAC>"; | |
const batteryChar = "00002a19-0000-1000-8000-00805f9b34fb"; | |
const batteryHandler = "0x001b"; |
OlderNewer