Skip to content

Instantly share code, notes, and snippets.

View johnwatsondev's full-sized avatar
😐

JohnWatsonDev johnwatsondev

😐
  • 工厂
  • Hangzhou
View GitHub Profile
@johnwatsondev
johnwatsondev / uninstall.sh
Created October 25, 2016 07:20 — forked from klarstil/uninstall.sh
Uninstall git on Mac OS X
#!/bin/bash
if [ ! -r "/usr/local/git" ]; then
echo "Git doesn't appear to be installed via this installer. Aborting"
exit 1
fi
echo "This will uninstall git by removing /usr/local/git/**/*, /etc/paths.d/git, /etc/manpaths.d/git"
printf "Type 'yes' if you sure you wish to continue: "
read response
if [ "$response" == "yes" ]; then
sudo rm -rf /usr/local/git/
public class ColoredSnackBar {
private static final int red = 0xfff44336;
private static final int green = 0xff4caf50;
private static final int blue = 0xff2195f3;
private static final int orange = 0xffffc107;
private static View getSnackBarLayout(Snackbar snackbar) {
if (snackbar != null) {
@johnwatsondev
johnwatsondev / DatabaseHelper.java
Created April 6, 2016 07:54
Upgrade/downgrade database without deleting all data from database.
private class DatabaseHelper extends SQLiteOpenHelper {
private static final int FIELD_TYPE_NULL = 0;
private static final int FIELD_TYPE_INTEGER = 1;
private static final int FIELD_TYPE_FLOAT = 2;
private static final int FIELD_TYPE_STRING = 3;
@johnwatsondev
johnwatsondev / material.sh
Created April 6, 2016 07:27 — forked from ahmedre/material.sh
material design icon download helper
#! /bin/bash
# a shell script to make it easier to download images from google's
# material design icons project.
#
# usage:
# sh ~/material.sh -f ic_pause.png https://github.com/google/material-design-icons/blob/master/av/drawable-xxhdpi/ic_pause_white_24dp.png
# by default, it outputs to app/src/main/res/drawable-* in the current
# directory, but you can override with -o.
#
@johnwatsondev
johnwatsondev / migration-guide.md
Created January 8, 2016 11:47 — forked from staltz/migration-guide.md
How to show migration guides in GitHub Markdown

How to show migration guides in GitHub Markdown

Use the diff code highlighting tag.

  ```diff
  - foo
  + bar

Example:

@johnwatsondev
johnwatsondev / get-file-from-android
Created December 11, 2015 14:30 — forked from fdanelyan/get-file-from-android
Get database from root android device to Mac desktop
adb shell "su -c 'chmod 777 /data/data/com.android.providers.telephony/databases/mmssms.db'"
adb shell "su -c 'chmod 777 /data/data/com.android.providers.telephony/databases/telephony.db'"
adb shell "su -c 'chmod 777 /data/data/com.android.providers.contacts/databases/profile.db'"
adb shell "su -c 'chmod 777 /data/data/com.android.providers.contacts/databases/contacts2.db'"
adb pull /data/data/com.android.providers.telephony/databases/mmssms.db /Users/fridondanelyan/Desktop/databases/mmssms.sqlite
adb pull /data/data/com.android.providers.telephony/databases/telephony.db /Users/fridondanelyan/Desktop/databases/telephony.sqlite
adb pull /data/data/com.android.providers.contacts/databases/profile.db /Users/fridondanelyan/Desktop/databases/profile.sqlite
adb pull /data/data/com.android.providers.contacts/databases/contacts2.db /Users/fridondanelyan/Desktop/databases/contacts2.sqlite
@johnwatsondev
johnwatsondev / RxJava.md
Created December 7, 2015 15:30 — forked from cesarferreira/RxJava.md
Party tricks with RxJava, RxAndroid & Retrolambda

View Click

Instead of the verbose setOnClickListener:

RxView.clicks(submitButton).subscribe(o -> log("submit button clicked!"));

Filter even numbers

Observable
    .just(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
@johnwatsondev
johnwatsondev / iterm2.md
Created December 7, 2015 13:38
iterm2 cheatsheet

Tabs and Windows

Function Shortcut
Previous Tab + Left Arrow
Next Tab + Right Arrow
Go to Tab + Number
Go to Window + Option + Number
Go to Split Pane by Direction + Option + Arrow
Go to Split Pane by Order of Use + ] , + [
@johnwatsondev
johnwatsondev / BaseFilterableEasyRecyclerAdapter.java
Created October 20, 2015 08:15 — forked from MFlisar/BaseFilterableEasyRecyclerAdapter.java
EasyAdapter - filterable RecyclerViewAdapter
import android.content.Context;
import java.util.ArrayList;
import java.util.List;
import uk.co.ribot.easyadapter.BaseEasyRecyclerAdapter;
import uk.co.ribot.easyadapter.ItemViewHolder;
public class BaseFilterableEasyRecyclerAdapter<T> extends BaseEasyRecyclerAdapter<T>
{
@johnwatsondev
johnwatsondev / gist:34573db8beba7caa34ee
Created October 10, 2015 08:17 — forked from saetia/gist:1623487
Clean Install – OS X 10.11 El Capitan

OS X Preferences


most of these require logout/restart to take effect

# Enable character repeat on keydown
defaults write -g ApplePressAndHoldEnabled -bool false

# Set a shorter Delay until key repeat