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
/**
* Hyperloop Module
* Copyright (c) 2015 by Appcelerator, Inc. and subject to the
* Appcelerator Platform Subscription agreement.
*/
var Hyperloop = require('hyperloop');
var UIView = require('UIView');
var CGRect = require('CGRect');
var CGPoint = require('CGPoint');
@brentonhouse
brentonhouse / Gruntfile.js
Created November 5, 2015 17:04 — forked from grantges/Gruntfile.js
Grunt File for Arrow Publishing (credit goes to Fokke for that one)
var child_process = require('child_process'),
async = require('async');
var REGEXP_VERSIONS = /versions: ((?:(?:, )?[0-9]+\.[0-9]+\.[0-9]+)+)\..+currently: ([0-9]+\.[0-9]+\.[0-9]+)/;
module.exports = function(grunt) {
grunt.initConfig({
spawn: {
bump: {
@brentonhouse
brentonhouse / apphooks.js
Created November 5, 2015 17:08 — forked from grantges/apphooks.js
Appcelerator Titanium - Window Override
/**
* This file would go under the app/lib directory
*/
exports.createWindow = function(params){
var win = Ti.UI.createWindow(params);
win.addEventListener("open", function(e){
@brentonhouse
brentonhouse / index.js
Created November 5, 2015 17:10 — forked from grantges/index.js
A simple example of how to create a basic Widget using Appcelerator Titanium SDK and Alloy. This widget shows how you can create a cross platform view and external interfaces for programmatically setting properties of the widget.
/**
* UnComment Out this Code to change the properties of your square
$.square.setBackgroundColor("blue");
$.square.setHeight(200);
$.square.setWidth(200)
*/
@brentonhouse
brentonhouse / elements.js
Created November 10, 2015 21:17 — forked from jasonkneen/elements.js
In the latest TiAlloy you can specify a module tag against the <Alloy> element in XML and this will be used when creating any elements in the view, so you can override, customise etc. The problem is if you want to use multiple commonJS libraries, there's no support in the Alloy Tag -- you'd have to change the module attribute for each element --…
var o = {};
// include the modules you want - purposely did this as seperate lines so it's easier to comment out modules etc
_.extend(o, require("module1"));
_.extend(o, require("module2"));
_.extend(o, require("module3"));
// make available under a single export for use in <Alloy> tag
module.exports = o;
@brentonhouse
brentonhouse / MyUser.js
Created January 4, 2016 15:24 — forked from lbrenman/MyUser.js
Appcelerator Arrow Two Factor Authentication
var Arrow = require("arrow");
var Model = Arrow.createModel("MyUser",{
"fields": {
"username": {
"type": "String",
"required": true
},
"password": {
"type": "String",
@brentonhouse
brentonhouse / app.js
Created January 4, 2016 15:28 — forked from lbrenman/app.js
Overcoming Cross Site Scripting issue with Node Apps
// initialize app
function start(app, express) {
app.use(express.favicon(__dirname + '/public/images/favicon.ico')); //set favicon
var allowCrossDomain = function(req, res, next) {
res.header('Access-Control-Allow-Origin', '*');
res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE,OPTIONS');
res.header('Access-Control-Allow-Headers', 'Content-Type, Authorization, x-requested-with, X-Titanium-Id');
res.header('Access-Control-Allow-Credentials', 'true');
next();
@brentonhouse
brentonhouse / _readme
Created January 4, 2016 15:34 — forked from lbrenman/_readme
Appcelerator Titanium Hello Push with Rich Push
Basic Titanium Push Demo for iOS and Android
If you pass a URL in the push json payload in the htmlLink field, then the client will display the URL in a webview. This is Rich Push
@brentonhouse
brentonhouse / _readme
Created January 4, 2016 15:34 — forked from lbrenman/_readme
Appcelerator Titanium Hello Alloy Model
Hello Model
Models are useful for updating controls based on data updates. Without models when data changes you need to manually update every control that is associated with the data (e.g. label, tableVIew, …). By binding your controls to a model, you can simply update the model’s data and all the controls will be updated automatically.
Here are the steps for a basic model demo. For reference, the online docs are here:
http://docs.appcelerator.com/platform/latest/#!/guide/Alloy_Data_Binding-section-36739592_AlloyDataBinding-Model-ViewBinding
* Add model and select “properties”