Skip to content

Instantly share code, notes, and snippets.

View gouravd's full-sized avatar

das_vicky gouravd

  • Cayfay
  • Hyderabad, India
View GitHub Profile

Google's authentication-less on-the-fly image resizing service

I found it while poking around the Google+ HTML. Jotting down some notes felt like a good idea, so here goes. If you know more about this API, let me know, please!

(Word of warning: I spent ~30 minutes on both my experimentation and this here write-up, so it might not be the most thought-provoking, brilliant thing you read today.)

@gouravd
gouravd / ICloud.java
Last active August 29, 2015 14:19 — forked from funseiki/ICloud.java
// Uses retrofit to generate an implementation
public interface ICloud {
static String serviceProviderHeader = "X-Auth-Service-Provider";
static String credentialsAuthorizationHeader = "X-Verify-Credentials-Authorization";
@GET("/verify_credentials?provider=digits")
void verifyCredentials(
@Header(serviceProviderHeader) String serviceProvider,
@Header(credentialsAuthorizationHeader) String authorization,
@Query("id") long id,
@gouravd
gouravd / ICloud.java
Last active August 29, 2015 14:24 — forked from funseiki/ICloud.java
// Uses retrofit to generate an implementation
public interface ICloud {
static String serviceProviderHeader = "X-Auth-Service-Provider";
static String credentialsAuthorizationHeader = "X-Verify-Credentials-Authorization";
@GET("/verify_credentials?provider=digits")
void verifyCredentials(
@Header(serviceProviderHeader) String serviceProvider,
@Header(credentialsAuthorizationHeader) String authorization,
@Query("id") long id,
@gouravd
gouravd / ControllableAppBarLayout.java
Last active August 29, 2015 14:28 — forked from iftekhar-ahmed/ControllableAppBarLayout.java
A modified version of ControllableAppBarLayout that allows to add/remove multiple listeners for layout state change (collapsed, expanded or idle). The original ControllableAppBarLayout is here https://gist.github.com/blipinsk/3f8fb37209de6d3eea99
/**
* Copyright 2015 Bartosz Lipinski
* <p/>
* 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
* <p/>
* http://www.apache.org/licenses/LICENSE-2.0
* <p/>
* Unless required by applicable law or agreed to in writing, software
@gouravd
gouravd / Connectivity.java
Last active September 8, 2015 16:59 — forked from emil2k/Connectivity.java
Android utility class for checking device's network connectivity and speed.
package com.emil.android.util;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.telephony.TelephonyManager;
/**
* Check device's network connectivity and speed
* @author emil http://stackoverflow.com/users/220710/emil
@gouravd
gouravd / EndlessRecyclerOnScrollListener.java
Created December 27, 2015 14:20 — forked from imran0101/EndlessRecyclerOnScrollListener.java
RecyclerView position helper to get first and last visible positions
/**
* Custom Scroll listener for RecyclerView.
* Based on implementation https://gist.github.com/ssinss/e06f12ef66c51252563e
*/
public abstract class EndlessRecyclerOnScrollListener extends RecyclerView.OnScrollListener {
public static String TAG = "EndlessScrollListener";
private int previousTotal = 0; // The total number of items in the dataset after the last load
private boolean loading = true; // True if we are still waiting for the last set of data to load.
private int visibleThreshold = 5; // The minimum amount of items to have below your current scroll position before loading more.
@gouravd
gouravd / 1_query_timestamp.js
Created April 15, 2016 16:01 — forked from katowulf/1_query_timestamp.js
Get only new items from Firebase
// assumes you add a timestamp field to each record (see Firebase.ServerValue.TIMESTAMP)
// pros: fast and done server-side (less bandwidth, faster response), simple
// cons: a few bytes on each record for the timestamp
var ref = new Firebase(...);
ref.orderByChild('timestamp').startAt(Date.now()).on('child_added', function(snapshot) {
console.log('new record', snap.key());
});
@gouravd
gouravd / AACStream.java
Created April 26, 2016 07:10 — forked from sbaar/AACStream.java
libstreaming muxer
protected void encodeWithMediaCodec(){
...
mAudioRecord.startRecording();
mMediaCodec.start();
final MediaCodecInputStream inputStream = new MediaCodecInputStream(mMediaCodec);
if (mMuxer!=null) inputStream.setMuxer(mMuxer);
final ByteBuffer[] inputBuffers = mMediaCodec.getInputBuffers();
}
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.Query;
import com.google.firebase.database.ValueEventListener;
import java.util.concurrent.CountDownLatch;
/**
* File Created by gouravd on 17/08/16.
@gouravd
gouravd / PatternEditableBuilder.java
Created November 22, 2017 16:04 — forked from nesquena/PatternEditableBuilder.java
PatternEditableBuilder - Easy way to create colored clickable spans within a TextView!
import android.text.SpannableStringBuilder;
import android.text.Spanned;
import android.text.TextPaint;
import android.text.method.LinkMovementMethod;
import android.text.style.ClickableSpan;
import android.view.View;
import android.widget.TextView;
import java.util.ArrayList;
import java.util.regex.Matcher;