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
//Create a container view | |
var container = Ti.UI.createView({ | |
width:200, | |
height:200, | |
top:10, | |
left:10 | |
}); | |
//Create a drop shadow view | |
var shadow = Ti.UI.createView({ |
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
//Here's the first window... | |
var first = Ti.UI.createWindow({ | |
backgroundColor:"#fff", | |
title:"My App" | |
}); | |
var label = Ti.UI.createLabel({ text: "poke me to open the next window" }); | |
first.add(label); | |
//Here's the nav group that will hold them both... | |
var navGroup = Ti.UI.iPhone.createNavigationGroup({ |
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 Pool = Base(EventEmitter, { | |
init: function(getConnection, size) { | |
this._super(); | |
this._pool = []; | |
this._queue = []; | |
this.size = size; | |
var me = this; | |
getConnection(size, function(conn) { | |
me.emit('back', conn); | |
}); |
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
// create tab group | |
var tabGroup = Titanium.UI.createTabGroup(); | |
///////////////////////// | |
// create base UI tab and root window | |
// We need a tabBar to be able to win.setToolbar items, even though we'll hide it | |
///////////////////////// | |
var win = Titanium.UI.createWindow({ | |
title:'TweetFlow', |
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
/** | |
* Simple demo for adding swipe detection on a table view row. Since the row is simply a container | |
* of views, you'll want to generally create a hidden view the size of the row and add your swipe listener | |
* to this view for detection. We need to improve Titanium so you don't have to do this in the future... | |
*/ | |
var win = Ti.UI.createWindow(); | |
var data = []; | |
for (var c=0;c<10;c++) | |
{ |
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 assert = require('assert') | |
, subclass = function(type, proto){ | |
// make sure we are extending a global constructor | |
// accepted: [Boolean, Number, String, Array, Object, Function, RegExp, Date] | |
if(!global[type.name] || global[type.name].name != type.name) throw new Error(); | |
var constructor = proto.constructor, | |
keys = Object.keys(proto), | |
Obj = process.binding('evals').Script.runInNewContext('x = '+type.name), // eval ftw |
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
// Kosso imageAsCropped | |
// added to TiBlob.m | |
// requires 4 arguments : x, y, width, height | |
- (id)imageAsCropped:(id)args | |
{ | |
[self ensureImageLoaded]; | |
if (image!=nil) | |
{ | |
ENSURE_ARG_COUNT(args,4); |
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
<? | |
/* | |
* This example would probably work best if you're using | |
* an MVC framework, but it can be used standalone as well. | |
* | |
* This example also assumes you are using Predis, the excellent | |
* PHP Redis library available here: | |
* https://github.com/nrk/predis | |
*/ |
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
// Target API: | |
// | |
// var s = require('net').createStream(25, 'smtp.example.com'); | |
// s.on('connect', function() { | |
// require('starttls')(s, options, function() { | |
// if (!s.authorized) { | |
// s.destroy(); | |
// return; | |
// } | |
// |
OlderNewer