Skip to content

Instantly share code, notes, and snippets.

View plastiv's full-sized avatar

Sergii Pechenizkyi plastiv

View GitHub Profile
@plastiv
plastiv / QueryBuilder.java
Created July 23, 2013 14:28
Simple query builder to prevent mess in where statements. Base idea is: one operation for one line.
public class QueryBuilder {
private final StringBuilder sb;
public QueryBuilder() {
sb = new StringBuilder();
}
public QueryBuilder like(String columnName, String value) {
@plastiv
plastiv / .gitignore
Last active December 25, 2015 22:59
Android .gitignore file for projects folder.
#
# https://gist.github.com/plastiv/7053530
#
# Base configuration taken from https://github.com/github/gitignore/blob/master/Android.gitignore
#
# Eclipse project files
.classpath
.project
.settings/
.metadata/
public class Vim430TestCase extends TestCase {
private ObjectMapper objectMapper;
@Override protected void setUp() throws Exception {
super.setUp();
objectMapper = ObjectMapperFactory.create();
}
public void testMapping() {
androidTestCompile("com.android.support.test.espresso:espresso-core:2.0"){
// avoid conflict with dagger transitive dependency
exclude group: 'javax.inject'
}
def publishDropboxTask = project.tasks.create("publishDropbox")
android.applicationVariants.all { variant ->
TODO: made dropbox task work with new variant output API
variant.outputs.each { output ->
def publishDropboxVariantTask = project.tasks.create("publishDropbox${variant.name.capitalize()}", Copy)
publishDropboxVariantTask.from(output.outputFile)
publishDropboxVariantTask.into(file(PUBLISH_FOLDER))
publishDropboxVariantTask.dependsOn variant.assemble
publishDropboxTask.dependsOn publishDropboxVariantTask
@plastiv
plastiv / Article.java
Created April 22, 2015 08:04
Retrofit multipart convertor
@MultipartBody
public class Article {
String author;
File photo;
}
@plastiv
plastiv / SegmentedEditText.java
Created May 7, 2015 12:33
SegmentedEditText
// SegmentedEditText is horizontal linear layout contains 6 edit texts
public class SegmentedEditText extends LinearLayout {
public SegmentedEditText(Context context) {
super(context);
LayoutInflater inflater = LayoutInflater.from(context);
for (int i = 0; i < 6; i++) {
// have to do next:
EditText editText = (EditText) inflater.inflate(R.layout.partial_segmented_edittext, this, false);
addView(editText);
@plastiv
plastiv / LogObserver.java
Created May 15, 2015 08:19
RxLogObserver
public class LogObserver<T> implements Observer<T> {
private final String tag;
public LogObserver(String tag) {
this.tag = tag;
}
@Override public void onCompleted() {
System.out.println(tag + " onCompleted");
@plastiv
plastiv / rxandroid-tuts.md
Created July 4, 2015 11:27
Links for android developers