Skip to content

Instantly share code, notes, and snippets.

View arman2123's full-sized avatar

Sheikh Ali Arman arman2123

  • Rentokil Initial Sweden
  • Sweden
View GitHub Profile
@alizahid
alizahid / resizer
Last active October 1, 2018 18:17
Image resize and fix orientation in Java
private static Bitmap getImage(Context context, String name, int quality) throws IOException {
File file = new File(context.getExternalFilesDir(Environment.DIRECTORY_PICTURES), name);
BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
BitmapFactory.decodeFile(file.getAbsolutePath(), options);
float ratio = (float) options.outWidth / (float) options.outHeight;
@asafge
asafge / ng-really.js
Created November 12, 2013 13:06
ng-really? An AngularJS directive that creates a confirmation dialog for an action.
/**
* A generic confirmation for risky actions.
* Usage: Add attributes: ng-really-message="Are you sure"? ng-really-click="takeAction()" function
*/
angular.module('app').directive('ngReallyClick', [function() {
return {
restrict: 'A',
link: function(scope, element, attrs) {
element.bind('click', function() {
var message = attrs.ngReallyMessage;
@rborn
rborn / ExifUtil.java
Created September 27, 2012 21:13 — forked from 9re/ExifUtil.java
fix flipped / rotated image by getting exif orientation
import java.io.IOException;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import android.graphics.Bitmap;
import android.graphics.Matrix;
import android.os.Build;