Skip to content

Instantly share code, notes, and snippets.

@ficusk
ficusk / GsonRequest.java
Last active April 9, 2024 09:03
A Volley adapter for JSON requests that will be parsed into Java objects by Gson.
import com.google.gson.Gson;
import com.google.gson.JsonSyntaxException;
import com.android.volley.AuthFailureError;
import com.android.volley.NetworkResponse;
import com.android.volley.ParseError;
import com.android.volley.Request;
import com.android.volley.Response;
import com.android.volley.Response.ErrorListener;
import com.android.volley.Response.Listener;
package your.awesome.app;
import android.graphics.Bitmap;
import android.support.v4.util.LruCache;
import com.android.volley.toolbox.ImageLoader.ImageCache;
public class LruBitmapCache extends LruCache<String, Bitmap> implements ImageCache {
public LruBitmapCache(int maxSize) {
super(maxSize);
@ficusk
ficusk / copypastefail.c
Created February 23, 2014 21:41
Braces don't prevent copy-paste bugs, kids.
if ((err = SSLHashSHA1.update(&hashCtx, &serverRandom)) != 0) {
goto fail;
}
if ((err = SSLHashSHA1.update(&hashCtx, &signedParams)) != 0) {
goto fail;
}
goto fail;
if ((err = SSLHashSHA1.final(&hashCtx, &hashOut)) != 0) {
goto fail;
}

Keybase proof

I hereby claim:

  • I am ficusk on github.
  • I am ficus (https://keybase.io/ficus) on keybase.
  • I have a public key whose fingerprint is B95D 503A ACA5 7ED7 FD5E 97E1 A494 F676 818C 1D4C

To claim this, I am signing this object:

// -rw-r--r--@ 1 ficus 1876110778 5344 Oct 8 2004 war.c
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/time.h>
typedef struct _card card;
#define min(a,b) ((a)<(b)?(a):(b))