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
tailrec fun removeZeroes(x: Int): Int = | |
if (x % 10 == 0) removeZeroes(x / 10) else x | |
fun f(x: Int) = removeZeroes(x + 1) |
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
// Complete the matchingStrings function below. | |
fun matchingStrings(strings: Array<String>, queries: Array<String>): Array<Int> { | |
val result = Array<Int>(queries.size) { 0 } | |
queries.forEachIndexed { index, item -> | |
result[index] = strings.count { item == it } | |
} | |
return result | |
} |
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
@Serializable | |
data class FoodEntry( | |
val id: String = UUID.randomUUID().toString(), | |
val name: String, | |
val time: Long = System.currentTimeMillis(), | |
val description: String, | |
val energyCount: Long = 0, | |
val updated: Long = System.currentTimeMillis() | |
) |
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.example.demo | |
// import | |
val dataRepo = DataRepository() | |
fun Application.main() { | |
// ... | |
post("entries") { | |
val entries = fromJsonStringToList(call.receiveText()) |
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.example.demo.data | |
import com.google.appengine.api.datastore.* | |
class DataRepository { | |
private val dataStore = DatastoreServiceFactory.getDatastoreService() | |
private val foodIntakeEntry = dataStore.prepare(Query(FOOD_INTAKE_ENTRY)) | |
// READ | |
fun listAll(): List<FoodEntry> = |
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.example.demo.data | |
import kotlinx.serialization.Serializable | |
import kotlinx.serialization.json.Json | |
import kotlinx.serialization.list | |
import kotlinx.serialization.parse | |
@Serializable | |
data class FoodEntry( | |
val id: Long, |
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.example.demo | |
/* ktlint-disable no-wildcard-imports */ | |
import io.ktor.application.Application | |
import io.ktor.application.call | |
import io.ktor.application.install | |
import io.ktor.features.CallLogging | |
import io.ktor.features.DefaultHeaders | |
import io.ktor.response.respond | |
import io.ktor.routing.get |
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
/* | |
* Copyright (C) 2018 The Android Open Source Project | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
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
concurrent = 1 | |
check_interval = 0 | |
[session_server] | |
session_timeout = 1800 | |
[[runners]] | |
name = "My runner description" | |
url = "https://mygitlab.domain/" | |
token = "my-gitlab-runner-token" |
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
# If you come from bash you might have to change your $PATH. | |
export ADB=/Users/inspectorio01/Library/Android/sdk/platform-tools | |
export PATH=$HOME/bin:/usr/local/bin:$PATH:$ADB | |
# Path to your oh-my-zsh installation. | |
export ZSH="/Users/inspectorio01/.oh-my-zsh" | |
# Set name of the theme to load. Optionally, if you set this to "random" | |
# it'll load a random theme each time that oh-my-zsh is loaded. | |
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes |