Skip to content

Instantly share code, notes, and snippets.

@squeeish
squeeish / FileUtils.java
Created June 18, 2019 17:16 — forked from HBiSoft/FileUtils.java
This fixes the issue when selecting a file from Downloads directory as well as the SD Card. This class can be called like this: String sourcePath = FileUtils.getRealPathFromURI_API19(this, data.getData());
import android.annotation.SuppressLint;
import android.content.ContentUris;
import android.content.Context;
import android.content.CursorLoader;
import android.database.Cursor;
import android.net.Uri;
import android.os.Build;
import android.os.Environment;
import android.provider.DocumentsContract;
import android.provider.MediaStore;
@squeeish
squeeish / nric-validation.java
Last active October 17, 2022 05:40 — forked from eddiemoore/nric-validation.js
Validation for Singapore NRIC and FIN number
/**
* Validates Singapore NRIC / FIN in 2 stages:
* 1) Ensure first letter starts with S, T, F or G and the last letter is A-Z
* 2) Calculate weight of digits in between first and last character of the input string,
* determine what the last letter should be, then match it against the last character of the
* input string.
*
* @param inputString NRIC / FIN string to be validated
* @return true if NRIC/FIN passes, false otherwise
*/
@squeeish
squeeish / AlphaTransformation.java
Created September 25, 2017 18:27
AlphaTransformation for Glide 3.7.0
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Paint;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.Transformation;
import com.bumptech.glide.load.engine.Resource;
import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool;
import com.bumptech.glide.load.resource.bitmap.BitmapResource;
@squeeish
squeeish / .gitignore
Last active May 22, 2018 04:54
Android .gitignore
*.iml
.gradle
/local.properties
.idea
/build
/captures
# fastlane specific
fastlane/report.xml
fastlane/Preview.html