- Read records from database.
- For each record issue HTTP GET for a webservice and recieve a response.
- Store resonses to corresponding document back.
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
struct DependencyInjector { | |
private static var dependencyList: [String:Any] = [:] | |
static func resolve<T>() -> T { | |
guard let t = dependencyList[String(describing: T.self)] as? T else { | |
fatalError("No povider registered for type \(T.self)") | |
} | |
return t | |
} | |
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 hello.world | |
import android.bluetooth.BluetoothDevice | |
import android.content.Context | |
import android.content.Intent | |
import android.content.IntentFilter | |
import android.content.BroadcastReceiver | |
import com.polidea.rxandroidble2.RxBleDevice | |
import io.reactivex.Completable | |
import io.reactivex.disposables.Disposables |
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
/** | |
* An [Observer] for [Event]s, simplifying the pattern of checking if the [Event]'s content has | |
* already been handled. | |
* | |
* [onEventUnhandledContent] is *only* called if the [Event]'s contents has not been handled. | |
*/ | |
class EventObserver<T>(private val onEventUnhandledContent: (T) -> Unit) : Observer<Event<T>> { | |
override fun onChanged(event: Event<T>?) { | |
event?.getContentIfNotHandled()?.let { value -> | |
onEventUnhandledContent(value) |
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
service cloud.firestore { | |
match /databases/{database}/documents { | |
// START - Usage example | |
match /people/{document=**} { | |
function propertiesValid() { | |
return request.resource.data.keys().hasAll(['name', 'birthdate', 'yearsOfExperience']) | |
&& request.resource.data.size() == 3 | |
&& isString('name') && minlength('name', 3) && maxlength('name', 255) |
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
#!/bin/bash | |
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | |
EXPORT_FILE=$DIR'/memo-save.txt' | |
READ_ONLY=1 | |
for param in "$@" | |
do | |
if [ $param = "edit" ] | |
then | |
READ_ONLY=0 |
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
public class FirebaseUserIdTokenInterceptor implements Interceptor { | |
// Custom header for passing ID token in request. | |
private static final String X_FIREBASE_ID_TOKEN = "YOUR-CUSTOM-HEADER"; | |
@Override | |
public Response intercept(Chain chain) throws IOException { | |
Request request = chain.request(); | |
try { |
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
// When the EditText is touched, disable touches on it's ScrollView's parents. | |
// Once the user lifts up their finger, enable touches on on the ScrollView's parents once again. | |
@OnTouch(R.id.edit_text) | |
boolean handleNoteFieldTouch(View v, MotionEvent event) { | |
v.getParent().getParent().requestDisallowInterceptTouchEvent(true); | |
switch (event.getAction() & MotionEvent.ACTION_MASK){ | |
case MotionEvent.ACTION_UP: | |
v.getParent().getParent().requestDisallowInterceptTouchEvent(false); | |
break; |
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
let hasBlobConstructor = typeof(Blob) !== 'undefined' && (function () { | |
try { | |
return Boolean(new Blob()); | |
} catch (e) { | |
return false; | |
} | |
}()); | |
let hasArrayBufferViewSupport = hasBlobConstructor && typeof(Uint8Array) !== 'undefined' && (function () { | |
try { |
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
<?php | |
/** | |
* Class TorDetector | |
* | |
* Helps to detect if visitors are using a Tor browser to surf the website. | |
* | |
* Thanks to https://trac.torproject.org/projects/tor/wiki/doc/TorDNSExitList | |
*/ | |
class TorDetector |
NewerOlder