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 com.jivimberg.sqs.published | |
import kotlinx.coroutines.CancellationException | |
import kotlinx.coroutines.CoroutineScope | |
import kotlinx.coroutines.isActive | |
import kotlinx.coroutines.yield | |
import java.lang.Thread.currentThread | |
suspend fun CoroutineScope.repeatUntilCancelled(block: suspend () -> Unit) { | |
while (isActive) { |
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
class Person() { | |
private lateinit var _other: Person | |
private constructor(_other: Person) : this() { | |
this._other = _other | |
} | |
val other: Person | |
get() { | |
if (!::_other.isInitialized) { |
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
// kotlin.collections | |
inline fun <T> Array<out T>.takeWhileInclusive( | |
predicate: (T) -> Boolean | |
): List<T> { | |
var shouldContinue = true | |
return takeWhile { | |
val result = shouldContinue | |
shouldContinue = predicate(it) | |
result |
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
jacocoTestCoverageVerification { | |
violationRules { | |
rule { | |
excludes = [ | |
'com/example/my/package/*', | |
'com/example/service/MyApplication.kt', | |
'com/google/protobuf/*' | |
] | |
limit { | |
minimum = 0.79 |
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
jacocoTestCoverageVerification { | |
afterEvaluate { | |
classDirectories = files(classDirectories.files.collect { | |
fileTree(dir: it, exclude: [ | |
'com/example/my/package/*', | |
'com/example/service/MyApplication.kt', | |
'com/google/protobuf/*' | |
]) | |
}) | |
} |
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
apply plugin: "jacoco” | |
jacocoTestCoverageVerification { | |
violationRules { | |
rule { | |
limit { | |
minimum = 0.79 | |
} | |
} | |
} |
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 fetchMergeRequestsChannel(gitLabService: GitLabService, lastProductionSha: String): ReceiveChannel<MergeRequest> { | |
return produce { | |
var page = 1 | |
while (true) { | |
gitLabService.delayedFetchMergeRequests(page++).forEach { send(it) } | |
} | |
}.takeWhile { it.commitSha != lastProductionSha } | |
} | |
fun main(args: Array<String>) { |
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
function unreadCount() { | |
var unreadCount = GmailApp.getInboxUnreadCount(); | |
var masterEmail = "<[email protected]>"; | |
var subject = "Your unread count"; | |
var message = "You have " + unreadCount + " emails" | |
MailApp.sendEmail(masterEmail, subject, message); | |
} |
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
function sendFormEmail() { | |
var toEmailAddress = "[email protected]"; | |
var htmlMessage = HtmlService.createHtmlOutputFromFile("Name-of-your-HTML-file.html").getContent(); | |
var subject = "Subject"; | |
var message = "Some message"; | |
MailApp.sendEmail(toEmailAddress, subject, message, { | |
htmlBody: htmlMessage | |
}); | |
} |
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
export JAVA_HOME=/System/Library/Java/JavaVirtualMachines/1.5.0/Contents/Home | |
export PATH=$JAVA_HOME/bin:$PATH |
NewerOlder