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
| type FormElement = HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement; | |
| export const setFormValuesFromQuery = <T extends Record<string, any>>( | |
| form: HTMLFormElement, | |
| searchParams?: URLSearchParams | |
| ): Partial<T> => { | |
| if (searchParams === undefined) { | |
| searchParams = new URLSearchParams(window.location.search); | |
| } |
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 StringToColorConverter { | |
| static L = [ | |
| 0.35, | |
| 0.5, | |
| 0.65 | |
| ]; | |
| static S = [ | |
| 0.35, | |
| 0.5, | |
| 0.65 |
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.graphics.Rect | |
| import android.view.View | |
| import androidx.annotation.Px | |
| import androidx.recyclerview.widget.GridLayoutManager | |
| import androidx.recyclerview.widget.RecyclerView | |
| class MarginItemDecoration( | |
| @Px private val marginInPixels: Int | |
| ) : RecyclerView.ItemDecoration() { | |
| override fun getItemOffsets(outRect: Rect, view: View, parent: RecyclerView, state: RecyclerView.State) { |
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
| /* Tested on Ionic 8. */ | |
| /* The `px` suffix might be required to avoid breaking inside the calculation of Ionic. */ | |
| ion-list ion-item:last-child { | |
| --border-width: 0px !important; | |
| --inner-border-width: 0px !important | |
| } |
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 androidx.fragment.app.FragmentManager | |
| import com.google.android.material.datepicker.MaterialDatePicker | |
| import com.google.android.material.timepicker.MaterialTimePicker | |
| import java.util.Calendar | |
| class DateTimePicker( | |
| private val datePicker: MaterialDatePicker<Long>, | |
| private val timePicker: MaterialTimePicker | |
| ) { | |
| private var onDateTimeSelectedListener: ((dateTime: DateTime) -> Unit)? = null |
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
| inline fun <reified IT, reified OT> Array<IT>.mapTypedArray(transform: (IT) -> OT): Array<OT> { | |
| return map(transform).toTypedArray() | |
| } |
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 FullScreenDialogFragment : DialogFragment() { | |
| override fun onCreate(savedInstanceState: Bundle?) { | |
| super.onCreate(savedInstanceState) | |
| setStyle(STYLE_NO_TITLE, R.style.Theme_App_FullScreenDialog) | |
| } | |
| } |
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
| (() => { | |
| "use strict"; | |
| let files = null; | |
| window.addEventListener("paste", (event) => { | |
| files = event.clipboardData.files; | |
| document.querySelector('[aria-label="Search by image"]').click(); |
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.annotation.SuppressLint; | |
| import android.content.ContentUris; | |
| import android.content.Context; | |
| import android.database.Cursor; | |
| import android.net.Uri; | |
| import android.os.Build; | |
| import android.os.Environment; | |
| import android.provider.DocumentsContract; | |
| import android.provider.MediaStore; |
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
| fun <T> MutableList<T>.addOrRemove(item: T) { | |
| if (this.contains(item)) { | |
| this.remove(item) | |
| } else { | |
| this.add(item) | |
| } | |
| } | |
| fun <T> MutableList<T>.findIndex(predicate: (T) -> Boolean): Int { | |
| val item = this.find(predicate) |
NewerOlder