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
// Gist attached to YouTube video, please do not delete. See my YT channel, link in bio. | |
using UnityEngine; | |
using UnityEngine.Splines; | |
using Unity.Mathematics; | |
// This is applied to a boxing target flying at the user in my example. | |
// The whole Spline functionality comes from Unity's Window->Package Manager, and is in the Unity | |
// Registry. |
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
let a = 0.1 + 0.2 | |
let b = 0.3 | |
a == b // false. WTF? |
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.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class CameraManager : MonoBehaviour | |
{ | |
// Start is called before the first frame update | |
void Start() | |
{ | |
Camera[] allCameras = FindObjectsOfType<Camera>(); |
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
@InstallIn(SingletonComponent::class) | |
@Module | |
object DatabaseModule { | |
@Singleton | |
@Provides | |
fun provideTeaDao(database: AppDatabase):TeaDao = database.teaDao() | |
@Provides | |
@Singleton | |
fun provideDatabase( |
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
enum class PAGE_TYPES {color, manufacturer} | |
const val noFilter = "no filter" | |
class ViewPagerAdapter(private val context: Context?, private val viewModel: SharedViewModel): RecyclerView.Adapter<ViewPagerAdapter.VPAViewHolder>() { | |
private val data = HashMap<String, List<String>>() | |
class VPAViewHolder(view: View?): RecyclerView.ViewHolder(view!!) { | |
val radioGroup:RadioGroup = view!!.findViewById<RadioGroup>(R.id.options) | |
val title: TextView = view!!.findViewById<TextView>(R.id.title) | |
} |
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
sealed class ViewState() { | |
class State1() : ViewState() | |
class State2(): ViewState() | |
class State3(): ViewState() | |
class State4(): ViewState() | |
class State5(): ViewState() | |
} |
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 DayView : ImageView { | |
private fun show() { | |
when(viewState) { | |
is ViewState.Skipped -> { | |
setImageResource(notMetVector) | |
} | |
is ViewState.Met -> { | |
setImageResource(metVector) | |
} | |
is ViewState.MetToday -> { |
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
sealed class ViewState() { | |
class Skipped() : ViewState() | |
class Met(): ViewState() | |
class MetToday(): ViewState() | |
class DidntMeetYetToday(): ViewState() | |
class Future(): ViewState() | |
} |
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
CoroutineScope(Dispatchers.Main).launch { | |
val html :String= flickrApi.fetchContents() | |
binding.myTextView.text = html | |
} |
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
CoroutineScope(Dispatchers.Main).launch{ | |
var html:String? = null | |
withContext(Dispatchers.IO){ | |
html= flickrApi.fetchContents() | |
} | |
binding.myTextView.text = html | |
} |
NewerOlder