Skip to content

Instantly share code, notes, and snippets.

View vinaysshenoy's full-sized avatar

Vinay Shenoy vinaysshenoy

View GitHub Profile
@vinaysshenoy
vinaysshenoy / colottohex.java
Created August 26, 2015 17:56
Android Color to hexString
String hexColor = String.format("#%06X", (0xFFFFFF & intColor)); //Without alpha
String hexColor = String.format("#%08X", (0xFFFFFFFF & intColor)); //With alpha(Not tested)
-nosplash
--launcher.defaultAction
openFile
-vm
C:/JDK7/jre/bin/server/jvm.dll #Windows
#/Library/Java/JavaVirtualMachines/jdk1.7.0_25.jdk/Contents/Home/bin/java #OS X
-vmargs
-Xincgc
-Xss1m
-Duser.name=FirstName LastName
/*
* Copyright (C) 2014 Chris Banes
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@vinaysshenoy
vinaysshenoy / android-map-utility
Created June 8, 2014 10:12
Some Utility methods for Google's Android Map SDK
/**
* Returns the center of a map
*
* @param map The map to fetch the center location of
* @return The center of the map
*/
public static Location getCenterLocationOfMap(final GoogleMap map) {
final LatLng latLng = map.getCameraPosition().target;
final Location location = new Location(LocationManager.PASSIVE_PROVIDER);
location.setLatitude(latLng.latitude);
@vinaysshenoy
vinaysshenoy / gist:7d6ed97010c9ee48add6
Last active August 29, 2015 14:16
Checkout file from older commit
git checkout sha1 -- path/to/file.txt
git checkout 'master@{7 days ago}' -- path/to/file.txt
@vinaysshenoy
vinaysshenoy / gist:d8ed1e51ac0f6abb53ce
Created March 1, 2015 19:29
Remote branches deleted from remote repo
git remote prune <remote>
@vinaysshenoy
vinaysshenoy / gist:4dc5df8240a77383713e
Created March 1, 2015 19:33
Git delete branch both locally and remotely
git branch -d <branch>
git push <remote> :<branch>
@vinaysshenoy
vinaysshenoy / gist:fa8eb8b2447f5e7451af
Last active August 29, 2015 14:18
DP/PX Conversion
/**
* Converts a raw pixel value to a dp value, based on the device density
*/
private static float pxToDp(float px) {
return px / Resources.getSystem().getDisplayMetrics().density;
}
/**
* Converts a raw dp value to a pixel value, based on the device density
*/
@vinaysshenoy
vinaysshenoy / DividerView.java
Created November 9, 2015 10:53
Android DividerView
package com.vinaysshenoy.widget;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.DashPathEffect;
import android.graphics.Paint;
@vinaysshenoy
vinaysshenoy / BitmapProgressView.java
Created November 23, 2015 17:19
Image Progress Bar
package com.vinaysshenoy.imageprogressbar.widgets;
import android.animation.ValueAnimator;
import android.annotation.TargetApi;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.PorterDuff;