Skip to content

Instantly share code, notes, and snippets.

View jbalthis's full-sized avatar
:octocat:
coding

Jason Balthis jbalthis

:octocat:
coding
View GitHub Profile
var win1 = Titanium.UI.createWindow({
title:'Tab 1',
backgroundColor:'#fff',
layout: 'vertical'
});
var bt1 = Ti.UI.createButton({title: 'send message (method 1)', top: 200});
bt1.addEventListener('click', function(e)
@jbalthis
jbalthis / app.js
Created February 7, 2014 18:41 — forked from dawsontoth/app.js
Ti.include('overrideTabs.js');
/*
This is a typical new project -- a tab group with three tabs.
*/
var tabGroup = Ti.UI.createTabGroup();
/*
Tab 1.
/* Window and View Styling */
'.container': {
height: Ti.UI.FILL,
width: Ti.UI.FILL,
backgroundColor: 'white'
}
/* TabGroup styling */
'#tabGroup':{
var win1 = Titanium.UI.createWindow({
title:'Tab 1',
backgroundColor:'#fff',
layout: 'vertical'
});
var bt1 = Ti.UI.createButton({title: 'send message (method 1)', top: 200});
bt1.addEventListener('click', function(e)
function doClickMenu(evt){
alert(evt.source.title);
}
// we need to do some things to the Window once it is properly instanciated, so we add an event listener to its OPEN event
$.win.addEventListener('open',function(){
var actionBar = $.win.activity.actionBar; // get a handle to the action bar
actionBar.title='My App'; // change the App Title
actionBar.displayHomeAsUp=true; // Show the "angle" pointing back
actionBar.onHomeIconItemSelected = function() { // what to do when the "home" icon is pressed
@jbalthis
jbalthis / app.js
Created February 26, 2014 01:21 — forked from aaronksaunders/app.js
var get_file = function(url, callback) {
var xhr = Ti.Network.createHTTPClient({
onload: function(e) {
// this function is called when data is returned from the server and available for use
// this.responseText holds the raw text return of the message (used for text/JSON)
// this.responseXML holds any returned XML (including SOAP)
// this.responseData holds any returned binary data
console.log('downloaded '+ url);
callback({

TiAgent

Ti Agent is light-weight progressive ajax API crafted for flexibility, readability, and a low learning curve after being frustrated with many of the existing request APIs.

 request
   .post('/api/pet')
   .data({ name: 'Manny', species: 'cat' })
   .set('X-API-Key', 'foobar')
   .set('Accept', 'application/json')

.end(function(res){

@jbalthis
jbalthis / app.js
Created February 26, 2014 01:25 — forked from aaronksaunders/app.js
// create model factory, pass in Alloy global object
var MODELS = new (require('models').MODELS)(Alloy);
var person = new MODELS.Person({
"name" : "Reina Saunders",
"age" : 2
});
person.save(null, {
"success" : function(_m, _r) {
@jbalthis
jbalthis / footerjs.html.twig
Created April 30, 2014 19:47
An example of how to include JavaScript in a Twig template
{# An example of how to include JavaScript in a Twig template #}
{# This example includes yuicompression, as well jquery, jquery-ui, and bootstrap integration #}
{# Also includes an inline js example and is perfectly suited for assetic management #}
{# BEGIN CODE #}
{% block footer_scripts %}
{% javascripts
'js/jquery.js'
@jbalthis
jbalthis / head.html.twig
Created April 30, 2014 19:58
An example of including external css stylesheets as well as local styles in a Twig template
{# An example of including external css stylesheets as well as local styles in a Twig template #}
{# Incorporates bootstrap, jquery, and jquery-ui stylesheets #}
{# Also illustrates how to have a dynamic title inserted into each page by Twig #}
<head>
{% block head %}
<meta charset="UTF-8" />
{% block head_style %}
{% stylesheets