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
// The bug | |
if ([requestMethod isEqualToString:@"GET"] || [requestMethod isEqualToString:@"DELETE"] || [requestMethod isEqualToString:@"HEAD"]) { | |
[self setRequestMethod:@"POST"]; | |
} | |
// Why not just | |
if ([requestMethod isEqualToString:@"GET"]) { | |
[self setRequestMethod:@"POST"]; | |
} |
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 attr = Ti.UI.iOS.createAttributedString({ | |
text: text, | |
attributes: [ | |
// Underlines text | |
{ | |
type: Ti.UI.iOS.ATTRIBUTE_UNDERLINES_TYLE, | |
value: Ti.UI.iOS.ATTRIBUTE_UNDERLINE_STYLE_SINGLE | Ti.UI.iOS.ATTRIBUTE_UNDERLINE_PATTERN_DASH_DOT_DOT, | |
range: [0, text.length] | |
}, |
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 win = Ti.UI.createWindow({ | |
backgroundColor: 'white' | |
}); | |
var pages = []; | |
// Helper to generate a sample form | |
function buildPage() { | |
var wrapper = Ti.UI.createView({ | |
layout: "vertical" |
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
static BOOL isLoaded; | |
/** | |
Singleton, shared instance | |
**/ | |
+ (id)sharedInstance | |
{ | |
__strong static id _sharedObject = nil; | |
if(isLoaded == NO) { |
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
{ | |
"backgroundImage": "sunny", | |
"location": "Hertfordshire, United Kingdom", | |
"current": { | |
"tempC": 22, | |
"tempF": 72, | |
"icon": "sunny", | |
"observationTime": "02:12 PM", | |
"description": "Sunny", | |
"shortDescription": "Sunny", |
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
/** | |
* Generates the column data | |
*/ | |
$.generateColumn = function() { | |
var numbers = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0]; | |
var labels = []; | |
numbers.forEach(function(_number) { | |
labels.push( | |
Ti.UI.createLabel({ |
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
// Selecting based on total document | |
var selectedUnits = document.querySelectorAll("[data-selected='selected']"); |
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
Ti.App.addEventListener("playSound", function(_event) { | |
var soundPlayer = Ti.Media.createSound({ | |
url: "/game/" + _event.soundFile | |
}); | |
soundPlayer.play(); | |
soundPlayer.addEventListener("complete", function() { | |
if(OS_ANDROID) { | |
soundPlayer.release(); | |
} |
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
/** | |
* Global singleton | |
*/ | |
var APP = { | |
/** | |
* This sets up global events, persistant things | |
* throughout the app, etc. Only should be called | |
* when the app is booted. | |
*/ |
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 RedLaser = require('ti.redlaser'); | |
var win = Ti.UI.createWindow({ | |
backgroundColor: "#eee" | |
}); | |
var startScanningBtn = Ti.UI.createButton({ | |
width: "50%", | |
height: 50, | |
title: "Start Scanning" |