Skip to content

Instantly share code, notes, and snippets.

@mauron85
mauron85 / keep-adb-running.sh
Created September 22, 2016 09:55
Workaround adb disconnecting issue on macOS Sierra
#!/bin/bash
cat << EOF
###########################################################
# Workaround adb disconnecting issue on macOS Sierra
#
# More info:
# https://code.google.com/p/android/issues/detail?id=219085
# credits to: [email protected], [email protected]
###########################################################
@danielesegato
danielesegato / Maven-Publish.Android-Library.md
Last active March 30, 2023 11:44
Android Library Publishing Maven Artifacts via gradle

What is this

This gitst contains a script to push Android libraries as artifacts on a maven repository using the gradle build system.

It is somewhate a fork of Chris Banes gradle push script.

This was me while trying to understand how to setup maven publishing with gradle:

confused AF

Documentation is absent or very lacking and I found no script handling javadoc properly for Android.

@rakshakhegde
rakshakhegde / fragment_utility.kt
Last active January 19, 2023 09:26
Handy Idiom: Pass Arguments to Android Fragment using Kotlin + Anko
import android.support.v4.app.Fragment
import org.jetbrains.anko.bundleOf
/**
* Pass arguments to a Fragment without the hassle of
* creating a static newInstance() method for every Fragment.
*
* Declared outside any class to have full access in any
* part of your package.
*
@iamniels
iamniels / Server side printing with Google Cloud Print API from a PHP application.md
Created April 15, 2016 09:59
Server side printing with Google Cloud Print API from a PHP application

Server side printing with Google Cloud Print API from a PHP application

It took me quite some time to figure out how to print properly from a web application. I will explain here how I did it, so you don't have to spend the same time.

Authorization

Google Cloud Print API uses OAuth 2.0 for authorization.

As explained [here][1] on the Google Developer page, the best way to use OAuth with the Google API is with a Google service account. Create a service account as explained on the Google Developer page.

To use OAuth a library is required. Google has published the [Google API PHP client library][2]. If you want to use the examples from the Developer pages, you need to use version 1 of the library. In this article I use version 2 of the library.

@imminent
imminent / Api.java
Last active June 13, 2023 02:50
Call retrying with Retrofit 2.0
package com.example.api;
import java.util.Map;
import retrofit.Call;
import retrofit.http.Body;
import retrofit.http.GET;
import retrofit.http.POST;
public interface Api {
@theothermattm
theothermattm / sync-using-gitignore.sh
Created October 7, 2015 20:58
Rsync files using .gitignore
# sync everything excluding things in .gitignore
# delete anything on target not in source
# include dotfiles and symlinks, also use compression
rsync -azP --delete --filter=":- .gitignore" . my-target-host:/my/target/directory
@markshiz
markshiz / CacheTest.java
Last active May 5, 2018 02:34 — forked from swankjesse/RetrofitCachingExample.java
Demonstrate HTTP caching with OkHttp 2.5.0 and Retrofit 1.9.0.
/*
* Copyright (C) 2013 Square, Inc.
*
* 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
@kobachi
kobachi / android-support-v4.jar.hash.md
Last active February 9, 2023 21:46
android-support-v4.jar Hash List
Revision SHA-1 MD5 URL
r04 c3029e4469274fa93dc9306a626275314e50a8e4 86dfb3c6ac2db479ff396906fe4ee1be https://dl-ssl.google.com/android/repository/support_r04.zip
r05 fb5b44c5924b42371105145c92a5825c1e7ac95d 6ed7cfa457967cb8d5924c93b96847e7 https://dl-ssl.google.com/android/repository/support_r05.zip
r06 7329492e76650ee661f6af7704b0c79151d8e1ef bcf017dfe2243c8d72b4b2aa40101040 https://dl-ssl.google.com/android/repository/support_r06.zip
r07 53307dc2bd2b69fd5533458ee11885f55807de4b c6c2148762c614d3bad120ca01491e34 https://dl-ssl.google.com/android/repository/support_r07.zip
r08 8790fea7a0bc1d42c69c648571e2c7a02c92cf4c 776555f10c632cd4f2790b6bbd2465bf https://dl-ssl.google.com/android/repository/support_r08.zip
r09 27c24d26e4c5d57976e6926367985548678e913c d0107ad5a43839ecdc08fbcf783bdb4f https://dl-ssl.google.com/android/repository/support_r09.zip
r10 612846c9857077a039b533718f72db3bc041d389 7c357558b1ef5cd16f1d312fe87c38a0 https://dl-ssl.google.com/android/repository/support_r10
@alex-shpak
alex-shpak / Interceptor.java
Last active June 24, 2025 03:32
Refreshing OAuth token with okhttp interceptors. All requests will wait until token refresh finished, and then will continue with the new token.
private class HttpInterceptor implements Interceptor {
@Override
public Response intercept(Chain chain) throws IOException {
Request request = chain.request();
//Build new request
Request.Builder builder = request.newBuilder();
builder.header("Accept", "application/json"); //if necessary, say to consume JSON
@dlew
dlew / themes-debug.xml
Last active January 20, 2025 16:07
With the new theming in AppCompat, a lot of assets are tinted automatically for you via theme attributes. That has often led me to wonder "where the hell did this color come from?" You can replace your normal theme with this debug theme to help figure out the source of that color.
<!-- You can change the parent around to whatever you normally use -->
<style name="DebugColors" parent="Theme.AppCompat">
<!-- System colors -->
<item name="android:windowBackground">@color/__debugWindowBackground</item>
<item name="android:colorPressedHighlight">#FF4400</item>
<item name="android:colorLongPressedHighlight">#FF0044</item>
<item name="android:colorFocusedHighlight">#44FF00</item>
<item name="android:colorActivatedHighlight">#00FF44</item>