Skip to content

Instantly share code, notes, and snippets.

asyncTest("async test", function(){
//async code and assertions
start();// check asserts
});
test("test plus operator", function(){
equal(1+1, 2, ''test plus operator");
});
module("A");
test("test1", function(){...});
module("B");
test("test2", function(){...});
test("test3", function(){...});
<p id="qunit-testresult" class="result">
Tests completed in 221 milliseconds.<br/>
<span class="passed">232</span> tests of
<span class="total">232</span> passed,
<span class="failed">0</span> failed.
<link type="text/css" rel="stylesheet" href="qunit/qunit.css" />
<script src="jquery-1.7.2.js" type="text/javascript"></script>
<script src="qunit/qunit/qunit.js" type="text/javascript">
@citizenblr
citizenblr / progressbar2.xml
Created November 25, 2013 20:42
Code snippet for "Android & ProgressBar with text" blog post - http://weavora.com/blog/2012/02/23/android-progressbar-with-text/
<com.wvr.widget.TextProgressBar
android:id="@+id/progressBarWithText"
style="@android:style/Widget.ProgressBar.Horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:max="100"
android:maxHeight="30dp"
android:minHeight="30dp"
android:progress="70"
android:progressDrawable="@drawable/progressbar"
@citizenblr
citizenblr / progressbar.xml
Created November 25, 2013 20:41
Code snippet for "Android & ProgressBar with text" blog post - http://weavora.com/blog/2012/02/23/android-progressbar-with-text/
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:id="@android:id/background">
<shape>
<corners android:radius="5dip" />
<gradient
android:angle="270"
android:centerColor="#e7e5e5"
android:centerY="0.75"
android:endColor="#cfcdcd"
android:startColor="#eceaea" />
@citizenblr
citizenblr / TextProgressBar3.java
Created November 25, 2013 20:40
Code snippet for "Android & ProgressBar with text" blog post - http://weavora.com/blog/2012/02/23/android-progressbar-with-text/
package com.wvr.widget;
import com.wvr.example.R;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Rect;
@citizenblr
citizenblr / setAttrs.java
Created November 25, 2013 20:40
Code snippet for "Android & ProgressBar with text" blog post - http://weavora.com/blog/2012/02/23/android-progressbar-with-text/
private void setAttrs(AttributeSet attrs) {
if (attrs != null) {
TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.TextProgressBar, 0, 0);
setText(a.getString(R.styleable.TextProgressBar_text));
setTextColor(a.getColor(R.styleable.TextProgressBar_textColor, Color.BLACK));
setTextSize(a.getDimension(R.styleable.TextProgressBar_textSize, 15));
a.recycle();
}
}
@citizenblr
citizenblr / main.xml
Created November 25, 2013 20:39
Code snippet for "Android & ProgressBar with text" blog post - http://weavora.com/blog/2012/02/23/android-progressbar-with-text/
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:components="http://schemas.android.com/apk/res/com.wvr.widget"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@android:color/white"
android:orientation="vertical"
android:padding="10dp" >
<TextView