Skip to content

Instantly share code, notes, and snippets.

@nathanpc
nathanpc / simple_target_server.dart
Created April 15, 2012 13:34
Simple Target Server
#import("dart:io");
#import("Target.dart");
void main() {
var Target = new Target();
File script = new File(new Options().script);
script.directory((Directory d) {
Target.createServer(d.path + "/public", 8800);
@nathanpc
nathanpc / init.js
Created May 27, 2012 14:38
Post: How To Setup And Use NativeControls In PhoneGap
nativeControls = window.plugins.nativeControls;
nativeControls.createTabBar();
@nathanpc
nathanpc / create_tab.js
Created May 27, 2012 14:39
Post: How To Setup And Use NativeControls In PhoneGap
nativeControls.createTabBarItem(
"books",
"Books",
"/www/tabs/book.png",
{"onSelect": function() {
// Do something
}}
);
@nathanpc
nathanpc / show_tabbar.js
Created May 27, 2012 14:39
Post: How To Setup And Use NativeControls In PhoneGap
nativeControls.showTabBar();
nativeControls.showTabBarItems("books", "finished", "about");
nativeControls.selectTabBarItem("books");
@nathanpc
nathanpc / index.html
Created May 27, 2012 14:35
Post: How To Setup And Use NativeControls In PhoneGap
<script src="phonegap-1.0.0.js" type="text/javascript" charset="utf-8"></script>
<script src="NativeControls.js" type="text/javascript" charset="utf-8"></script>
@nathanpc
nathanpc / main.js
Created June 9, 2012 19:57
Wrong onscreenready Example
bb.init({
onscreenready: function (element, id) {
if (id == "main") {
var item = document.createElement('div');
item.setAttribute('data-bb-type','item');
item.setAttribute('data-bb-title','my title');
item.innerHTML = 'my description';
item.setAttribute('data-bb-img','foo.png');
document.getElementById('mylist').appendItem(item);
@nathanpc
nathanpc / index.html
Created June 9, 2012 19:53
image-list item declaration
<div data-bb-type="item" data-bb-title="Title goes here" data-bb-img="images/test.png" onclick="alert('this was clicked')">A description is welcome.</div>
@nathanpc
nathanpc / main.js
Created June 9, 2012 19:56
bb.init() Example
bb.init({
onscreenready: function (element, id) {
if (id == "main") {
// code to be executed before the "main" screen is loaded.
} else if (id == "add") {
// code to be executed before the "add" screen is loaded.
}
},
ondomready: function (element, id) {
if (id == "main") {
@nathanpc
nathanpc / main.js
Created June 9, 2012 19:58
Correct onscreenready Example
bb.init({
onscreenready: function (element, id) {
if (id == "main") {
var item = element.createElement('div');
item.setAttribute('data-bb-type','item');
item.setAttribute('data-bb-title','my title');
item.innerHTML = 'my description';
item.setAttribute('data-bb-img','foo.png');
element.getElementById('mylist').appendItem(item);
@nathanpc
nathanpc / index.html
Created June 9, 2012 19:55
Processed image-list item
<div data-bb-type="item" onclick="alert('this was clicked')" class="bb-hires-image-list-item" onmouseover="this.setAttribute('class','bb-hires-image-list-item-hover')" onmouseout="this.setAttribute('class','bb-hires-image-list-item')" x-blackberry-focusable="true"><img src="images/test.png">
<div class="details">
<span class="title">Title goes here</span>
<span class="accent-text"></span>
<div class="description">A description is welcome.</div>
</div>
</div>