Skip to content

Instantly share code, notes, and snippets.

View noties's full-sized avatar

Dimitry noties

View GitHub Profile
@noties
noties / gradle-java-maven-publish.gradle
Created December 20, 2017 14:05
Publish java artifacts to Maven with gradle
apply plugin: 'maven'
apply plugin: 'signing'
def isReleaseBuild() {
return VERSION_NAME.contains("SNAPSHOT") == false
}
def getReleaseRepositoryUrl() {
return hasProperty('RELEASE_REPOSITORY_URL') ? RELEASE_REPOSITORY_URL
: "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
@noties
noties / BuildUtil.java
Created June 21, 2017 12:49
BuildUtil, util method for checking device's SDK level
package ru.noties.buildutil;
import android.os.Build;
import android.support.annotation.IntDef;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import static android.os.Build.VERSION_CODES.BASE;
import static android.os.Build.VERSION_CODES.BASE_1_1;
[alias]
erm = "!git branch -r --merged | grep -v master | grep -v develop | sed 's/origin\\///' | xargs -n 1"
elm = "!git branch --merged | grep -v master | grep -v develop | sed 's/origin\\///' | xargs -n 1"
pt = "!git push origin --tags"
cb = "!git rev-parse --abbrev-ref HEAD"
pcb = "!git rev-parse --abbrev-ref HEAD | xargs -n 1 git push origin -u"
ac = "!git add . && git commit -m"
s = "!git status"
nb = "!git checkout -b"
cpc = "!f() { cb=$(git cb); git checkout $1 && git pull && git checkout $(echo $cb); }; f"
@noties
noties / Snackbarmanager
Created November 26, 2014 10:00
SnackbarManagerImpl
import android.app.Activity;
import android.os.Handler;
import android.os.Message;
import com.nispok.snackbar.Snackbar;
import java.lang.ref.WeakReference;
import java.util.HashMap;
import java.util.Map;
@noties
noties / CenteredScrollView
Created November 17, 2014 10:03
Centered ScrollView
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ScrollView;
/**
* Created by Dimitry Ivanov (noties.app@gmail.com) / macbook on 10/10/14.
*/
public class CenteredScrollView extends ScrollView {