Skip to content

Instantly share code, notes, and snippets.

View karthikrg's full-sized avatar

Karthik Ramgopal karthikrg

View GitHub Profile
@karthikrg
karthikrg / pegasus.json
Last active March 2, 2016 20:17
Sample pegasus record
{
"type" : "record",
"name" : "MemberProfile",
"namespace" : "com.linkedin.pegasus",
"doc" : "Represents a member profile",
"fields" : [
{ "name" : "firstName", "type" : "String" },
{ "name" : "lastName", "type" : "String", "optional" : "true" },
{ "name" : "companyName", "type" : "String", "optional" : "true" },
{ "name" : "age", "type" : "int", "optional" : "true" } ]
@karthikrg
karthikrg / gist:a1452ee7ef96c7c208df
Last active March 2, 2016 18:54
Pegasus jackson stream parser bindings
public MemberProfile build(@android.support.annotation.NonNull JsonParser jsonParser) throws java.io.IOException {
if (jsonParser.getCurrentToken() == null) {
jsonParser.nextToken();
}
if (jsonParser.getCurrentToken()!= JsonToken.START_OBJECT) {
jsonParser.skipChildren();
throw new java.io.IOException("Malformed JSON. Failed to find '{' when building com.linkedin.android.pegasus.MemberProfile");
}
@karthikrg
karthikrg / gist:0948bf5d7864c0376bcd
Created February 20, 2016 01:24
Coordinator layout that supports nesting of other coordinator layouts within
package android.support.design.widget;
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.view.NestedScrollingChildHelper;
import android.util.AttributeSet;
import android.view.View;
/**