Skip to content

Instantly share code, notes, and snippets.

View avsharapov's full-sized avatar
🏠
Working from home

Arkadiy avsharapov

🏠
Working from home
View GitHub Profile
@avsharapov
avsharapov / Main.kt
Created November 30, 2018 12:31
Задача: Посчитать количество календарных дней, которые потратил разработчик для выполнения задач на определенную дату. Каждая задача имеет дату начала и дату окончания. При этом каждый день, который входит в несколько разных задач считается только один раз.
import java.time.LocalDate
import java.time.temporal.ChronoUnit.DAYS
fun main(args: Array<String>) {
val tasks: MutableList<Task> = mutableListOf(
Task(LocalDate.of(2018, 11, 30), LocalDate.of(2018, 12, 10)),
Task(LocalDate.of(2018, 12, 3), LocalDate.of(2018, 12, 4)),
Task(LocalDate.of(2018, 12, 4), LocalDate.of(2018, 12, 7)),
Task(LocalDate.of(2018, 12, 4), LocalDate.of(2018, 12, 10))
)
@avsharapov
avsharapov / gist:5fd1fd594f961a2205aff07db81e0d23
Created January 30, 2018 19:01 — forked from dodyg/gist:5823756
Kotlin Programming Language Cheat Sheet Part 3

#Control Structures

##If statement

Kotlin if statement should look familiar with other language

fun main(args : Array<String>) {
 val total = 10
@avsharapov
avsharapov / gist:e8bd62acde27d423660e6d725a06709f
Created January 30, 2018 19:01 — forked from dodyg/gist:5616605
Kotlin Programming Language Cheat Sheet Part 2

This is a quick guide to Kotlin programming language. The previous part of this guide is here

#Object Oriented

fun main(args : Array<String>) {
  class local (val x : Int)
  
  val y = local(10)
 println("${y.x}")
@avsharapov
avsharapov / gist:6d543974090f4f5ed18e8b43f0d8cb20
Created January 30, 2018 19:00 — forked from dodyg/gist:5823184
Kotlin Programming Language Cheat Sheet Part 1

#Intro

Kotlin is a new programming language for the JVM. It produces Java bytecode, supports Android and generates JavaScript. The latest version of the language is Kotlin M5.3

Kotlin project website is at kotlin.jetbrains.org.

All the codes here can be copied and run on Kotlin online editor.

Let's get started.