This file contains 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
// home intent | |
adb shell am start -c android.intent.category.HOME -a android.intent.action.MAIN |
This file contains 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
# recursive cat | |
find . -name '*.php' | xargs wc -l | |
# format json | |
echo '{"json":"obj"}' | python -mjson.tool | |
# git diff | |
git difftool --tool=tkdiff --no-prompt | |
# grep |
This file contains 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
// iosched/android/src/com/google/android/apps/iosched/ui/HomeActivity.java | |
@Override | |
protected void onSaveInstanceState(Bundle outState) { | |
super.onSaveInstanceState(outState); | |
// Since the pager fragments don't have known tags or IDs, the only way to persist the | |
// reference is to use putFragment/getFragment. Remember, we're not persisting the exact | |
// Fragment instance. This mechanism simply gives us a way to persist access to the | |
// 'current' fragment instance for the given fragment (which changes across orientation |
This file contains 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
from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice, MonkeyImage | |
import datetime | |
def capture_and_save(fname): | |
device = MonkeyRunner.waitForConnection() | |
snapshot = device.takeSnapshot() | |
snapshot.writeToFile(fname) | |
def capture(prefix=""): | |
d = datetime.datetime.now() |
This file contains 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
//http://stackoverflow.com/questions/1705239/how-should-i-give-images-rounded-corners-in-android | |
import android.content.Context; | |
import android.graphics.Canvas; | |
import android.graphics.Path; | |
import android.graphics.RectF; | |
import android.util.AttributeSet; | |
import android.util.Log; | |
import android.widget.ImageView; |
This file contains 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
<?xml version="1.0" encoding="utf-8"?> | |
<bitmap xmlns:android="http://schemas.android.com/apk/res/android" | |
android:src="@drawable/leather_1" | |
android:tileMode="repeat" /> |
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Bootstrap 2.2.2 Template</title> | |
<!-- Bootstrap --> | |
<link href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.2/css/bootstrap.no-icons.min.css" rel="stylesheet"> | |
<link href="http://netdna.bootstrapcdn.com/font-awesome/2.0/css/font-awesome.css" rel="stylesheet"> | |
<script src="http://code.jquery.com/jquery-latest.js"></script> | |
<script src="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.2/js/bootstrap.min.js"></script> |
This file contains 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
var $ = require('jquery'); | |
var http = require('http'); | |
var Sync = require('sync'); | |
var URIjs = require('./URI.js'); // http://medialize.github.com/URI.js/ | |
var fs = require('fs'); | |
var DEBUG = false; | |
var INFO = true; | |
var Log = { }; |
This file contains 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
from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice, MonkeyImage | |
import time | |
def scroll(n): | |
device = MonkeyRunner.waitForConnection() | |
for i in range(n): | |
print i | |
device.drag((216, 500), (216, 200), 0.1, 100) | |
time.sleep(0.5) | |
scroll(10000) |
This file contains 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
add this in parent view xml | |
android:descendantFocusability="beforeDescendants" | |
android:focusableInTouchMode="true" | |
or in code | |
layout.setDescendantFocusability(ViewGroup.FOCUS_BEFORE_DESCENDANTS); | |
layout.setFocusableInTouchMode(true); |