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 android.annotation.SuppressLint | |
import android.app.Application | |
import android.content.ComponentCallbacks | |
import android.content.Context | |
import android.content.ContextWrapper | |
import android.content.res.Configuration | |
import android.content.res.Resources | |
import android.os.Build | |
import android.os.LocaleList | |
import androidx.core.os.ConfigurationCompat |
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
# From the Kotlin standard library | |
class XorWowRandom { | |
hidden [int] $x | |
hidden [int] $y | |
hidden [int] $z | |
hidden [int] $w | |
hidden [int] $v | |
hidden [int] $addend | |
hidden XorWowRandom() { } |
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
function Get-PrimeNumber([ulong] $position) { | |
return [System.UInt128] ("prime($position)" | gp.exe -q) | |
} | |
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 android.content.Context | |
import android.content.res.Resources | |
import android.graphics.Color | |
import android.util.AttributeSet | |
import android.view.ViewGroup | |
import androidx.annotation.ColorInt | |
import androidx.annotation.ColorRes | |
import androidx.annotation.DimenRes | |
import androidx.annotation.Dimension | |
import androidx.annotation.Px |
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
sealed interface NetworkRequestError { | |
data class HttpError( | |
val code: Int, | |
val message: String?, | |
) : NetworkRequestError | |
data object IoError : NetworkRequestError | |
data object UnknownError : NetworkRequestError | |
} |
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 android.widget.TextView | |
import androidx.core.widget.doAfterTextChanged | |
// Source: https://stackoverflow.com/questions/9385081/how-can-i-change-the-edittext-text-without-triggering-the-text-watcher | |
/** | |
* Whenever the user makes a change to the text | |
* the action parameter will be triggered. | |
* | |
* This function is meant to be used with [setTextIfDistinct] |
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 android.app.Activity | |
import android.view.LayoutInflater | |
import android.view.View | |
import android.view.ViewGroup | |
import androidx.fragment.app.DialogFragment | |
import androidx.fragment.app.Fragment | |
import androidx.lifecycle.DefaultLifecycleObserver | |
import androidx.lifecycle.Lifecycle | |
import androidx.lifecycle.LifecycleOwner | |
import androidx.lifecycle.Observer |
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
android { | |
namespace = "" | |
compileSdk = 34 | |
defaultConfig { | |
applicationId = "" | |
minSdk = 21 | |
targetSdk = 34 | |
versionCode = 1 | |
versionName = "1.0" |
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
function Convert-ImageToAscii( | |
[Parameter(ParameterSetName = "A")] | |
[string] $Path, | |
[Parameter(ParameterSetName = "B")] | |
[System.Drawing.Bitmap] $Image, | |
[switch] $UseAlpha | |
) { | |
$bitMap = if ($Path) { | |
[System.Drawing.Bitmap]::FromFile((Resolve-Path $Path)) | |
} |
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 getAllDivisiblePairsInRangeCount( | |
start: Int, | |
end: Int, | |
ignoreSelfDivision: Boolean = false, | |
): Int { | |
require(start != 0) { | |
"start parameter can't be $start" | |
} | |
require(start <= end) { | |
"start '$start' must be less or equal to end '$end'" |
NewerOlder