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
docker-machine create \ | |
--driver=digitalocean \ | |
--digitalocean-access-token=$DO_TOKEN \ | |
--digitalocean-size=512mb \ | |
--digitalocean-region=nyc3 \ | |
--digitalocean-private-networking=true \ | |
--digitalocean-image=ubuntu-15-10-x64 \ | |
docker-swarm-kv-store | |
docker $(docker-machine config docker-swarm-kv-store) run -d \ |
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 com.github.pedramrn; | |
import android.content.Context; | |
import android.content.res.TypedArray; | |
import android.graphics.drawable.Drawable; | |
import android.support.v4.graphics.drawable.DrawableCompat; | |
import android.support.v7.widget.AppCompatTextView; | |
import android.util.AttributeSet; | |
import com.github.pedramrn.slick.parent.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
// TODO add <meta-data android:value="GlideModule" android:name="....OkHttpProgressGlideModule" /> | |
// TODO add <meta-data android:value="GlideModule" tools:node="remove" android:name="com.bumptech.glide.integration.okhttp.OkHttpGlideModule" /> | |
// or not use 'okhttp@aar' in Gradle depdendencies | |
public class OkHttpProgressGlideModule implements GlideModule { | |
@Override public void applyOptions(Context context, GlideBuilder builder) { } | |
@Override public void registerComponents(Context context, Glide glide) { | |
OkHttpClient client = new OkHttpClient(); | |
client.networkInterceptors().add(createInterceptor(new DispatchingProgressListener())); | |
glide.register(GlideUrl.class, InputStream.class, new OkHttpUrlLoader.Factory(client)); | |
} |
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 com.mrezanasirloo.retrofiterrorhandling; | |
import android.os.Bundle; | |
import android.support.annotation.NonNull; | |
import android.support.v7.app.AppCompatActivity; | |
import android.util.Log; | |
import android.widget.Toast; | |
import com.google.gson.annotations.Expose; | |
import com.google.gson.annotations.SerializedName; |
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.support.annotation.NonNull; | |
import org.junit.Test; | |
import java.util.Iterator; | |
import java.util.LinkedHashSet; | |
import java.util.Set; | |
import static org.junit.Assert.assertSame; |
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
def getCheckedOutGitCommitHash() { | |
def gitFolder = "$projectDir/.git/" | |
def takeFromHash = 12 | |
/* | |
* '.git/HEAD' contains either | |
* in case of detached head: the currently checked out commit hash | |
* otherwise: a reference to a file containing the current commit hash | |
*/ | |
def head = new File(gitFolder + "HEAD").text.split(":") // .git/HEAD | |
def isCommit = head.length == 1 // e5a7c79edabbf7dd39888442df081b1c9d8e88fd |
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 com.mrezanasirloo.ganjeh | |
import android.util.SparseArray | |
import androidx.activity.ComponentActivity | |
import androidx.annotation.MainThread | |
import androidx.fragment.app.Fragment | |
import androidx.fragment.app.createViewModelLazy | |
import androidx.lifecycle.LifecycleOwner | |
import androidx.lifecycle.ViewModel | |
import androidx.lifecycle.ViewModelLazy |
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 Either<L> { | |
class Success<L>(val value: L) : Either<L>() | |
class Error<L>(val title: String, val message: String) : Either<L>() | |
fun success(success: L.() -> Unit) { | |
if (this is Success<L>) success(value) | |
} | |
fun error(error: (Error<L>).() -> Unit) { | |
if (this is Error<L>) error(this) | |
} | |
} |
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 com.mrezanasirloo.adapter | |
import android.view.ViewGroup | |
import androidx.recyclerview.widget.RecyclerView | |
/** | |
* This adapter eliminates the need to write custom [RecyclerView.Adapter]s and | |
* [RecyclerView.ViewHolder]s by delegating the view holder creation and binding to the [Item] class | |
*/ | |
class GeneralAdapter( |
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
blueprint: | |
name: IKEA Tradfri Switch Control with Dimming | |
description: Control IKEA Tradfri Switch (Square with 1/0 buttons) using zigbee2mqtt with dimming functionality. | |
domain: automation | |
input: | |
tradfri_switch_entity: | |
name: IKEA Tradfri Switch | |
description: The entity ID of the Tradfri Switch in Home Assistant. | |
selector: | |
entity: |
OlderNewer