Skip to content

Instantly share code, notes, and snippets.

@Mariovc
Mariovc / ImagePicker.java
Last active February 7, 2024 23:33
Utility for picking an image from Gallery/Camera with Android Intents
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ResolveInfo;
import android.content.res.AssetFileDescriptor;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Matrix;
import android.media.ExifInterface;
@drewlarsen
drewlarsen / promises-with-validations.js
Last active July 23, 2017 11:51
A pattern for a Parse.com Cloud Code function using Promises, including validations, fetches, saves.
// A cloud Code function that is called from iOS, Android and web
// each time an athlete logs into the app
// Updates the athlete and creates an entry in the "TB_Login" class
// NOTE: isDefined is a utility function defined elsewhere
Parse.Cloud.define("athleteDidLogin", function(request, response) {
// req'd params
var athId = request.params.athId;