View MacLocalServer.md
  • Open Terminal
  • run sudo apachectl start
  • run localhost in your browser and it should be good
  • If you need to make changes to index.html, then go to /Library/WebServer/Documents/ and edit index.html.en
  • If you need to further configure Apache server then sudo vim /etc/apache2/httpd.conf and then sudo apachectl restart
View DrawableHelper.java
import android.content.Context;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.support.annotation.ColorRes;
import android.support.annotation.DrawableRes;
import android.support.annotation.NonNull;
import android.support.v4.content.ContextCompat;
import android.support.v4.graphics.drawable.DrawableCompat;
import android.view.MenuItem;
View url-schemes-settings-ios.mkd

###Note Apple will reject apps that are using private url schemes (Ugh, Apple....) if they are pretty much obvius. Some apps are rejected and others are not, so, be aware of this issue before implementing any of those URL's in your app as a feature.

[UPDATE : Not yet tested in iOS 10. It will fail because of policies changes in URL scheme handling.]

[UPDATE 2:The openURL() method of UIApplication is now deprecated. You should use application(_:open:options:) instead]

##[UPDATE 3: For now you just can use url schemes to open your apps's settings with Swift 3.0 (Xcode 8). I'll keep you informed when OS preferences can be reached]

View react-native-commands.json
"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"
}
View reactviewmemoryleak.txt
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.
View themes-debug.xml
<!-- 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>
View README.md

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
View .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
View mitmproxy_localytics.py
######################################################################
### 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:
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;