This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Demo: https://www.youtube.com/watch?v=4GsUf5OQAlI | |
# capture screen of android device | |
andrdroidScreenCapture() { | |
curTime=`date +%Y-%m-%d-%H-%M-%S` | |
tmpeName="$curTime.png" | |
[[ -n $1 ]] && fileName=$1 || fileName=$tmpeName | |
devicePath="/sdcard/$tmpeName" | |
adb shell screencap -p $devicePath | |
adb pull $devicePath $fileName |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
notification="display notification \"$1\" sound name \"\"" | |
if [[ $2 ]]; then | |
notification="$notification with title \"$2\"" | |
fi | |
osascript -e "$notification" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
title() { | |
echo -n -e "\033]0;$@\007" | |
} | |
# usage: | |
# title hello world |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
adb shell dumpsys activity activities | sed -En -e '/Running activities/,/Run #0/p' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# capture screen of android device | |
andrdroidScreenCapture() { | |
curTime=`date +%Y-%m-%d-%H-%M-%S` | |
name="/sdcard/$curTime.png" | |
adb shell screencap -p $name | |
adb pull $name $1 | |
adb shell rm $name | |
} | |
alias asc=andrdroidScreenCapture |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Log.d("IDER", Thread.currentThread().getStackTrace()[2] + "()"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git commit -a --amend --no-edit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Get value from $array with index or indics given by $keyOrKeys. | |
* @param array $array The array to get value from. | |
* @param mixed $keyOrKeys A single key, or a numeric array that contains multiple keys | |
* to fetch from multidimensional array. | |
* Key cound be either numeric or string. | |
* If emtpy array given, the original $array will be returned. | |
* @param mixed $default The default value to be returned if the array dose not contain | |
* given key or midway value is not array type. | |
* @return mixed The value that associated in $array. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NodeList.prototype.forEach = Array.prototype.forEach; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.iderzheng.util; | |
import java.util.HashSet; | |
import java.util.Set; | |
/** | |
* This class represents an generic observer object. | |
* | |
* @author Ider Zheng | |
* @since 10/31/13. |