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
val integrationTest = java.sourceSets.create("integrationTest").apply { | |
compileClasspath += sourceSets.test.get().compileClasspath | |
runtimeClasspath += sourceSets.test.get().runtimeClasspath | |
java.srcDirs("src/integration-test/kotlin") | |
} | |
tasks.create("integrationTest", Test::class) { | |
group = "verification" | |
description = "Runs integration tests." | |
testClassesDirs = integrationTest.output.classesDirs |
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
interface MyContext { | |
fun boom() | |
} | |
// You can specify and bind the context explicitly... | |
context(MyContext) | |
fun contextualizedHigherOrderFunction1(f: MyContext.() -> Unit) { | |
// see https://github.com/Kotlin/KEEP/blob/master/proposals/context-receivers.md#referencing-specific-receiver | |
[email protected]() | |
} |
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 generates formatting functions for applying aggregating units (e.g. Kilo, Mega) | |
* to values. If you run out of units it gives up and shows the unit value. | |
* | |
* @param base The unit base, e.g. 1024 for bytes, 1000 for metric units of measure. | |
* @param units the names of the units starting with the base unit (e.g. byte, meter). | |
*/ | |
fun generateUnitFormatter(base: Int, units: List<String>): (Double, Int) -> String { | |
check(1 < base) | |
check(units.isNotEmpty()) |
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
Set WshShell = WScript.CreateObject("WScript.Shell") | |
While true | |
WScript.sleep 300000 | |
WshShell.SendKeys "{BREAK}" | |
Wend |
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
/* | |
MVar is a facility for data flow among components and APIs. | |
*/ | |
const assertFunction = (f, msg) => { | |
if (typeof f !== 'function') | |
throw new Error('Function required: ' + msg); | |
}; | |
/** | |
* Generically produces a new MVar chained after the given MVar. | |
* @param m The given MVar. |