Skip to content

Instantly share code, notes, and snippets.

View grantges's full-sized avatar

Bert Grantges grantges

  • Austin, Tx - United States
View GitHub Profile
Alloy.Collections.flights = Alloy.createCollection('flight');
@grantges
grantges / sphero.js
Created June 23, 2016 22:50
An Appcelerator Hyperloop module (Android) for working with the Sphere robot
var ConvenienceRobot = require('com.orbotix.ConvenienceRobot');
var DualStackDiscoveryAgent = require('com.orbotix.DualStackDiscoveryAgent');
var Robot = require('com.orbotix.common.Robot');
var DiscoveryException = require('com.orbotix.common.DiscoveryException');
var RobotChangedStateListener = require('com.orbotix.common.RobotChangedStateListener');
var RobotLE = require('com.orbotix.le.RobotLE');
var Context = require('android.content.Context');
var DeviceSensorAsyncMessage = require('com.orbotix.async.DeviceSensorAsyncMessage');
var ConfigureLocatorCommand = require('com.orbotix.command.ConfigureLocatorCommand');
var ResponseListener = require('com.orbotix.common.ResponseListener');
var Arrow = require('arrow');
var TestAPI = Arrow.API.extend({
group: 'testapi',
path: '/api/testapi/:id',
method: 'GET',
description: 'this is an api that shows how to implement an API',
model: 'testuser',
before: 'responseFormatBlock', // <-- Here is how you would add this to the API
parameters: {
@grantges
grantges / README.md
Created April 18, 2016 13:58
Titanium TSS for Transparent NavigationBar / Shadow on iOS

Creating a transparent NavigationBar using Titanium Style Sheets

Appcelerator Titanium offers many ways to style the navigation bar for iOS apps, from changing out the title view all together, or just using simple colors. However, one of the most frequent requests I hear is how to make a truly transparent NavigationBar. This tutorial will cover that.

Getting started

Lets start with a pretty simple window style in the app.tss. This will ensure that the window style is applied globally.

Note: This can be used in a specific controller *.tss file if you only want this effect on a particular window.

@grantges
grantges / README.md
Last active March 1, 2016 14:20
Example Blocks for Appcelerator Arrow APIs

Block Examples for Appcelerator Arrow App

forwardgeocoder

Arrow Block for fetching latitude / longitude from an address ("borrowed" with pride from Leor Brenman)

Requires a Google API Key

  • Navigate to https://console.developers.google.com (you may need to create an account)
  • Click Enable APIs and get credentials like keys
  • Expand the More link under Google Maps APIs
  • Click Google Maps Geocoding API
@grantges
grantges / index.js
Created February 12, 2016 15:03
Cleaning Up Subviews in Appcelerator Titanium
$.index.open();
var subViews = [];
function _doSomething(){
alert('Something!');
}
@grantges
grantges / GLOSSARY.md
Last active January 26, 2016 14:23
Glossary for use with Appcelerator Platform related gitbooks.

Alloy

An MVC development framework built on top of Appcelerator Titanium for the purpose standardization of rapid application development. Alloy supports an abstracted view / controller paradigm for User Interface development seperating business logic from the graphical aspects of the mobile app, while also supplying a standardized mechanism for handling and binding data to the app and associated controllers.

API

Stands for Application Programming Interface which can be client side or server side functions which allow other programs to interact with the core features, gather data or perform business logic tasks and workflows on the underlying system.

APIs

The plural for API (Application Programming Interfaces)

Appcelerator Platform

@grantges
grantges / polyline.js
Created November 17, 2015 14:39
Polyline JavaScript Module
var polyline = {};
polyline.encodeCoordinate = function(coordinate) {
coordinate = Math.round(1e5 * coordinate);
coordinate <<= 1;
0 > coordinate && (coordinate = ~coordinate);
var output = "";
while (coordinate >= 32) {
output += String.fromCharCode((32 | 31 & coordinate) + 63);
coordinate >>= 5;
@grantges
grantges / index.js
Created November 4, 2015 07:38
Example of a custom delete animation for Appcelerator ListView component using straight Ti - no module required.
$.index.open();
// When we click on the item we want to delete it. This can be called at any place actually,
// I just have it on this event.
function onItemClick(e){
// Get the data of the row so we can use it to populate the new templates
var data = $.listView.sections[e.sectionIndex].getItemAt(e.itemIndex);
// Set the counter to zero, we use this for naming the template on an interval
@grantges
grantges / Readme.md
Last active October 31, 2020 20:13
Shapes With Appcelerator Titanium and Hyperloop

Custom Alloy Tags based on Appcelerator Hyperloop modules

With Alloy and Hyperloop, you can quickly and easily expose native UI as Custom Alloy tags by leveraging the namespace (ns) attribute and commonjs modules.

Alloy allows you to create your own UI element that can be included into the XML View heirarchy in one of two ways, an Alloy Widget or through the use of Custom Tags.

To create your own custom tag, you link the tag to the commonjs module with the namespace attribute (ns). Here is an example using a custom tag to render a standard Titanium View: