Skip to content

Instantly share code, notes, and snippets.

View shercoder's full-sized avatar

Pardeep Singh Sanghera shercoder

View GitHub Profile
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;
package com.example.yourapp;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import com.example.yourapp.AuthenticationModel;
import retrofit.client.Header;
import retrofit.client.OkClient;
@shercoder
shercoder / README.md
Last active August 29, 2015 14:20 — forked from polbins/README.md

Android REST Controller with Cache-Control

Android REST Controller with Simple Cache Control Headers using Retrofit 1.9.0 + OkHttp 2.2.0

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;
@shercoder
shercoder / mitmproxy_localytics.py
Created July 9, 2015 22:20
Script to parse Localytics data and display in readable format when using mitmproxy server
######################################################################
### How to run this script: mitmdump -q -s mitmproxy_localytics.py ###
######################################################################
import re
import gzip
from StringIO import StringIO
import json
from pprint import pprint
class color:
@shercoder
shercoder / .gitconfig
Last active August 10, 2016 19:14
Wanderful Gitconfig
[alias]
ls = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate
lr = log --pretty=format:"%Creset%s%Cblue\\ [%cn]" --decorate
ll = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --numstat
lnc = log --pretty=format:"%h\\ %s\\ [%cn]"
lds = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=short
ld = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=relative
le = log --oneline --decorate
dag = log --graph --oneline --decorate --all
brdiff = log --graph --pretty=format:"%Cred%h%Creset\\ -%C(yellow)%d%Creset\\ %s\\ %Cgreen(%cr)%Creset\\" --abbrev-commit --date=relative
@shercoder
shercoder / README.md
Last active August 29, 2015 14:25 — forked from gabrielemariotti/README.md
How to manage the support libraries in a multi-module projects. Thanks to Fernando Cejas (http://fernandocejas.com/)

Centralize the support libraries dependencies in gradle

Working with multi-modules project, it is very useful to centralize the dependencies, especially the support libraries.

A very good way is to separate gradle build files, defining something like:

root
  --gradleScript
 ----dependencies.gradle
@shercoder
shercoder / themes-debug.xml
Last active September 2, 2015 17:10 — forked from dlew/themes-debug.xml
With the new theming in AppCompat, a lot of assets are tinted automatically for you via theme attributes. That has often led me to wonder "where the hell did this color come from?" You can replace your normal theme with this debug theme to help figure out the source of that color.
<!-- You can change the parent around to whatever you normally use -->
<style name="DebugColors" parent="Theme.AppCompat">
<!-- System colors -->
<item name="android:windowBackground">@color/__debugWindowBackground</item>
<item name="android:colorPressedHighlight">#FF4400</item>
<item name="android:colorLongPressedHighlight">#FF0044</item>
<item name="android:colorFocusedHighlight">#44FF00</item>
<item name="android:colorActivatedHighlight">#00FF44</item>
@shercoder
shercoder / reactviewmemoryleak.txt
Created March 4, 2016 19:46
ReactView leaking context
03-04 11:21:58.523 10153-12159/com.mypackage.myapp D/LeakCanary: In com.mypackage.myapp:1.9.2:41.
03-04 11:21:58.524 10153-12159/com.mypackage.myapp D/LeakCanary: * com.mypackage.myapp.activities.MyReactActivity has leaked:
03-04 11:21:58.524 10153-12159/com.mypackage.myapp D/LeakCanary: * GC ROOT org.chromium.base.SystemMessageHandler.mLooper
03-04 11:21:58.524 10153-12159/com.mypackage.myapp D/LeakCanary: * references android.os.Looper.mThread
03-04 11:21:58.524 10153-12159/com.mypackage.myapp D/LeakCanary: * references thread java.lang.Thread.localValues (named 'main')
03-04 11:21:58.524 10153-12159/com.mypackage.myapp D/LeakCanary: * references java.lang.ThreadLocal$Values.table
03-04 11:21:58.524 10153-12159/com.mypackage.myapp D/LeakCanary: * references array java.lang.Object[].[71]
03-04 11:21:58.524 10153-12159/com.mypackage.myapp D/LeakCanary: * references com.facebook.react.bridge.queue.MessageQueueThreadImpl.mHandler
03-04 11:21:58.524 10153-12159/com.mypackage.myapp D/LeakCanary: * references com.
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"rc-start": "npm start -- --reset-cache",
"clean": "rm -rf $TMPDIR/react-* && watchman watch-del-all && npm cache clean",
"clean-start": "npm run clean && npm run rc-start",
"fresh-install": "rm -rf $TMPDIR/react-* && watchman watch-del-all && rm -rf ios/build/ModuleCache/* && rm -rf node_modules/ && npm cache clean && npm install",
"fresh-start" : "npm run fresh-install && npm run rc-start",
"tron": "node_modules/.bin/reactotron"
}