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
<# | |
NOTES: | |
----- Something that we could do to make this more powerful would be to first transpile to a low level PowerShell code and then transpile to GlovePIE. | |
- Numeric types in GlovePIE are int32 and float, so we should use them instead of | |
other alternatives. | |
- When we wait inside an if, let's say it's the first line, it will not execute until | |
the rest of the code is executed or there is a wait. | |
- If an if has not finished due to a pending wait then the if will be ignored in that execution | |
- There's an 'int' function that seems to truncate float numbers (this does not convert strings to int). | |
- There's a 'float' that converts an int to float and convert strings to floats. |
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 yourpackage | |
import android.annotation.SuppressLint | |
import android.app.Activity | |
import android.app.Application | |
import android.content.Context | |
import android.content.SharedPreferences | |
import android.content.pm.PackageManager | |
import android.content.res.Configuration | |
import android.content.res.Resources |
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 yourpackage | |
import android.content.Context | |
import android.os.Build | |
import android.util.AttributeSet | |
import android.view.View | |
import androidx.cardview.widget.CardView | |
import yourpackage.R | |
/** |
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.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 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
using System; | |
// From the Kotlin standard library | |
public class XorWowRandom | |
{ | |
private int x, y, z, w, v, addend; | |
private XorWowRandom() { } | |
public static XorWowRandom FromSeed(int seed) |
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
function Get-PrimeNumber([ulong] $position) { | |
return [System.UInt128] ("prime($position)" | gp.exe -q) | |
} | |
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.content.Context | |
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 | |
import androidx.core.content.ContextCompat |
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 kotlinx.coroutines.* | |
import kotlinx.coroutines.flow.* | |
import kotlinx.coroutines.sync.* | |
interface AsyncResource<out T> { | |
sealed interface State<out T> { | |
data object NotStarted : State<Nothing> | |
data class Loading<out T>(val currentResource: Completed<T>?) : State<T> | |
sealed interface Completed<out T> : State<T> { |
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.view.View | |
import android.widget.ScrollView | |
fun ScrollView.smoothScrollToViewBottom(view: View) { | |
val scrollViewHeight = height | |
val outViewPosition = IntArray(2) | |
view.getLocationOnScreen(outViewPosition) | |
val viewY = outViewPosition[1] |
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.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 |
NewerOlder