Skip to content

Instantly share code, notes, and snippets.

@billynyh
billynyh / bootstrap-cdn.html
Created November 8, 2013 01:07
html template with bootstrap 3.0.2 cdn + jquery
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<title>Starter Template for Bootstrap</title>
@billynyh
billynyh / AutoViewPager.java
Created October 30, 2013 08:31
#android AutoViewPager, simply take the children defined in xml as viewpager item [NOT well tested]
public class AutoViewPager extends ViewPager {
public AutoViewPager(Context context, AttributeSet attrs) {
super(context, attrs);
init();
}
public AutoViewPager(Context context) {
super(context);
init();
@billynyh
billynyh / gist:6788951
Created October 2, 2013 03:56
#android CharSequence String SpannableString relation
// CharSequence
String implements CharSequence
SpannableString implements Spannable, CharSequence
SpannableStringBuilder implements Spannable, CharSequence
@billynyh
billynyh / gist:6191512
Created August 9, 2013 06:18
#css textarea 100% width
textarea {
width:100%;
box-sizing: border-box;
}
@billynyh
billynyh / gist:6060003
Created July 23, 2013 05:12
#android screen on without extra permission
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
@billynyh
billynyh / gist:5755405
Created June 11, 2013 08:48
not auto focus edit text when launch view
add this in parent view xml
android:descendantFocusability="beforeDescendants"
android:focusableInTouchMode="true"
or in code
layout.setDescendantFocusability(ViewGroup.FOCUS_BEFORE_DESCENDANTS);
layout.setFocusableInTouchMode(true);
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)
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 = { };
@billynyh
billynyh / bootstrap.html
Created December 24, 2012 07:01
Bootstrap 2.2.2 + font-awesome + jquery cdn quick start template
<!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>
@billynyh
billynyh / gist:4276985
Created December 13, 2012 15:06
android pattern repeat drawable
<?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" />