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
let cities = ['Alexandria', 'San Francisco', 'Los Angeles', 'New York', 'Toronto']; | |
function twoWordedWithForLoop(sentences) { | |
let twoWordedSentences = [] | |
for(let index = 0; index < sentences.length; index++) { | |
let currentSentence = sentences[index]; // String | |
let splittedSentence = currentSentence.split(" "); // Array | |
let numberOfWords = splittedSentence.length // Number | |
if (numberOfWords === 2) { |
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 { OTUser, OTUserProvider, OTUserDetails } from './ot-user/ot-user' | |
import { OTFooter } from './ot-footer/ot-footer' | |
import { OTTopNav, OTTopNavSection, OTTopNavSubSection } from './ot-top-nav/ot-top-nav' | |
customElements.define('ot-user', OTUser) | |
customElements.define('ot-user-provider', OTUserProvider) | |
customElements.define('ot-user-details', OTUserDetails) | |
customElements.define('ot-footer', OTFooter) |
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 { Entity, PrimaryGeneratedColumn, OneToMany, Column, CreateDateColumn, UpdateDateColumn } from "typeorm"; | |
import { Order } from "./Order"; | |
@Entity() | |
export class Client { | |
@PrimaryGeneratedColumn() id: number; | |
@Column('character varying') name: string; | |
@Column('character varying') location: string; | |
@OneToMany(type => Order, order => order.client) |
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"> | |
<title>WASM with Kotlin</title> | |
</head> | |
<body> | |
<h1>Welcome to WASM with Kotlin</h1> |
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(args: Array<String>) { | |
println("Hello Kotlin/Native!") | |
} |
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
class TodoListDetailAdapter( | |
val context: Context, | |
inline val onTodoItemAction: (todoItem: TodoItem, actionType: Int) -> Unit) { | |
fun createTodoItem(todoItem: TodoItem) { | |
onTodoItemAction(todoItem, TodoItem.CREATE) | |
} | |
fun updateTodoItem(todoItem: TodoItem) { | |
onTodoItemAction(todoItem, TodoItem.UPDATE) | |
} | |
fun deleteTodoItem(todoItem: TodoItem) { |
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
TodoListDetailAdapter(context) { todoItem, actionType -> | |
when (actionType) { | |
TodoItem.CREATE -> todoListDetailViewModel.createTodoItem(todoItem) | |
TodoItem.UPDATE -> todoListDetailViewModel.updateTodoItem(todoItem) | |
TodoItem.DELETE -> todoListDetailViewModel.deleteTodoItem(todoItem) | |
} | |
} |
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 onTodoItemAction(todoItem: TodoItem, actionType: Int) { | |
when (actionType) { | |
TodoItem.CREATE -> todoListDetailViewModel.createTodoItem(todoItem) | |
TodoItem.UPDATE -> todoListDetailViewModel.updateTodoItem(todoItem) | |
TodoItem.DELETE -> todoListDetailViewModel.deleteTodoItem(todoItem) | |
} | |
} | |
TodoListDetailAdapter(context, onTodoItemAction) |
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
val onTodoItemAction = { todoItem: TodoItem, actionType: Int -> | |
when (actionType) { | |
TodoItem.CREATE -> todoListDetailViewModel.createTodoItem(todoItem) | |
TodoItem.UPDATE -> todoListDetailViewModel.updateTodoItem(todoItem) | |
TodoItem.DELETE -> todoListDetailViewModel.deleteTodoItem(todoItem) | |
} | |
} | |
TodoListDetailAdapter(context, onTodoItemAction) |
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
inline fun createTodoList(name: String, crossinline afterCreate: (todoList: TodoList) -> Unit) { | |
Thread(Runnable { | |
val todoList = TodoList(name) | |
db.todoListDao().insertTodoList(todoList) | |
Handler(Looper.getMainLooper()).post { afterCreate(todoList) } | |
}).start() | |
} |
OlderNewer