Skip to content

Instantly share code, notes, and snippets.

View serj-lotutovici's full-sized avatar

Serj Lotutovici serj-lotutovici

View GitHub Profile
@chrisbanes
chrisbanes / KotterKnife.kt
Last active February 7, 2021 15:25
LifecycleAware KotterKnife
package kotterknife
import android.app.Activity
import android.app.Dialog
import android.app.DialogFragment
import android.app.Fragment
import android.arch.lifecycle.Lifecycle
import android.arch.lifecycle.LifecycleObserver
import android.arch.lifecycle.LifecycleOwner
import android.arch.lifecycle.OnLifecycleEvent
@adavis
adavis / CommonExtensions.kt
Last active April 2, 2024 20:51
Common Android Extensions in Kotlin
fun View.visible() {
visibility = View.VISIBLE
}
fun View.invisible() {
visibility = View.INVISIBLE
}
fun View.gone() {
visibility = View.GONE
@strooooke
strooooke / choose_device.sh
Created April 29, 2017 11:57
Wrapper script for adb commands (and pidcat!) that take a -s device serial argument, allowing to choose between devices
#!/bin/bash
# Prompts for device to use from adb devices -l first; inserts -s parameter.
# No sanitizing, error checking or warranties!
# Use like
# $choose_device adb shell
DEVICES=`adb devices -l | sed 1d`
PS3="Choose device or Ctrl+C to quit: "
@hrules6872
hrules6872 / SQLQueryBuilder.java
Last active April 27, 2017 21:32
SQLQueryBuilder
@SuppressWarnings({ "WeakerAccess", "unused" }) public class SQLQueryBuilder {
private static final String STATEMENT_SELECT = "SELECT";
private static final String STATEMENT_DISTINCT_SELECT = "SELECT DISTINCT";
private static final String STATEMENT_UPDATE = "UPDATE";
private static final String STATEMENT_INSERT_INTO = "INSERT INTO";
private static final String STATEMENT_DELETE = "DELETE FROM";
private static final String WHERE = "WHERE";
private static final String FROM = "FROM";
@aballano
aballano / WrapHeightViewPager.java
Created October 23, 2015 23:50
Dynamic view pager which sets it´s height to the maximum size of it´s children if set to wrap_content.
import android.content.Context;
import android.support.v4.view.ViewPager;
import android.util.AttributeSet;
import android.view.Gravity;
import android.view.MotionEvent;
import android.view.View;
/**
* Created by Shyish on 11/10/2015.
*/
@JakeWharton
JakeWharton / Oauth1SigningInterceptor.java
Last active November 27, 2023 10:04
An OkHttp interceptor which does OAuth1 signing. Requires Guava and Java 8, although those dependencies wouldn't be too hard to break if you didn't have them.
/*
* Copyright (C) 2015 Jake Wharton
*
* 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
@staltz
staltz / introrx.md
Last active May 3, 2024 13:00
The introduction to Reactive Programming you've been missing
@blundell
blundell / anti-hungarian-checkstyle
Created January 25, 2014 15:12
Anti-Hungarian CheckStyle check
import com.puppycrawl.tools.checkstyle.api.*;
public class AntiHungarianCheck extends Check {
private static final String CATCH_MSG = "Hungarian notation belongs in the 90's. " +
"Don't prefix member variables with 'm'. " +
"Use your IDE's shiny colors. Culprit was: ";
private final HungarianNotationMemberDetector detector = new HungarianNotationMemberDetector();