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
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile | |
plugins { | |
application | |
kotlin("jvm") version "1.3.50" | |
id("com.github.johnrengelman.shadow") version "5.1.0" | |
} | |
group = "eu.wojciechzurek" |
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
import kotlin.math.roundToInt | |
import kotlin.test.assertEquals | |
const val PI = 3.14 | |
const val NAUTICAL_MILE_IN_METERS = 1852 | |
const val MEAN_EARTH_RADIUS = 6371100 | |
fun main(args: Array<String>): Unit { | |
assertEquals(NAUTICAL_MILE_IN_METERS, toMeters(1)) | |
assertEquals(10 * NAUTICAL_MILE_IN_METERS, toMeters(10)) |
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
import ExampleDelegates.accumulator | |
import ExampleDelegates.uppercase | |
import kotlin.properties.ReadWriteProperty | |
import kotlin.reflect.KProperty | |
fun main() { | |
val person = Person("ala1222", 12) | |
println(person.name)//ALA1222 | |
println(person.balance) //12 |
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 main() { | |
val car = Car("red", 200) | |
val derived = Derived(car) | |
println(derived.getColor())//red plus black | |
println(derived.getMaxSpeed())//200 | |
} | |
interface Vehicle { | |
fun getColor(): String | |
fun getMaxSpeed(): Int |
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 eu.wojciechzurek.example | |
import kotlinx.coroutines.flow.collect | |
import kotlinx.coroutines.reactive.awaitFirstOrNull | |
import kotlinx.coroutines.runBlocking | |
import org.springframework.beans.factory.InitializingBean | |
import org.springframework.boot.autoconfigure.SpringBootApplication | |
import org.springframework.boot.runApplication | |
import org.springframework.context.annotation.Bean | |
import org.springframework.data.annotation.Id |
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
//Arduino: | |
#include <Arduino.h> | |
#define LF 0x0A | |
char buffer[11]; | |
int idx = 0; | |
void setup() | |
{ | |
Serial.begin(9600); |
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
DEC: | |
30 40 50 60 70 80 90 100 110 120 | |
---------------------------------- | |
0: ( 2 < F P Z d n x | |
1: ) 3 = G Q [ e o y | |
2: * 4 > H R \ f p z | |
3: ! + 5 ? I S ] g q { | |
4: " , 6 @ J T ^ h r | | |
5: # - 7 A K U _ i s } | |
6: $ . 8 B L V ` j t ~ |
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
#include <Arduino.h> | |
int character = 0; | |
void setup() | |
{ | |
Serial.begin(9600); | |
Serial.print("Echo start\r\n"); | |
} |
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 main | |
import ( | |
"fmt" | |
) | |
const Color = "\033[38;5;%dm%-4d\033[39;49m" | |
func main() { | |
for row := 0; row < 16; row++ { |