Skip to content

Instantly share code, notes, and snippets.

View Josh-Miller's full-sized avatar

Josh Miller Josh-Miller

  • Finn Ridge Capital
View GitHub Profile
@Josh-Miller
Josh-Miller / PagingControl.js
Created April 19, 2012 02:19 — forked from raulriera/PagingControl.js
Custom paging control for scrollableViews for Titanium Appcelerator
// I was unhappy about there was close to no control over the "pageControl"
// in scrollableViews, so I hacked my own
// -----
var pages = [];
var page;
var numberOfPages = 0;
// Configuration
var pageColor = "#c99ed5";
@Josh-Miller
Josh-Miller / app.js
Created January 23, 2012 16:19 — forked from aaronksaunders/app.js
posting data with attachment to couchdb using iriscouch and appcelerator
//
// blog.clearlyinnovative.com
// Aaron K. Saunders
// Clearly Innovative Inc
//
var database_url = "http://greenlyyt.iriscouch.com/movie_store/";
var user_name, password;
/** ----------------------------------------------------------------------------
@Josh-Miller
Josh-Miller / Tab.js
Created January 20, 2012 00:02 — forked from lucipacurar/Tab.js
Trying to get a tabgroup based app working
/**
* Loads the Login tab
* @param {Object} instance of the core module
* @param {Object} params Additional parameters
*/
exports.load = function(app, params) {
var tab = Ti.UI.createTab({
title: 'Title'
});
app.activeTabGroup().add(tab);
@Josh-Miller
Josh-Miller / titanium-desktop-dropbox-upload
Created December 5, 2011 04:55 — forked from 1Marc/titanium-desktop-dropbox-upload
Trying to Upload a file to Dropbox through Titanium Desktop
// relevant dropbox threads:
// - http://forums.dropbox.com/topic.php?id=28728&replies=12#post-
// - http://forums.dropbox.com/topic.php?id=31832
// code depends on spazcore.titanium.js (found in Tweetanium)
// SIMPLE WORKING EXAMPLE
var oa = new SpazOAuth("https://api.dropbox.com/", {"consumerKey": DROPBOX_KEY, "consumerSecret": DROPBOX_SECRET});
oa.setAccessToken(ACCESS_TOKEN, ACCESS_SECRET);
@Josh-Miller
Josh-Miller / app.js
Created June 20, 2011 09:24 — forked from dawsontoth/app.js
CSS Injection on External Websites using Appcelerator Titanium
// create our web view
var win = Ti.UI.createWindow({ backgroundColor: "#fff" });
var web = Ti.UI.createWebView({ url: "http://chicago.craigslist.org/" });
// inject our css when the web view finishes loading (because we need to inject into the head element)
web.addEventListener('load', function () {
// first, specify the CSS file that we should load
var cssFileName = 'styles.css';
// read in the contents
var cssFromFile = Ti.Filesystem.getFile(cssFileName);
/* updating functionality */
// 1. install all databases
var eventsDB = Ti.Database.install('dbEvents.sql','events');
eventsDB.close();
var imagesDB = Ti.Database.install('dbImages.sql','events_images');
imagesDB.close();
var venuesDB = Ti.Database.install('dbVenues.sql','venues');
venuesDB.close();
var videosDB = Ti.Database.install('dbVideos.sql','events_videos');
videosDB.close();
@Josh-Miller
Josh-Miller / landing.js
Created May 26, 2011 21:58 — forked from anonymous/landing.js
updating data on first window load
/* UPDATING DATA */
// 1. compare dates in two update files (if OK internet connection)
var update = Titanium.App.Properties.getString('update');
if (Titanium.Network.online && update == 'YES') {
var newUpdatesFile = Titanium.Filesystem.getFile(Titanium.Filesystem.applicationDataDirectory,'newUpdates.txt');
var savedFile = Titanium.Filesystem.getFile(Titanium.Filesystem.applicationDataDirectory+Titanium.Filesystem.separator,'lastUpdated.txt');
var lastUpdatedDate = savedFile.read();
var newUpdatesDate = newUpdatesFile.read();
@Josh-Miller
Josh-Miller / app.js
Created March 21, 2011 16:37 — forked from dasher/app.js
Titanium.UI.setBackgroundColor('#000');
// Create a window
var win = Titanium.UI.createWindow({
title:'Web Test',
backgroundColor:'#fff'
});
// and now a webView
var webview1 = Titanium.UI.createWebView({url:'somePage.html'});
var dataToWrite = {"en_us":{"foo":"bar"}};
//NOTE: remember to use applicationDataDirectory for writes
var newDir = Titanium.Filesystem.getFile(Titanium.Filesystem.applicationDataDirectory,'mydir');
newDir.createDirectory();
Ti.API.info('Path to newdir: ' + newDir.nativePath);
var newFile = Titanium.Filesystem.getFile(newDir.nativePath,'newfile.json');
//Stringify the JavaScript object we created earlier and write it out to the new file