Skip to content

Instantly share code, notes, and snippets.

View jhaynie's full-sized avatar
🤖
making agents and stuff

Jeff Haynie jhaynie

🤖
making agents and stuff
View GitHub Profile
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<string name="welcome">¡Hola</string>
<string name="format_test">Mi nombre es %s</string>
</resources>
alert(L("welcome"));
alert(Ti.Locale.getString("welcome"));
var message = String.format(L("format_test"),"Jeff");
/**
* 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++)
{
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Check the prerequisites for iPhone development
#
import os, sys, subprocess, re, types
import json, run, tempfile, codecs
template_dir = os.path.abspath(os.path.dirname(sys._getframe(0).f_code.co_filename))
@jhaynie
jhaynie / app.as
Created November 25, 2010 07:17
Prototype of writing a Titanium application using ActionScript 3 natively (instead of JS).
package {
import Titanium.API;
import Titanium.UI;
/**
* Simple Titanium application written in ActionScript 3
*/
public class App
{
@jhaynie
jhaynie / UI.as
Created November 25, 2010 07:24
Titanium.UI AS3 binding file
package Titanium
{
package UI
{
public class Window extends View
{
public native function open ( params : Object = undefined ) : void;
}
}
@jhaynie
jhaynie / app.js
Created November 29, 2010 05:31
translucent navbar
// make the contents of the window nav bar translucent like the iPhone app
var win = Titanium.UI.createWindow({barColor:"transparent",translucent:true});
@jhaynie
jhaynie / app.js
Created June 19, 2013 18:35 — forked from viezel/app.js
// This is an example of use.
// Here we use the new Bearer Token thats make it possible to get tweets without user login
// More info on Bearer here: https://dev.twitter.com/docs/auth/application-only-auth
// Full Codebird API is here: https://github.com/mynetx/codebird-js
var Codebird = require("codebird");
var cb = new Codebird();
cb.setConsumerKey('CONSUMER_KEY', 'CONSUMER_SECRET_KEY');
var bearerToken = Ti.App.Properties.getString('TwitterBearerToken', null);
@jhaynie
jhaynie / spinner.js
Created June 22, 2013 20:22
Console based spinner module in Node.js -- adapted from code in mocha
var sprintf = require('util').format,
timer;
function play(arr, interval) {
var len = arr.length
, interval = interval || 100
, i = 0;
timer = setInterval(function(){
var str = arr[i++ % len];