This file contains hidden or 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
| /** | |
| * XMLToJS Module 0.1 | |
| * | |
| * To use: | |
| * var XMLToJS = require('xmlToJS'); | |
| * var jsObject = XMLToJS.convert(xml); | |
| * | |
| * This will take XMl like the following: | |
| * | |
| <atom:feed xmlns:atom="http://www.w3.org/2005/Atom"> |
This file contains hidden or 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 log = require("/api/Log"); | |
| var os = Ti.Platform.osname; | |
| // The TiShadow build of the Titanium SDK does not cache CommonJS modules loaded | |
| // from the applicationDataDirectory. This is so that if an update to the app is | |
| // deployed, i.e. a file in the applicationDataDirectory is modified, the changes | |
| // while be loaded. That said loading a CommonJS module every time that it is loaded | |
| // make the deployed bundle run slowly. So we will manage the caching of those | |
| // modules here in the code. |
This file contains hidden or 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: '#333' | |
| }); | |
| var menuWidth = 200; | |
| var container = Ti.UI.createScrollView({ | |
| disableBounce: false, | |
| horizontalBounce: true, | |
| contentWidth: Ti.Platform.displayCaps.platformWidth + menuWidth |
This file contains hidden or 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
| #!/usr/bin/env ruby -w | |
| # pnginator.rb: pack a .js file into a PNG image with an HTML payload; | |
| # when saved with an .html extension and opened in a browser, the HTML extracts and executes | |
| # the javascript. | |
| # Usage: ruby pnginator.rb input.js output.png.html | |
| # By Gasman <http://matt.west.co.tt/> | |
| # from an original idea by Daeken: http://daeken.com/superpacking-js-demos |
This file contains hidden or 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
| "use strict"; | |
| // `f` is assumed to sporadically fail with `TemporaryNetworkError` instances. | |
| // If one of those happens, we want to retry until it doesn't. | |
| // If `f` fails with something else, then we should re-throw: we don't know how to handle that, and it's a | |
| // sign something went wrong. Since `f` is a good promise-returning function, it only ever fulfills or rejects; | |
| // it has no synchronous behavior (e.g. throwing). | |
| function dontGiveUp(f) { | |
| return f().then( | |
| undefined, // pass through success |
This file contains hidden or 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
| i386 : iPhone Simulator | |
| x86_64 : iPhone Simulator | |
| arm64 : iPhone Simulator | |
| iPhone1,1 : iPhone | |
| iPhone1,2 : iPhone 3G | |
| iPhone2,1 : iPhone 3GS | |
| iPhone3,1 : iPhone 4 | |
| iPhone3,2 : iPhone 4 GSM Rev A | |
| iPhone3,3 : iPhone 4 CDMA | |
| iPhone4,1 : iPhone 4S |
This file contains hidden or 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 cancelableRequest = function (url) { | |
| var xhr = new XMLHttpRequest(); | |
| var deferred = Q.defer(); | |
| function onload() { | |
| if (xhr.status === 200 || xhr.status === 0 && xhr.responseText) { | |
| deferred.resolve(xhr.responseText); | |
| } else { | |
| onerror(); | |
| } |
This file contains hidden or 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
| /* | |
| modified from original source: https://bitbucket.org/mattkotsenas/c-promises/overview | |
| */ | |
| using System; | |
| using System.Collections.Generic; | |
| using System.Linq; | |
| using System.Text; | |
| namespace Promises |
This file contains hidden or 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
| exports.definition = | |
| config: | |
| adapter: | |
| type: "rest" | |
| name: "Agent" | |
| extendModel: (Model) -> | |
| _.extend Model::, | |
| url: -> |
This file contains hidden or 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 are the tests I am running against the adapter | |
| // https://gist.github.com/aaronksaunders/4722895 | |
| // | |
| // aaron@clearlyinnovative.com | |
| // | |
| function SQLiteMigrateDB(config) { | |
| this.dbname = config.adapter.db_name; | |
| this.table = config.adapter.collection_name; |