Skip to content

Instantly share code, notes, and snippets.

Aritra Roy aritraroy

Block or report user

Report or block aritraroy

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@aritraroy
aritraroy / LeakSlackUploadService.java
Created Dec 23, 2018 — forked from pyricau/LeakSlackUploadService.java
Sending Leak Traces to a Slack Channel (and HipChat, see the comments)
View LeakSlackUploadService.java
import android.util.Log;
import com.squareup.leakcanary.AnalysisResult;
import com.squareup.leakcanary.DisplayLeakService;
import com.squareup.leakcanary.HeapDump;
import retrofit.RestAdapter;
import retrofit.RetrofitError;
import retrofit.http.Multipart;
import retrofit.http.POST;
import retrofit.http.Part;
import retrofit.mime.TypedFile;
View test_login.java
@Test
public void login_successIfUserNameAndPasswordIsValid() {
// Arrange
String username = "username";
String password = "password";
when(userRepository.isUsernameValid(username)).thenReturn(true);
when(userRepository.isPasswordValid(password)).thenReturn(true);
// Act
View fat_constructors.java
public class Order {
private String id;
private String origin;
private double price;
public Order(String id, String origin, double price) {
this.id = id;
this.origin = origin;
@aritraroy
aritraroy / EachDirectoryPath.md
Created Jan 9, 2017 — forked from granoeste/EachDirectoryPath.md
[Android] How to get the each directory path.
View EachDirectoryPath.md

System directories

Method Result
Environment.getDataDirectory() /data
Environment.getDownloadCacheDirectory() /cache
Environment.getRootDirectory() /system

External storage directories

View GammaEvaluator.java
import android.animation.TypeEvaluator;
import android.animation.ValueAnimator;
import static java.lang.Math.pow;
public class GammaEvaluator implements TypeEvaluator {
private static final GammaEvaluator sInstance = new GammaEvaluator();
/**
@aritraroy
aritraroy / IconizedMenu.java
Created Jun 28, 2016 — forked from mediavrog/IconizedMenu.java
Android Compatibility popup menu with icons (requires support library v7)
View IconizedMenu.java
package com.vuzz.snapdish.ui;
import android.content.Context;
import android.support.v7.internal.view.SupportMenuInflater;
import android.support.v7.internal.view.menu.MenuBuilder;
import android.support.v7.internal.view.menu.MenuPopupHelper;
import android.support.v7.internal.view.menu.MenuPresenter;
import android.support.v7.internal.view.menu.SubMenuBuilder;
import android.view.Menu;
import android.view.MenuInflater;
@aritraroy
aritraroy / Singleton.java
Last active Nov 16, 2018
A Perfect Singleton Design Pattern Implementation
View Singleton.java
import java.io.Serializable;
/**
* The perfect implementation of Singleton design pattern
* Properly solves all the below mentioned problems in Singleton pattern
* <p>
* 1) Attack using Reflection API
* 2) Problems from serialization/deserialization of your object
* 3) Problems from cloning your object
* 4) Uncertainty in a multi-threaded environment
@aritraroy
aritraroy / Foreground.java
Last active Apr 7, 2016 — forked from steveliles/Foreground.java
Class for detecting and eventing whether an Android app is currently foreground or background (requires API level 14+)
View Foreground.java
package com.sjl.util;
import android.app.Activity;
import android.app.Application;
import android.content.Context;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
import java.util.List;
@aritraroy
aritraroy / git-aliases.md
Created Apr 4, 2016 — forked from mwhite/git-aliases.md
The Ultimate Git Alias Setup
View git-aliases.md

The Ultimate Git Alias Setup

If you use git on the command-line, you'll eventually find yourself wanting aliases for your most commonly-used commands. It's incredibly useful to be able to explore your repos with only a few keystrokes that eventually get hardcoded into muscle memory.

Some people don't add aliases because they don't want to have to adjust to not having them on a remote server. Personally, I find that having aliases doesn't mean I that forget the underlying commands, and aliases provide such a massive improvement to my workflow that it would be crazy not to have them.

The simplest way to add an alias for a specific git command is to use a standard bash alias.

# .bashrc
You can’t perform that action at this time.