This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@SuppressWarnings({ "unchecked", "rawtypes" }) | |
private static <T> Pair<String, T> saveAndParseResponse(final ResponseBody response, final TypeReference type) | |
throws IOException { | |
final Buffer sink = new Buffer(); | |
final StringBuilder builder = new StringBuilder(); | |
final Charset charset = responseCharset(response); | |
response.source().readAll(new ForwardingSink(sink) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.eleong.giferator; | |
import android.graphics.Canvas; | |
import android.graphics.Color; | |
import android.graphics.Paint; | |
import android.graphics.PorterDuff; | |
import android.graphics.drawable.Drawable; | |
import android.support.annotation.NonNull; | |
import android.support.annotation.Nullable; | |
import android.util.Log; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#extension GL_OES_EGL_image_external : require | |
precision mediump float; | |
varying vec2 vTextureCoord; | |
uniform samplerExternalOES sTexture; | |
void main() { | |
vec4 color = texture2D(sTexture, vTextureCoord); | |
float r = 0.2 + 0.8 * color.r; | |
float g = 0.2 + 0.8 * color.g; | |
float b = 0.2 + 0.8 * color.b; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Thing: | |
def __init__(self, a=1, b='two'): | |
# Iterate through local variables and assign as fields | |
for name, value in locals().items(): | |
if name != 'self': | |
setattr(self, name, value) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Thing: | |
def __init__(self, **kwargs): | |
# Set fields according to their name in the arguments | |
for name, value in kwargs.items(): | |
setattr(self, name, value) |