Skip to content

Instantly share code, notes, and snippets.

View brentonhouse's full-sized avatar
🚀
Busy being awesome!

Brenton House brentonhouse

🚀
Busy being awesome!
View GitHub Profile
//single calls over bridge
var osname = Ti.Platform.osname,
version = parseInt(Ti.Platform.version);
//simple boolean checks
var isandroid = function() {
return osname === 'android';
};
var isios = function() {
// Prototype version:
// Ti.include('prototype.js');
// Module version:
// Ti.include('module.js');
// Factory version:
Ti.include('factory.js');
var win = Ti.UI.createWindow({
var _ = require('/lib/underscore');
/*
*This is the lightweight version I use based on Kevin Whinnery's one: https://gist.github.com/kwhinnery/1595307
* Wrapper for Titanium UI components. This wrapper provides a few pieces of critical
* functionality, currently missing from Titanium UI objects:
* - The ability to safely extend components with new members
* - Rudimentary resource management and object lifecycle handling
*
/*
* Mixin properties of n objects into the given object - pass in as many objects to mix in as you like.
* Can perform a shallow or deep copy (shallow is default for performance reasons).
*
* Usage:
* mixin([Boolean deepCopy,] objectToExtend, objectToMixIn [, as many other objects as needed])
*
* Examples:
*
* var o1 = {
/* Put this file in <product dir>/plugins/appid/hooks/
* then add this to your tiapp.xml:
* <plugins>
* <plugin>appid</plugin>
* </plugins>
*/
exports.cliVersion = '>=3.2.1';
exports.init = function (logger, config, cli, appc) {
function compile(TypeScript, logger, sourcefilename){
var _this = this;
var ByteOrderMark = {};
ByteOrderMark[ByteOrderMark["None"] = 0] = "None";
ByteOrderMark[ByteOrderMark["Utf8"] = 1] = "Utf8";
ByteOrderMark[ByteOrderMark["Utf16BigEndian"] = 2] = "Utf16BigEndian";
ByteOrderMark[ByteOrderMark["Utf16LittleEndian"] = 3] = "Utf16LittleEndian";
var FileInformation = (function () {
@brentonhouse
brentonhouse / cache.js
Last active August 29, 2015 14:07 — forked from rblalock/cache.js
/**
* Caching functions class
* @class Cache
*/
var Moment = require("alloy/moment");
var directory;
exports.valid = function (_url) {
var fileName = _url.replace(/[^\w\d]/g, "");
var Win = Ti.UI.createWindow({
title: "My Message",
});
var ScrollView = Ti.UI.createScrollView({
height: Ti.UI.FILL,
width: Ti.UI.FILL,
contentHeight: "100%",
contentWidth: "100%",
});
/**
* Global singleton
*/
var APP = {
/**
* This sets up global events, persistant things
* throughout the app, etc. Only should be called
* when the app is booted.
*/
@brentonhouse
brentonhouse / swipe.js
Last active August 29, 2015 14:07 — forked from rblalock/swipe.js
// Custom swipe detection for table rows (since technically the "swipe"
// event doesn't apply to individual rows but rather the table. This way we
// don't have to assign a swipe event for each row. One event to manage
// them all is more performant.
var TOUCH_X = 0;
$.list.addEventListener("touchstart", function(e) {
TOUCH_X = e.x;
});
$.list.addEventListener("touchend", function(e) {
if(e.x > (TOUCH_X + 44)) {