Skip to content

Instantly share code, notes, and snippets.

View amaksoft's full-sized avatar

Andrei Makeev amaksoft

View GitHub Profile
@amaksoft
amaksoft / export_plugin.gradle
Created August 22, 2016 09:13
An extremely simple plugin for exporting data from gradle script into properties file.
/**
* 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
@amaksoft
amaksoft / build.gradle
Created August 22, 2016 16:30 — forked from rponte/build.gradle
Excluding global dependency from all configurations (Gradle)
// ...
configurations {
all*.exclude group: 'xml-apis', module: 'xmlParserAPIs'
}
// Equivalent to:
configurations {
all.collect { configuration ->
configuration.exclude group: 'xml-apis', module: 'xmlParserAPIs'
}
@amaksoft
amaksoft / Jenkinsfile
Last active December 29, 2021 08:15
My example Jenkins Pipeline setup for Android app project
#!/usr/bin/groovy
/*
* Copyright (c) 2016, Andrey Makeev <amaksoft@gmail.com>
* 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
@amaksoft
amaksoft / gitcheats.txt
Created September 30, 2016 14:23 — forked from chrismccoy/gitcheats.txt
git cheats
# 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
@amaksoft
amaksoft / 70-sign-virtual.sh
Last active March 21, 2024 05:59
Virtualbox and VMware modules signing for Fedora
#!/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
@amaksoft
amaksoft / CompoundDrawableClickListener.java
Last active May 31, 2023 10:06
Handling TextView compound drawables touch and click events
/*
* 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
@amaksoft
amaksoft / MainActivity.kt
Last active September 28, 2017 04:27
Example for Stackoverflow answer 46459795
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
@amaksoft
amaksoft / PlaceholderRecyclerViewAdapter.java
Created October 9, 2017 16:17
Missing emptyVIew for RecyclerVIew
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;
@amaksoft
amaksoft / AndroidDisposable.java
Created October 9, 2017 16:19
RxJava2 Disposable bound to Activity/Fragment lifecycle
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;
/**
@amaksoft
amaksoft / RequestViewModel.java
Created February 21, 2018 02:04
Generalized request wrapping viewmodel
/**
* 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) {