Execute "tishadow run" in your Titanium app directory whenever a JavaScript file changes. Edit your JS files in a text editor, save, then switch to the test device or simulator. Profit.
[sudo] npm install -g supervisor
| // 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); |
| function isProduction(alloyConfig) | |
| { | |
| return 'production' == alloyConfig.deploytype; | |
| } | |
| function removeUnimportantLogCallsFromContent(content) | |
| { | |
| if (!content) { | |
| return; | |
| } |
| // Handle back button issues with Twitter Bootstrap's tab component. | |
| // Based on: http://stackoverflow.com/a/10120221/81769 | |
| // It has been changed to avoid the following side effects: | |
| // - Switching tabs was being added to navigation history which is undesirable | |
| // (Worked around this by using location.replace instead of setting the hash property) | |
| // - Browser scroll position was lost due to fragment navigation | |
| // (Worked around this by converting #id values to #!id values before navigating.) | |
| $(document).ready(function () { | |
| if (location.hash.substr(0,2) == "#!") { |
Execute "tishadow run" in your Titanium app directory whenever a JavaScript file changes. Edit your JS files in a text editor, save, then switch to the test device or simulator. Profit.
[sudo] npm install -g supervisor
| // I'm using this now in my Alloy runtime testing to assert that the | |
| // proper styles are getting assigned to Titanium proxy objects. The | |
| // deep comparison is necessary for objects like font in the style. So | |
| // for my purposes the accuracy of the results far supercedes the lack | |
| // of blazing performance with this code. I'm using underscore.js as | |
| // it's part of Alloy, but isX() calls could easily be filled out in | |
| // a couple lines of JS. | |
| // | |
| // Obviously due to the use of JSON.stringify() the objects to be | |
| // compared need to be JSON serializable. |
I guess just like me you like to do alert('My message'); instead of:
Ti.UI.createAlertDialog({
message: 'My message'
}).show();
But I'd even more like to do alert('My message', 'My title', myCallback); instead of:
Often I need to display a user-provided picture in an ImageView in such a way that the whole ImageView is filled with as much of the picture possible.
This is how I do it:
var image = require('image');
Ti.Media.showCamera({
mediaTypes: [Ti.Media.MEDIA_TYPE_PHOTO],
success: function (e) {
I like easy drop-in CommonJS libraries that need minimal configuration to perform common tasks.
This CommonJS library checks with Apple every X days to see if there's a new version available. If so, it asks the user if he/she would like to update and then opens the app in the App Store.
At minimum, the library requires no configuration at all and just a single line of code.
Look at advanced.js for all available options and methods.
Also check out my rating library: