{
"rest" : {
"query: {
"lang" : "",
"map" : "",
"name" : "",
"age" : 2
}
}
This file contains hidden or 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
private val randomImages : MutableLiveData<List<ObjectImage>> by lazy { | |
MutableLiveData<List<ObjectImage>>().also { | |
GlobalScope.launch { | |
CtrlImage.random(limit) | |
} | |
} | |
} |
This file contains hidden or 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 com.dawnimpulse.wallup.utils.reusables | |
import kotlin.properties.Delegates | |
class Live<T>(private val value1: T) { | |
private lateinit var change: (T) -> Unit | |
var value: T by Delegates.observable(value1) { _, _, new -> | |
if (::change.isInitialized) | |
change(new) |
This file contains hidden or 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
suspend fun setValue(ref: DatabaseReference, value: Any) = suspendCoroutine<Boolean> { continuation -> | |
ref.setValue(value) | |
.addOnSuccessListener { | |
continuation.resume(true) | |
} | |
.addOnFailureListener { | |
continuation.resumeWithException(it) | |
} | |
} |
This file contains hidden or 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
# This is an example Mocha config containing every Mocha option plus others | |
allow-uncaught: false | |
async-only: false | |
bail: false | |
check-leaks: false | |
color: true | |
delay: false | |
diff: true | |
exit: false # could be expressed as "no-exit: true" | |
extension: |
This file contains hidden or 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
describe("uuid()", async (assert) => { | |
assert({ | |
given: "nothing", | |
should: "generate a 32 chars alphanumeric string", | |
actual: validate( | |
generate.uuid(), | |
Joi.string() | |
.alphanum() | |
.length(32), | |
), |
This file contains hidden or 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
locationManager = getSystemService(Context.LOCATION_SERVICE) as LocationManager | |
if (locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) { | |
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 5000, 10f, LocationListenerCallback) | |
} else if (F.isConnected(this)) { | |
locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 5000, 10f, LocationListenerCallback) | |
} else |
This file contains hidden or 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
'use strict'; | |
const crypto = require('crypto'); | |
const ENCRYPTION_KEY = process.env.ENCRYPTION_KEY; // Must be 256 bits (32 characters) | |
const IV_LENGTH = 16; // For AES, this is always 16 | |
function encrypt(text) { | |
let iv = crypto.randomBytes(IV_LENGTH); | |
let cipher = crypto.createCipheriv('aes-256-cbc', Buffer.from(ENCRYPTION_KEY), iv); |
This file contains hidden or 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
<?xml version="1.0" encoding="utf-8"?> | |
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> | |
<item android:id="@android:id/background"> | |
<shape> | |
<corners android:radius="5dp"/> | |
<solid android:color="#fff"/> | |
</shape> | |
</item> |
This file contains hidden or 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
// get height based on screen width | |
fun getDynamicHeight(context: Context, width: Int, height: Int): Int { | |
val point = displayDimensions(context) | |
val h = ((point.x - dpToPx(16, context)) * height) / width | |
return if (h > (point.y - dpToPx(48, context))) | |
point.y - dpToPx(48, context) | |
else | |
h | |
} |
NewerOlder