Skip to content

Instantly share code, notes, and snippets.

View ryanbateman's full-sized avatar
🥑
avocado

Ryan Bateman ryanbateman

🥑
avocado
  • London, United Kingdom
View GitHub Profile
@ryanbateman
ryanbateman / button_background_default.xml
Created July 18, 2012 17:48
Decent-looking Android buttons using only shape drawables
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
<shape android:shape="rectangle" >
<solid android:color="@color/darkorange" />
<padding
android:bottom="1dp"
android:left="1dp"
@ryanbateman
ryanbateman / gist:3237379
Created August 2, 2012 14:17
Useful emoticons
ಠ▃ಠ
ಠ_ರೃ
ಥ_ಥ
@ryanbateman
ryanbateman / gist:3899841
Created October 16, 2012 15:06
Round and frame an image
public static Bitmap round(Context context, Bitmap source) {
// Use the height and width of our source image as a basis
int width = source.getWidth();
int height = source.getHeight();
Paint paint = new Paint();
paint.setAntiAlias(true);
paint.setColor(WHITE);
for filename in *.RW2 ; do dcraw -c -w -v $filename | pnmtopng > pngs/$filename.png ; done
convert *.png -resize 50% -set filename:f '%t_magnify.%e' +adjoin '%[filename:f]'
@ryanbateman
ryanbateman / GsonObjectRequest.java
Last active December 17, 2015 14:39
An attempt at a GsonObjectRequest that will post and return objects using Volley
package com.example.network.requests;
import java.io.UnsupportedEncodingException;
import java.util.Map;
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;
@ryanbateman
ryanbateman / gist:5643826
Created May 24, 2013 14:17
Log out a Volley request as a curl command
private void logToCurlRequest(Request<?> request) {
StringBuilder builder = new StringBuilder();
builder.append("curl request: curl ");
builder.append("-X \"");
switch (request.getMethod()) {
case Method.POST:
builder.append("POST");
break;
case Method.GET:
builder.append("GET");
@ryanbateman
ryanbateman / gist:6667995
Last active September 6, 2017 21:03
Basic BlurTransformer for Square's Picasso
import android.content.Context;
import android.graphics.Bitmap;
import android.renderscript.Allocation;
import android.renderscript.Element;
import android.renderscript.RenderScript;
import android.renderscript.ScriptIntrinsicBlur;
import com.squareup.picasso.Transformation;
public class BlurTransform implements Transformation {
@ryanbateman
ryanbateman / underground.coffee
Last active August 29, 2015 14:00
Hubot Underground status
# Description:
# See the current list of delays or incidents on the London Underground
#
# Dependencies:
# "cheerio": "0.12.1"
#
# Commands:
# hubot tube - Replies with a list of current incidents/delays on the London Underground
#
@ryanbateman
ryanbateman / appsearch.coffee
Last active August 29, 2015 14:00
A Hubot script to quickly search for an Android app and provide a Playstore link if it exists
# Description:
# Quickly look up an Android application using 42Matters search
#
# Configuration:
#
# HUBOT_42MATTERS_ACCESS_TOKEN - the access token required for API accesss
#
# Commands:
# hubot app - Replies with the first result from an app search on 42Matters API
#
### Keybase proof
I hereby claim:
* I am ryanbateman on github.
* I am ryanbateman (https://keybase.io/ryanbateman) on keybase.
* I have a public key whose fingerprint is 28BD 3445 A837 A715 BB9E 0699 7320 CC6E 330F C2A1
To claim this, I am signing this object: