This file contains 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
/** | |
* ViewModel for wrapping HTTP requests and keeping their results during configuration changes | |
*/ | |
public class RequestViewModel<T> extends AndroidViewModel { | |
private Disposable disposable; | |
private final MutableLiveData<Response<T>> response = new MutableLiveData<>(); | |
public RequestViewModel(@NonNull Application application) { |
This file contains 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.amaksoft.tools; | |
import android.arch.lifecycle.Lifecycle; | |
import android.arch.lifecycle.LifecycleObserver; | |
import android.arch.lifecycle.LifecycleOwner; | |
import android.arch.lifecycle.OnLifecycleEvent; | |
import io.reactivex.disposables.Disposable; | |
/** |
This file contains 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.amaksoft.recyclerviewtools.adapter; | |
import android.support.annotation.IdRes; | |
import android.support.annotation.LayoutRes; | |
import android.support.annotation.Nullable; | |
import android.support.v7.widget.GridLayoutManager; | |
import android.support.v7.widget.LinearLayoutManager; | |
import android.support.v7.widget.RecyclerView; | |
import android.view.LayoutInflater; | |
import android.view.View; |
This file contains 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.example.testrxkotlin | |
import android.support.v7.app.AppCompatActivity | |
import android.os.Bundle | |
import android.widget.TextView | |
import io.reactivex.Observable | |
import io.reactivex.android.schedulers.AndroidSchedulers | |
import io.reactivex.schedulers.Schedulers | |
import okhttp3.OkHttpClient | |
import okhttp3.Request |
This file contains 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
/* | |
* Copyright 2017, Andrey Makeev | |
* | |
* 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 |
This file contains 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
#!/bin/bash | |
# | |
# Inspired by: | |
# http://gorka.eguileor.com/vbox-vmware-in-secureboot-linux-2016-update/ | |
# http://elemc.name/?p=1020 | |
# | |
# Designed and tested on Fedora 24/25 | |
# | |
# This script is designed to automate Virtualbox and VMware module signing for SecureBoot | |
# Run it after each "vmware-modconfig --console --install-all", "/sbin/rcvboxdrv setup", "sudo /etc/init.d/vboxdrv setup" or kernel update |
This file contains 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
# shortform git commands | |
alias g='git' | |
# get most modified files and counts | |
git log --all -M -C --name-only --format='format:' "$@" | sort | grep -v '^$' | uniq -c | sort | awk 'BEGIN {print "count\tfile"} {print $1 "\t" $2}' | sort -g | |
# Locally checkout all remote branches of a repository | |
git branch -r | cut -d '/' -f2 | grep -Ev '( |master)' | xargs -Ibranch git checkout -b branch origin/branch | |
# Open current Git repository URL |
This file contains 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
#!/usr/bin/groovy | |
/* | |
* Copyright (c) 2016, Andrey Makeev <[email protected]> | |
* All rights reserved. | |
* | |
* Redistribution and use in source and binary forms, with or without | |
* modification, are permitted provided that the following conditions | |
* are met: | |
* 1. Redistributions of source code must retain the above copyright |
This file contains 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
// ... | |
configurations { | |
all*.exclude group: 'xml-apis', module: 'xmlParserAPIs' | |
} | |
// Equivalent to: | |
configurations { | |
all.collect { configuration -> | |
configuration.exclude group: 'xml-apis', module: 'xmlParserAPIs' | |
} |
This file contains 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
/** | |
* Created by amak on 8/19/16. | |
* | |
* An extremely simple plugin for exporting data from gradle script into properties file. | |
* It's very useful for CI systems: turn your gradle script variables into environment variables. | |
* | |
* Plugin adds an extension exportExt for variables you want to export: | |
* | |
* exportExt { | |
* prop "version", myProjectVersion |