Skip to content

Instantly share code, notes, and snippets.

View sasssass's full-sized avatar

Ali Shobeyri sasssass

View GitHub Profile
@sasssass
sasssass / chop.kt
Created February 13, 2024 14:58
chop.kt
/**
* You can edit, run, and share this code.
* play.kotlinlang.org
*/
fun main() {
val length = readLine()?.toIntOrNull() ?: 0
val input = mutableListOf<Int>()
repeat(length) {
@sasssass
sasssass / TreeChoping.kt
Created February 12, 2024 09:01
TreeChoping.kt
/**
* You can edit, run, and share this code.
* play.kotlinlang.org
*/
fun main() {
val length = readLine()?.toIntOrNull() ?: 0
val input = mutableListOf<Int>()
repeat(length) {
@sasssass
sasssass / response.json
Created January 19, 2024 13:37
response.json
[
{
"title": "Pulp Fiction",
"imageUrl": "https://upload.wikimedia.org/wikipedia/en/3/3b/Pulp_Fiction_%281994%29_poster.jpg",
"actresses": ["Uma Thurman", "Mia Wallace", "John Travolta"]
},
{
"title": "The Matrix",
"imageUrl": "https://upload.wikimedia.org/wikipedia/en/c/c1/The_Matrix_Poster.jpg",
"actresses": ["Keanu Reeves", "Carrie-Anne Moss", "Laurence Fishburne"]
@sasssass
sasssass / response.json
Last active November 3, 2023 13:23
response.json
{
"response": [
{
"name" : "Solna",
"phoneNumber" : "084555300",
"address" : "Rättarvägen 3, 169 68 Solna"
},
{
"name" : "Kista",
"phoneNumber" : null,
@sasssass
sasssass / response.json
Created November 1, 2023 14:45
response.json
[
{
"username": "Ali,
"passwordHash": 46792755
},
{
"username": "Yauheni,
"passwordHash": 1450575459
},
{
@sasssass
sasssass / response.json
Last active November 8, 2023 13:30
response.json
{
"response": [
{
"id": 1,
"name": "Parking Spot 1",
"area": "SOLNA",
"description": "Description of Parking Spot 1",
"isActive": true,
"latitude": 55.8275,
"longitude": 14.5693
@sasssass
sasssass / abstractation.kt
Created October 23, 2023 13:29
abstractation.kt
abstract class Animal(val name: String) {
fun move() {
// Imp
}
abstract fun eat()
}
class Bird (name: String) : Animal(name) {
@sasssass
sasssass / encapsulation.kt
Created October 23, 2023 12:58
encapsulation.kt
class Something {
var number: Int = 0
get() {
println("someone is trying to read number")
return field
}
set(input: Int) {
println("someone is trying to change number")
if (input >= 0)
field = input
@sasssass
sasssass / polymorphism.kt
Last active October 23, 2023 13:13
polymorphism.kt
class Something {
fun doSth() {
println("no number")
}
fun doSth(input: Int) {
println(input)
}
}
@sasssass
sasssass / polymorphism.kt
Last active October 23, 2023 13:16
polymorphism.kt
open class Parent() {
open fun doSth() {
print("I'm Parent")
}
}
class Child() : Parent() {
override fun doSth() {
print("I'm Child")
}