Skip to content

Instantly share code, notes, and snippets.

@asvid
asvid / Address.kt
Last active January 22, 2021 19:05
Kotlin DSL
data class Address(
val streetName: String,
val cityName: String,
val streetNumber: String,
val postalCode: String
)
fun address(block: AddressBuilder.() -> Unit) = AddressBuilder().apply(block).build()
@ShopDsl
apply plugin: 'org.jetbrains.dokka-android'
dokka {
moduleName = ""
outputDirectory = "$rootDir/docs"
outputFormat = "html"
includes = ['extra.md']
samples = ['src/sample']
buildTypes {
alpha {
initWith release
...
@asvid
asvid / defaultConfig.gradle
Created August 26, 2018 12:14
gist for blogpost
android {
...
defaultConfig {
applicationId "io.github.asvid.flavorhell"
minSdkVersion 16
targetSdkVersion 27
versionCode buildDateTime
versionName "4.0.12"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
Verifying my Blockstack ID is secured with the address 1EJWWgVvD9UVegmtvCfzZEuPxtqDRv9z3q https://explorer.blockstack.org/address/1EJWWgVvD9UVegmtvCfzZEuPxtqDRv9z3q
@asvid
asvid / saveOrUpdate.js
Created October 4, 2016 07:10
MongoDB save or update
var query = {ean: productJson.ean},
options = {upsert: true, new: true, setDefaultsOnInsert: true};
Product.findOneAndUpdate(query, productJson, options, function (error, item) {
if (!!error) {
res.status(400).json(error)
} else {
res.status(201).json({"msg": "document created"})
}
});