Skip to content

Instantly share code, notes, and snippets.

Peter Tackage peter-tackage

Block or report user

Report or block peter-tackage

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@iros
iros / API.md
Created Aug 22, 2012
Documenting your REST API
View API.md

Title

<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>

  • URL

    <The URL Structure (path only, no root url)>

  • Method:

@imminent
imminent / AndroidCookieStore.java
Last active Dec 14, 2015
Collection of code to use the Client interface of Retrofit to use HttpUrlConnection with SharedPreferences persistent cookies.
View AndroidCookieStore.java
import android.annotation.TargetApi;
import android.content.SharedPreferences;
import android.os.Build;
import android.os.PatternMatcher;
import com.keepandshare.android.utils.CryptographyUtil;
import com.keepandshare.android.utils.Ln;
import javax.inject.Singleton;
import java.net.CookieStore;
import java.net.HttpCookie;
@ianbarber
ianbarber / gist:5170508
Last active Jul 25, 2019
Example Sign In activity for Google Sign-In on Android that retrieves an authorization code for use with server side authentication. See http://www.riskcompletefailure.com/2016/07/server-side-google-api-access-from.html for more background and links.
View gist:5170508
package com.example.anothersignintest;
import com.google.android.gms.auth.api.Auth;
import com.google.android.gms.auth.api.signin.GoogleSignInAccount;
import com.google.android.gms.auth.api.signin.GoogleSignInOptions;
import com.google.android.gms.auth.api.signin.GoogleSignInResult;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.common.api.OptionalPendingResult;
import com.google.android.gms.common.api.ResultCallback;
@JakeWharton
JakeWharton / OkHttpStack.java
Created May 21, 2013
A `HttpStack` implementation for Volley that uses OkHttp as its transport.
View OkHttpStack.java
import com.android.volley.toolbox.HurlStack;
import com.squareup.okhttp.OkHttpClient;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;
/**
* An {@link com.android.volley.toolbox.HttpStack HttpStack} implementation which
* uses OkHttp as its transport.
*/
@damianflannery
damianflannery / gist:5717329
Last active Dec 18, 2015
android square okhttp, mimecraft & cookies
View gist:5717329
public static int okSubmitAttachment(Context ctx, String filePath, String mimeType, String uuid) throws IOException, URISyntaxException, MalformedURLException {
int responseCode = 0;
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(ctx);
String baseUrl = prefs.getString("server_preference", Constants.DEFAULT_BASE_URL);
if (!(baseUrl.charAt(baseUrl.length() - 1) == '/')) {
baseUrl += "/";
}
@swankjesse
swankjesse / RetrofitCachingExample.java
Created Jun 29, 2013
Demonstrate HTTP caching with OkHttp and Retrofit.
View RetrofitCachingExample.java
/*
* 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
@orip
orip / build.gradle
Last active Apr 19, 2016
ProGuard rules for using Dagger 1.1.0 with gradle.
View build.gradle
dependencies {
def dagger_version = "1.1.0"
compile "com.squareup.dagger:dagger:${dagger_version}"
compile "com.squareup.dagger:dagger-compiler:${dagger_version}"
}
@gabrielemariotti
gabrielemariotti / build.gradle
Last active Oct 6, 2019
Use signing.properties file which controls which keystore to use to sign the APK with gradle.
View build.gradle
android {
signingConfigs {
release
}
buildTypes {
release {
signingConfig signingConfigs.release
}
@stefanhoth
stefanhoth / android-libs.md
Last active Dec 29, 2015
GDG Android in Berlin brainstorming session Collection of libraries that should be included as of today in a modern Android app-
View android-libs.md

#GDG Android in Berlin brainstorming session


On November 27, 2013 I was asking the brilliant Android developers at GDG Android in Berlin for their favorite libraries that make their lives easier and should be included in every newly developed app.

This is the list of libraries we collected during this 10 minute session.

Architecture

View ForegroundLinearLayout.java
/*
* Copyright (C) 2006 The Android Open Source Project
*
* 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
You can’t perform that action at this time.