Skip to content

Instantly share code, notes, and snippets.

View mcassiano's full-sized avatar

Matheus Candido mcassiano

View GitHub Profile
import time
import RPi.GPIO as GPIO
from threading import Thread
from threading import Lock
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
class HumidifierController:
fan_button = 24
data class ValidationResult<E>(
val isValid: Boolean,
val errors: E
)
interface FieldValidator<I, O> {
fun validate(input: I): O
}
interface FormValidator<T, E> {
[
{
"codigo":"498258755509976",
"dataCadastro":"23/11/2018"
},
{
"codigo":"455702866102495",
"dataCadastro":"23/11/2018"
},
{
private const val DEFAULT_NUMBER_OF_CIRCLES = 10
class ProfitabilityIndexView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : View(context, attrs, defStyleAttr) {
private val rect = RectF()
package br.com.concrete.stepper
import android.content.Context
import android.graphics.Canvas
import android.graphics.Paint
import android.graphics.drawable.Drawable
import android.support.annotation.AttrRes
import android.support.annotation.ColorInt
import android.support.annotation.Dimension
import android.support.v7.content.res.AppCompatResources
{
"type": "elementGroup",
"properties": [
{
"name": "orientation",
"type": "string",
"value": "vertical"
}
],
"children": [
@mcassiano
mcassiano / quality.gradle
Last active February 26, 2018 13:18
Jacoco aggregated test coverage report (multiple modules)
apply plugin: 'jacoco'
jacoco {
toolVersion = '0.8.0'
}
def exclude = [
// list of classes you want to exclude from test coverage
]
public class IdlingToaster extends Toaster {
private HashSet<Toast> toasts = new HashSet<>();
@Override
public Toast makeText(Context context, CharSequence text, int duration) {
Toast toast = Toast.makeText(context, text, LENGTH_SHORT);
toast.getView().addOnAttachStateChangeListener(new View.OnAttachStateChangeListener() {
@Override
package me.cassiano.estimate.chain;
import android.content.Context;
import android.content.Intent;
import android.support.annotation.NonNull;
public abstract class ActivityResultChain {
private ActivityResultChain next;
public class ExampleActivity extends AppCompatActivity implements OnMapReadyCallback {
private MapViewObserver mapView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_estimate);
MapView view = findViewById(R.id.map_view);
mapView = new MapViewObserver(getLifecycle(), view, this);