Skip to content

Instantly share code, notes, and snippets.

View yozef's full-sized avatar

Joseph yozef

  • Boston - San Francisco - Montréal
View GitHub Profile
/**
* Ti.TouchID
*
* Summary: Support native Touch ID with Hyperloop in Titanium Mobile.
* Author: Hans Knoechel | Appcelerator, Inc
* Date: 03/22/2016
* Version: 0.1.0
* Example
*
* var touchID = require("ti.touchid");
@falkolab
falkolab / index.js
Created October 29, 2015 11:45
How to use SVG as View backgroundImage
$.getView().backgroundImage = getImageFileFromSVG({
image : "/images/hearts.svg",
width : 400,
height : 400,
top : 0,
left : 0
});
function getImageFileFromSVG(svgOpts) {
var file = Ti.Filesystem.getFile(Ti.Filesystem.applicationCacheDirectory,
@benbahrenburg
benbahrenburg / geo.md
Last active January 16, 2023 09:50
iOS 8: Geo Location Permissions Fix

Fixing Geo Location Permissions in iOS8

In iOS8, Apple has changed how geo location permissions work. This gist outlines an approach to fix this so Geo will continue to work in iOS8.

Before getting started with the code change, we need to update the tiapp.xml with a few keys.

If you wish to have Geo always run, you need to add the below key. The key NSLocationAlwaysUsageDescription is used when requesting permission to use location services whenever the app is running. To enable this, add the below to the tiapp.xml:

NSLocationAlwaysUsageDescription Reason that appears in the authorization prompt

@benbahrenburg
benbahrenburg / index.md
Last active August 29, 2015 14:06
iOS 8 : Local Notification PR Description

Adding iOS8 Location Notification Permission Support to Titanium

Before you start, you must make the below changes to Ti SDK 3.4.0 or greater

This gist discusses the approach used to provide a PR for https://jira.appcelerator.org/browse/TC-4671 PR submitted here tidev/titanium-sdk#6025

In this gist we will provide step by step instructions and reasons for adding features to Titanium to allow developers to check iOS 8 the current UIUserNotificationSettings for the app. These are needed so the developer can determine if the proper UIUserNotificationType has been granted to their app.

To accomplish this, we first add an event listener to Ti.App.iOS called usernotificationsetting. This will fire when the app's [UIApplication sharedApplication] currentUserNotificationSettings is updated.

@kennr
kennr / _build.js
Last active August 29, 2015 14:05
Titanium Studio Mobile SDK 3.3.0.GA _build.js file for Android
/** Titanium Studio 3.3.0 with New Relic fix
*
* Instructions for New Relic SDK fix:
*
* New Relic has issued a temporary fix for the Node.js build system Appcelerator
* is now using to build Android apps. It requires replacing the "_build.js" file
* in the latest Titanium SDK 3.3.0.GA with a new version. It has been tested and
* verified to work on Mac OS, Windows, and Linux. However, it has only been
* verified on version 3.3.0.GA of the Titanium SDK, so that is the version we
* recommend using. Please see below for platform-specific instructions.
@aaronksaunders
aaronksaunders / app.js
Last active August 29, 2015 14:03
Appcelerator Cloud Services, Promises and Custom Objects
//
//
var Q = require('q'); // add q.js library - https://github.com/kriskowal/q
var Cloud = require("ti.cloud"); // add in tiapp.xml
Cloud.debug = true;
function cloudCreateObjects(_data) {
var deferred = Q.defer();
@aaronksaunders
aaronksaunders / credentials.js
Last active February 2, 2019 16:54
Updated Instagram Integration with Appcelerator, all the files you need are here, be sure to include the promises library in your project
exports.C = {
INSTAGRAM_CLIENT_ID : 'replace this with your public', //replace this with your public
INSTAGRAM_CLIENT_SECRET : 'replace this with your private key', //replace this with your private key
INSTAGRAM_CALLBACK_URL : 'replace this with your INSTAGRAM_CALLBACK_URL'
};
@benbahrenburg
benbahrenburg / app.js
Last active March 15, 2017 14:48
Titanium TableView Expand Zoom TableView HeaderView
'use strict';
var win = Ti.UI.createWindow({
backgroundColor: 'white',
});
//Generate some sample rows
var rows = [];
for (var iLoop=0;iLoop<100;iLoop++){
rows.push({ title: 'demo row #'+iLoop});
@jakeorr
jakeorr / RateMe.js
Last active May 12, 2017 10:22 — forked from psyked/RateMe.js
function RateMe(ios_url, goog_url, usecount) {
if(!Ti.App.Properties.hasProperty('RemindToRate')) {
Ti.App.Properties.setString('RemindToRate', 0);
}
var remindCountAsInt = parseInt(Ti.App.Properties.getString('RemindToRate'), 10);
var newRemindCount = remindCountAsInt + 1;
if(remindCountAsInt === -1) {
// the user has either rated the app already, or has opted to never be
// reminded again.
@FokkeZB
FokkeZB / ALLOY.md
Last active February 13, 2019 20:01
Alloy constants and helpers for non-Alloy Titanium projects.

If you want to your CommonJS modules to work in both Alloy and plain Titanium projects, you might need a way to detect if you're in Alloy. For instance, if you're in Alloy you would get Underscore from the alloy-module, while in plain Titanium you would require Underscore directly.

Well, you can:

var _ = require((typeof ENV_TEST === 'boolean') ? 'alloy' : 'underscore')._;

The above works by utilizing Alloy's optimization process. In this process, constants like ENV_TEST will be either TRUE or FALSE. The actual expressions in wich they are used will then be evaluated. If FALSE the code block will be removed. In plain Titanium projects the constants are undefined and this typeof ENV_TEST will be undefined, so the code block will be executed.