Skip to content

Instantly share code, notes, and snippets.

View markus2610's full-sized avatar

Markus markus2610

View GitHub Profile
@markus2610
markus2610 / Example.java
Created August 29, 2018 17:19 — forked from RyanRamchandar/Example.java
Cancel a running or queued Call with OkHttp3
// ...
Request request = new Request.Builder()
.url(url)
.tag(TAG)
.build();
// Cancel previous call(s) if they are running or queued
OkHttpUtils.cancelCallWithTag(client, TAG);
// New call
@markus2610
markus2610 / MainActivity.java
Created September 27, 2017 17:07 — forked from TouchBoarder/MainActivity.java
Vector drawables from XML with the Android support library 23.3.0
package com.xwray.vectorbinding;
import android.databinding.BindingAdapter;
import android.databinding.DataBindingUtil;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.support.graphics.drawable.VectorDrawableCompat;
import android.support.v7.app.AppCompatActivity;
import android.widget.TextView;
@markus2610
markus2610 / Install Composer using MAMP's PHP.md
Created September 8, 2017 12:01 — forked from irazasyed/Install Composer using MAMP's PHP.md
Instructions on how to change preinstalled Mac OS X PHP to MAMP's PHP Installation and then install Composer Package Management

Change default Mac OS X PHP to MAMP's PHP Installation and Install Composer Package Management


Instructions to Change PHP Installation


First, Lets find out what version of PHP we're running (To find out if it's the default version).

To do that, Within the terminal, Fire this command:

which php

@markus2610
markus2610 / TimeLineIndicatorItemDecoration.java
Created August 11, 2017 17:25 — forked from SachinR90/TimeLineIndicatorItemDecoration.java
Exploring ItemDecoration for RecyclerView. Drawing Timelines
/*
* Copyright (C) 2014 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@markus2610
markus2610 / LifecycleObservableTransformer.java
Created August 10, 2017 05:01 — forked from magillus/LifecycleObservableTransformer.java
Observable transformer that will act on event of the Lifecycle to auto dispose its subscriptions when the event occurs. By default ON_DESTROY
package com.example.playground;
import android.arch.lifecycle.Lifecycle;
import android.arch.lifecycle.LifecycleObserver;
import android.arch.lifecycle.OnLifecycleEvent;
import android.support.annotation.NonNull;
import android.util.Log;
import java.lang.ref.WeakReference;
import java.util.Map;
@markus2610
markus2610 / PagingRecyclerView
Created March 23, 2017 13:39 — forked from mgarnerdev/PagingRecyclerView
Horizontal Snapping RecyclerView with Page Indication
import android.content.Context;
import android.graphics.PointF;
import android.support.v7.widget.LinearSmoothScroller;
import android.support.v7.widget.RecyclerView;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.util.TypedValue;
import android.view.MotionEvent;
/**
@markus2610
markus2610 / PagingRecyclerView
Created March 23, 2017 13:39 — forked from mgarnerdev/PagingRecyclerView
Horizontal Snapping RecyclerView with Page Indication
import android.content.Context;
import android.graphics.PointF;
import android.support.v7.widget.LinearSmoothScroller;
import android.support.v7.widget.RecyclerView;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.util.TypedValue;
import android.view.MotionEvent;
/**
@markus2610
markus2610 / rainbow.kt
Created March 6, 2017 07:31 — forked from stepango/rainbow.kt
kotlin apply example
val rainbowPaint = Paint(Paint.ANTI_ALIAS_FLAG).apply {
style = Paint.Style.STROKE
strokeCap = Paint.Cap.ROUND
}
@markus2610
markus2610 / RealmTypeAdapter.kt
Last active March 21, 2017 10:51
Kotlin Realm Primitive Arrays Workaround for Moshi
package de.wdv.apps.yoursingapore.core.moshi
import com.squareup.moshi.JsonAdapter
import com.squareup.moshi.JsonReader
import com.squareup.moshi.JsonWriter
import com.squareup.moshi.Moshi
import de.wdv.apps.yoursingapore.core.realm.RealmIntArray
import de.wdv.apps.yoursingapore.core.realm.RealmLongArray
import de.wdv.apps.yoursingapore.core.realm.RealmStringArray
import java.lang.reflect.Type
package de.wdv.apps.yoursingapore.core.moshi
import com.squareup.moshi.JsonAdapter
import com.squareup.moshi.JsonReader
import com.squareup.moshi.JsonWriter
import com.squareup.moshi.Types
import io.realm.RealmList
import io.realm.RealmModel