Skip to content

Instantly share code, notes, and snippets.

@mr-archano
mr-archano / giffify.sh
Last active August 29, 2015 14:24 — forked from rock3r/giffify.py
#!/bin/sh
# License for any modification to the original (linked below):
# ----------------------------------------------------------------------------
# "THE BEER-WARE LICENSE" (Revision 42):
# Sebastiano Poggi wrote this file. As long as you retain this notice you
# can do whatever you want with this stuff. If we meet some day, and you think
# this stuff is worth it, you can buy me a beer in return.
# ----------------------------------------------------------------------------
#
# Based upon http://blog.pkh.me/p/21-high-quality-gif-with-ffmpeg.html
@mr-archano
mr-archano / GradleWorkersPleaseStopTakingFocus.gradle
Last active August 29, 2015 14:25 — forked from artem-zinnatullin/GradleWorkersPleaseStopTakingFocus.gradle
Prevent Gradle Workers from taking focus! #DevelopersLikeComfort
// You can place it in the root build.gradle
allprojects {
tasks.withType(JavaForkOptions) {
// Forked processes like GradleWorkerMain for tests won't steal focus!
jvmArgs '-Djava.awt.headless=true'
}
}
@mr-archano
mr-archano / Android Lollipop Widget Tinting Guide
Last active August 29, 2015 14:25 — forked from seanKenkeremath/Android Lollipop Widget Tinting Guide
How base colors in Lollipop apply to different UI elements
Unless specified otherwise, all of the below tinting applies to both Lollipop and pre-Lollipop using AppCompat v21. To use the support version of these attributes, remove the android namespace. For instance, "android:colorControlNormal" becomes "colorControlNormal". These attributes will be propagated to their corresponding attributes within the android namespace for devices running Lollipop. Any exceptions to this will be noted by including the "android:" prefix.
All Clickable Views:
-----------
* ripple effect (Lollipop only) -- "colorControlHighlight"
Status Bar:
------------
* background (Lollipop only) - "colorPrimaryDark"
@mr-archano
mr-archano / AccountAuthenticator.java
Created January 16, 2016 11:40 — forked from burgalon/AccountAuthenticator.java
Implementing OAuth2 with AccountManager, Retrofit and Dagger
public class AccountAuthenticator extends AbstractAccountAuthenticator {
private final Context context;
@Inject @ClientId String clientId;
@Inject @ClientSecret String clientSecret;
@Inject ApiService apiService;
public AccountAuthenticator(Context context) {
super(context);
@mr-archano
mr-archano / howto.md
Created February 13, 2016 15:09 — forked from neworld/howto.md
How to make faster Android build without sacrificing new api lint check

Original solution sacrifices new api lint check.

Here my solution:

int minSdk = hasProperty('minSdk') ? minSdk.toInteger() : 16

apply plugin: 'com.android.application'

android {
 compileSdkVersion 23
@mr-archano
mr-archano / RxponetialBackoff
Created February 16, 2016 17:54 — forked from sddamico/LICENSE
Exponential Backoff Transformer
/**
* @param interval The base interval to start backing off from. The function is: attemptNum^2 * intervalTime
* @param units The units for interval
* @param retryAttempts The max number of attempts to retry this task or -1 to try MAX_INT times,
*/
public static <T> Observable.Transformer<T, T> backoff(final long interval, final TimeUnit units, final int retryAttempts) {
return new Observable.Transformer<T, T>() {
@Override
public Observable<T> call(final Observable<T> observable) {
return observable.retryWhen(
@mr-archano
mr-archano / screenrecord.sh
Created April 17, 2016 08:46 — forked from tasomaniac/screenrecord.sh
Screen Record for Android
#!/bin/sh
set -e
if [ -z "$1" ]; then
shot_path=$(date +%Y-%m-%d-%H-%M-%S).mp4
else
shot_path="$*"
fi
import java.util.concurrent.atomic.AtomicReference;
import rx.Observable;
import rx.Subscriber;
import rx.functions.Action0;
import rx.functions.Func0;
/**
* This custom {@link Observable.Transformer} can be used to replay an in flight {@link Observable}
* source among all {@link Subscriber}s subscribed before its termination.
*/
import rx.Observable;
import rx.functions.Action0;
import rx.functions.Func0;
import java.util.concurrent.atomic.AtomicReference;
class SubscribedObservableReplayer<T> implements Observable.Transformer<T, T> {
private final AtomicReference<Observable<T>> pendingObservable;
@mr-archano
mr-archano / Oauth1SigningInterceptor.java
Created September 11, 2016 10:19 — forked from serj-lotutovici/Oauth1SigningInterceptor.java
An OkHttp interceptor which does OAuth1 signing. Requires Java 7 (but can easily be ported to Java 6).
/*
* 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