Skip to content

Instantly share code, notes, and snippets.

[
{
"conditions": "Partly cloudy",
"day": "Monday",
"temperature": 20
},
{
"conditions": "Showers",
"day": "Tuesday",
"temperature": 22
@j796160836
j796160836 / RemoveGitignoreFiles.sh
Created August 31, 2016 10:41
Strip out files defined in .gitignore on git repo
#!/bin/bash
# Referance: http://stackoverflow.com/questions/13541615/how-to-remove-files-that-are-listed-in-the-gitignore-but-still-on-the-repositor
git ls-files -i --exclude-from=.gitignore | xargs git rm --cached
@j796160836
j796160836 / DummyAndroidTextUtilsMockTest.java
Created August 14, 2016 07:58 — forked from daddykotex/DummyAndroidTextUtilsMockTest.java
Mock Android TextUtils static method
import android.text.TextUtils;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
請將下列語法 "取代" <body>
<body ONDRAGSTART="window.event.returnValue=false" onSelectStart="event.returnValue=false" ONCONTEXTMENU="window.event.returnValue=false" >
=================================
鎖滑鼠右鍵及防highlight
<body onselectstart="return false;" ondragstart="return false;" oncontextmenu="return false;">
======================
@j796160836
j796160836 / StartAndroidAutoDesktopHeadUnit.sh
Created May 23, 2016 09:14
Start Android Auto emulator (desktop head unit)
#!/bin/bash
adb forward tcp:5277 tcp:5277
$ANDROID_HOME/extras/google/auto/desktop-head-unit
@j796160836
j796160836 / AdbPressHome.sh
Created May 23, 2016 09:12
Use ADB command to bring up home launcher. (equals home button press)
#!/bin/bash
adb shell am start -c android.intent.category.HOME -a android.intent.action.MAIN
@j796160836
j796160836 / genymotionwithplay.txt
Created May 18, 2016 06:58 — forked from wbroek/genymotionwithplay.txt
Genymotion with Google Play Services
Download the following ZIPs:
ARM Translation Installer v1.1 (http://www.mirrorcreator.com/files/0ZIO8PME/Genymotion-ARM-Translation_v1.1.zip_links)
Download the correct GApps for your Android version:
Google Apps for Android 6.0 (https://www.androidfilehost.com/?fid=24052804347835438 - benzo-gapps-M-20151011-signed-chroma-r3.zip)
Google Apps for Android 5.1 (https://www.androidfilehost.com/?fid=96042739161891406 - gapps-L-4-21-15.zip)
Google Apps for Android 5.0 (https://www.androidfilehost.com/?fid=95784891001614559 - gapps-lp-20141109-signed.zip)
Google Apps for Android 4.4.4 (https://www.androidfilehost.com/?fid=23501681358544845 - gapps-kk-20140606-signed.zip)
Google Apps for Android 4.3 (https://www.androidfilehost.com/?fid=23060877490000124 - gapps-jb-20130813-signed.zip)
@j796160836
j796160836 / AdbInputText.sh
Created March 23, 2016 04:38
Input text via ADB
#!/bin/bash
adb shell input text $1
@j796160836
j796160836 / AdbGoToSettings.sh
Created March 23, 2016 04:35
Go to app's settings page via ADB
#!/bin/bash
adb shell am start -a android.settings.APPLICATION_DETAILS_SETTINGS -d package:$1
@j796160836
j796160836 / InspectAPK.sh
Last active February 22, 2022 16:46
Inspect APK's info like package name, version code, version name, etcetera
#!/bin/bash
apk_file=$1
if [ -z $apk_file ]; then
apk_file_num=`ls *.apk | wc -l | tr -d ' '`
if [ $apk_file_num -gt 1 ]; then
echo "Ambiguous apk_files. Please enter one APK to inspect."
exit -1
fi
apk_file=`ls *.apk`