Skip to content

Instantly share code, notes, and snippets.

View EudyContreras's full-sized avatar
:octocat:
Enjoying a code session

Eudy Contreras EudyContreras

:octocat:
Enjoying a code session
  • Handelsbanken
  • Sweden
View GitHub Profile
@EudyContreras
EudyContreras / SceneCaptureUtility.txt
Last active December 24, 2020 18:48
JavaFX Scene Capture Utility
/*
* JavaFX SceneCaptureUtility 2016/07/02
*
* The author of this software "Eudy Contreras" grants you ("Licensee")
* a non-exclusive, royalty free, license to use,modify and redistribute this
* software in source and binary code form.
*
* Please be aware that this software is simply part of a personal test
* and may in fact be unstable. The software in its current state is not
@EudyContreras
EudyContreras / SplashScreen.txt
Last active April 11, 2017 10:13
JavaFX Game Splash Screen
/*
* JavaFX Splash Screen utility
*
* The author of this software "Eudy Contreras" grants you ("Licensee")
* a non-exclusive, royalty free, license to use,modify and redistribute this
* software in source and binary code form.
*
* Please be aware that this software is simply part of a personal test
* and may in fact be unstable. The software in its current state is not
* considered a finished product and has plenty of room for improvement and
@EudyContreras
EudyContreras / SaveAndLoadUtility .txt
Last active April 8, 2020 22:50
JavaFX Game Saving and Loading Utility
/*
* JavaFX Game Save and Load utility
*
* The author of this software "Eudy Contreras" grants you ("Licensee")
* a non-exclusive, royalty free, license to use,modify and redistribute this
* software in source and binary code form.
*
* Please be aware that this software is simply part of a personal test
* and may in fact be unstable. The software in its current state is not
@EudyContreras
EudyContreras / StringEncrypter.java
Last active August 19, 2016 09:05
Program which can be used for encrypting strings. The program uses a multi-step encryption system for encrypting Strings.
import java.nio.charset.StandardCharsets;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import java.util.Arrays;
import java.util.BitSet;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedList;
@EudyContreras
EudyContreras / Choreography.kt
Last active September 1, 2019 20:56
Choreographer example 1
val choreographer = Choreographer(this)
choreographer
.allowChildInheritance(false)
.withDefaultPivot(0.5f, 0f)
.withDefaultInterpolator(interpolator)
.withDefaultDuration(800)
.animate(card){
xRotateAdd(30f)
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:bones="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<data>
<variable name="viewModel" type="com.eudycontreras.bones.SomeViewModel" />
<import type="com.eudycontreras.boneslibrary.properties.ShapeType" />
dependencies {
implementation 'com.github.EudyContreras:Skeleton-Bones:v1.0'
}
sealed class DemoData: DiffComparable {
abstract val id: String
override fun getIdentifier() = id
data class A(
override val id: String,
val text: String,
val imageUrl: String
) : DemoData()
sealed class Resource<out T>(
open val data: T?,
open val loading: Boolean
) {
class Success<T>(
data: T
) : Resource<T>(
data = data,
loading = false
)
private val demoData: MutableLiveData<Resource<List<DemoData?>?>> = MutableLiveData(Resource.Loading())
// Start request and emit a loading state
demoData.postValue(Resource.Loading()
// Request was successfull. Emit the data
demoData.postValue(Resource.Success(data))