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
object PartRequest { | |
@JvmStatic | |
fun buildFileBody(file: File): RequestBody { | |
return RequestBody.create(MediaType.parse("image/jpg"), file) | |
} | |
@JvmStatic | |
fun buildTextBody(value: String): RequestBody { | |
return RequestBody.create(MediaType.parse("text/plain"), value) |
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
#/bin/bash | |
GREEN='\033[1;32m' | |
WHITE='\033[1;38m' | |
NC='\033[0m' | |
# Getting common docker information | |
# - Container(s) information | |
# - Default Network (bridge) information | |
# - Available Images(s) information |
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
<?php | |
/** | |
* Host this code on a server and point your github webhooks to this file. | |
* it's a single directional API for Github to Airtable. It excludes the Airtable to Github. | |
* | |
* What to prepare? | |
* 1. Make an airtable Base, | |
* 2. Make a special table on airtable for Github Kanban (ex. Report), | |
* 3. Enable 'project' on Github to get the Kanban view, |
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 CombinedTransformation<T>( | |
vararg liveData: LiveData<*>, | |
private val onAllChanged: (data: List<Any?>) -> T | |
) : MediatorLiveData<T>() { | |
private val mLiveDataList: MutableList<Any?> = MutableList(liveData.size) { null } | |
init { | |
liveData.forEachIndexed { index, liveDatum -> | |
super.addSource(liveDatum) { datum -> |
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
abstract class AppPagedRecyclerViewAdapter<BIND : ViewDataBinding, M : Any>( | |
diffUtil: DiffUtil.ItemCallback<M> | |
) : PagedListAdapter<M, AppPagedRecyclerViewAdapter.ViewHolder<BIND>>(diffUtil) { | |
abstract fun onCreateViewBindingHolder(inflater: LayoutInflater, parent: ViewGroup): BIND | |
abstract fun onPrepareBindViewHolder(binding: BIND, model: M) | |
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder<BIND> { | |
val inflater = LayoutInflater.from(parent.context) |
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 APIManager { | |
// client with persistent Cookie | |
public static OkHttpClient getRetrofitClient(final Context context) { | |
OkHttpClient client = new OkHttpClient(); | |
CookieManager cookieManager = new CookieManager(new PersistentCookieStore(context), CookiePolicy.ACCEPT_ALL); | |
cookieManager.setCookiePolicy(CookiePolicy.ACCEPT_ALL); | |
client.setCookieHandler(cookieManager); | |
return client; | |
} |
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 Validator { | |
companion object { | |
val EMAIL_REGEX = | |
Regex("(?:[a-z0-9!#\$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#\$%&'*+/=?^_`{|}~-]+)*|\"(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21\\x23-\\x5b\\x5d-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])*\")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21-\\x5a\\x53-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])+)\\])") | |
val NUMBER_REGEX = Regex("^[0-9]+$") | |
} | |
enum class Field { |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>Covid19 Cases in Countries</title> | |
</head> | |
<body style="padding: 0; margin: 0;"> | |
<!-- Peta --> |
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
import android.widget.DatePicker | |
import android.widget.Spinner | |
import androidx.databinding.BindingAdapter | |
import androidx.databinding.InverseBindingAdapter | |
import androidx.databinding.InverseBindingListener | |
import java.util.* | |
@BindingAdapter(value = ["selectedDate", "selectedDateAttrChanged"], requireAll = false) | |
fun DatePicker.selectedDate( | |
newSelectedDate: Date?, |