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 academy.learnprogramming.buttonclickapp | |
import android.support.v7.app.AppCompatActivity | |
import android.os.Bundle | |
import android.text.method.ScrollingMovementMethod | |
import android.util.Log | |
import android.view.View | |
import android.widget.EditText | |
import android.widget.Button | |
import android.widget.TextView |
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
//citeste dintr-un fisier text in care ai ip-uri, din care unele se repeta si printeaza care e cel ce apare de cele mai multe ori | |
import java.io.File | |
//ce adresa ip apare cel mai des?? cu maps | |
fun main(args: Array<String>) { | |
//o variabila in care storez ip-urile si de cate ori apare fiecare adresa | |
//va mapa din <String in Int>, daca nu pui o valoare initiala, Kotlin nu poate deduce (infer) | |
val ipToCount = mutableMapOf<String, Int>() | |
File("src/playground/ips.txt").forEachLine{ |
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 ObjectOriented | |
//DRY = Don't Repeat Yourself | |
//to make the Stack class a generic, specify in <> the generic parameters | |
// <E> vine de la Element | |
//vararg de mai jos s.n. Constructor parameter | |
//vararg allows you to add as many arguments of the specified type | |
class Stack<E>(vararg val items:E) { | |
var elements = items.toMutableList() |
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
open class Enemy (val name: String, var hitPoints: Int, var lives:Int){ | |
open fun takeDamage(damage:Int) { | |
val remainingHitpoints = hitPoints - damage | |
if (remainingHitpoints > 0){ | |
hitPoints = remainingHitpoints | |
println("$name took $damage points of dmge and has $hitPoints left") | |
} else { | |
lives -= 1 | |
if (lives > 0) { | |
println("$name lost a life") |
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
open class Enemy (val name: String, var hitPoints: Int, var lives:Int){ | |
open fun takeDamage(damage:Int) { | |
val remainingHitpoints = hitPoints - damage | |
if (remainingHitpoints > 0){ | |
hitPoints = remainingHitpoints | |
println("$name took $damage points of dmge and has $hitPoints left") | |
} else { | |
lives -= 1 | |
if (lives > 0) { | |
println("$name lost a life") |
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 MagazinVirtual1 | |
abstract class Incaltaminte( | |
open var numeFirma: String, | |
open var numeModel: String, | |
open var marime: Int, | |
open var culoare: String, | |
open var material: String, | |
open var gen: String, | |
open var promotie: Boolean, |
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
//types of class: | |
//enum = a way of storing multiple choices | |
//the convention is to use ALL CAPS for the values of enum | |
//you can ONLY ASSIGN ONE of the values to the loop type field | |
//aka orice loot ridica pleieru tresa fie ORI potiune Ori... | |
enum class LootType { | |
POTION, RING, ARMOR | |
} | |
class Loot(val name: String, val type: LootType, val value: Double){ |
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
// Define UI Vars | |
const form = document.querySelector('#task-form'); | |
const taskList = document.querySelector('.collection'); | |
const clearBtn = document.querySelector('.clear-tasks'); | |
const filter = document.querySelector('#filter'); | |
const taskInput = document.querySelector('#task'); | |
// Load all event listeners | |
loadEventListeners(); |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/css/materialize.min.css"> | |
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous"> | |
<title>Task List</title> | |
</head> |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/css/materialize.min.css"> | |
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous"> | |
<title>Task List</title> | |
</head> |