Skip to content

Instantly share code, notes, and snippets.

@ntkachov
ntkachov / materialDownloader
Created November 12, 2016 23:38
Download icons from material library
#bin/bash
color=black
dp=48
fileArray=()
while test $# != 0
do
case "$1" in
-w) color=white;;
@ntkachov
ntkachov / .bash_profile
Created August 23, 2016 18:42
Bash Profile
alias adb='~/Library/Android/sdk/platform-tools/adb'
alias emulator='~/Library/Android/sdk/tools/emulator'
alias adbr='adb kill-server; sleep 1; adb start-server'
@ntkachov
ntkachov / CustomFontTabLayout.java
Last active November 9, 2015 20:57
Use this layout as a custom view inside a TabLayout.Tab to keep setText and setIcon working as usual
public class CustomFontTabLayout extends TabLayout {
public CustomFontTabLayout(Context context) {
super(context);
}
public CustomFontTabLayout(Context context, AttributeSet attrs) {
super(context, attrs);
}
@ntkachov
ntkachov / Android studio commands
Last active August 29, 2015 14:16
Increase Android Studio memory
#Note: Change the values to your system. On my 4Gb Ram MacBook Air, I use
#-Xms:128m -Xmx1250m XX:MaxPermSize=350m -XX:ReservedCodeCacheSize=96m
#These values are for a 16Gb ram Mac
#Run this for the standard android studio
echo -e "-Xms1g \n-Xmx8g \n-XX:MaxPermSize=1g \n-XX:ResevedCodeCacheSize=500m" > ~/Library/Preferences/AndroidStudio/studio.vmoptions
#Run this for Android Studio 1.2 preview
echo -e "-Xms1g \n-Xmx8g \n-XX:MaxPermSize=1g \n-XX:ResevedCodeCacheSize=500m" > ~/Library/Preferences/AndroidStudioPreview1.2/studio.vmoptions
@ntkachov
ntkachov / HVPROTO
Last active August 29, 2015 14:15
Connect to Android Heirarchy Viewer on a production device with a debuggable app.
export ANDROID_HVPROTO=ddm; ./sdk/tools/hierarchyviewer2
@ntkachov
ntkachov / saulmm.github.io
Created February 20, 2015 18:00
Vector drawable in AndroidL [Credit to http://saulmm.github.io/]
An this, its implementation with a VectorDrawable
vd_star.xml
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:viewportWidth="400"
android:viewportHeight="400"
android:width="300px"
android:height="300px">
@ntkachov
ntkachov / gist:89d37311dc70c6d876a9
Created November 7, 2014 21:05
Difference between master and your branch
git cherry master | grep -v - | cut -d ' ' -f2 | xargs -n 1 git --no-pager show -s --format='%H %an <%ae> %ad'
@ntkachov
ntkachov / SkitchVersionChecker.java
Last active December 27, 2015 09:59
Gist to check if Skitch is installed and supports the Action_Edit intent
public class SkitchVersionChecker {
private static final String SKITCH_PACKAGE = "com.evernote.skitch";
private static final String TAG = "Skitch Checker";
/**Build the intent to send to send the edit intent to skitch.
* If Skitch is not installed or isn't up to date, it will take
* the user to the market and ask them to install skitch.
* @param context expects an activity context (not an application context)