This file contains hidden or 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
| # Stage 1: Build the Go binary using GOPATH layout | |
| FROM golang:1.23-alpine AS builder | |
| WORKDIR /app | |
| COPY go.mod go.sum ./ | |
| RUN go mod download | |
| COPY . . |
This file contains hidden or 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
| https://www.digitalocean.com/community/tutorials/how-to-install-nginx-on-ubuntu-20-04 | |
| https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-ubuntu-20-04 |
This file contains hidden or 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
| /** | |
| * Place the file at $HOME/.gradle/init.d/speak.gradle | |
| **/ | |
| gradle.ext.projectName = "" | |
| gradle.ext.taskMapping = [ | |
| 'assembleDevDebug': 'Running debug build', | |
| 'connectedCheck': 'Running UI Tests', | |
| 'connectedDevDebugAndroidTest': 'Running UI Tests - with dev flavour and debug mode', | |
| 'connectedProdDebugAndroidTest': 'Running UI Tests - with prod flavour and debug mode', |
This file contains hidden or 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
| var job: Job? = null | |
| fun makeApiCall() { | |
| if (job?.isActive == true) { | |
| job?.cancel() | |
| } | |
| job = viewModelScope.launch { | |
| // ... your API call | |
| } | |
| } |
This file contains hidden or 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
| plugins { | |
| id 'com.android.application' | |
| id 'org.jetbrains.kotlin.android' | |
| id 'kotlin-kapt' | |
| } | |
| dependencies { | |
| def room_version = "2.4.3" |
This file contains hidden or 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 MViewModelFactory(private val todoDao: TodoDao) : ViewModelProvider.Factory { | |
| override fun <T : ViewModel> create(modelClass: Class<T>): T { | |
| return when(modelClass) { | |
| MainViewModel::class.java -> { | |
| MainViewModel(todoDao) as T | |
| } | |
| CreateViewModel::class.java -> { | |
| CreateViewModel(todoDao) as T | |
| } | |
| else -> { |
This file contains hidden or 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 MainViewModel(private val todoDao: TodoDao) : ViewModel() { | |
| fun getTodos() = todoDao.getList().asLiveData() | |
| fun toggleTodoStatus(id: Int, updatedStatus: Boolean) { | |
| viewModelScope.launch { | |
| todoDao.toggleTodo(id, updatedStatus) | |
| } | |
| } |
This file contains hidden or 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 CreateViewModel(private val todoDao: TodoDao) : ViewModel() { | |
| fun create(task: String) { | |
| viewModelScope.launch { | |
| todoDao.insert(NewTodo(task)) | |
| } | |
| } | |
| } |
This file contains hidden or 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 com.mohammadfayaz.todo.ui.create | |
| import androidx.appcompat.app.AppCompatActivity | |
| import android.os.Bundle | |
| import android.widget.Button | |
| import android.widget.EditText | |
| import com.mohammadfayaz.todo.R | |
| import com.mohammadfayaz.todo.data.DbService | |
| import com.mohammadfayaz.todo.data.NewTodo | |
| import com.mohammadfayaz.todo.data.TodoDao |
NewerOlder