Skip to content

Instantly share code, notes, and snippets.

View ghae's full-sized avatar

Aeromedicale ghae

View GitHub Profile
@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

@raulriera
raulriera / slideIn.js
Last active December 18, 2015 06:59
Extending the animation.js Alloy builtins
/**
* @method slideIn
* Makes the specified view appear using a "slide-in" animation, it will automatically
* detect where the view is offscreen and bring it into the user's vison.
* @param {Titanium.UI.View} view View to animate.
* @param {Number} duration Fade duration in milliseconds.
* @param {function()} [finishCallback] Callback function, invoked after the popIn completes.
*/
exports.slideIn = function (view, duration, finishCallback) {
@davidecassenti
davidecassenti / app.js
Created June 3, 2013 14:22
Node ACS File Upload example This example shows how to upload a file to Node ACS, and how to save it server side. The example uses FormData. Note: upload.html must be on a server (it won't work if running locally as a file); also, it requires jquery to be in the same directory to work. All other files are server side, in the Node ACS app.
// initialize app
function start(app, express) {
app.use(express.methodOverride());
// ## CORS middleware
// see: http://stackoverflow.com/questions/7067966/how-to-allow-cors-in-express-nodejs
//
// PLEASE NOTE: ANY SERVER CAN UPLOAD HERE! YOU SHOULS ONLY ALLOW SPECIFIC SERVERS BY
// EDITING THE ACCESS-CONTROL-ALLOW-ORIGIN HEADER BELOW
var allowCrossDomain = function(req, res, next) {
@FokkeZB
FokkeZB / REPETITIVE.md
Created May 27, 2013 19:19
Best event for repetitive taps

Repetitive taps

I needed the right event to react on many repetitive taps. I noticed that click stops firing after some taps, so I did a little test to find the right event to listen to instead.

As the console.log shows, you need singletap ;)

@aaronksaunders
aaronksaunders / app.js
Created May 11, 2013 04:15
Validating the basic integration of the StackMob Module with Titanium Appcelerator, Updated from many months ago
StackMob = require('ti.stackmob')({
publicKey : 'YOUR-PUBLIC-KEY',
secure : true
});
/**
* shows how to login a user
*/
function loginUser() {
var user = new StackMob.User({
@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.

@FokkeZB
FokkeZB / RATING.md
Last active December 16, 2015 16:49
Rate-my-app CommonJS module for Titanium
@aaronksaunders
aaronksaunders / tiparse.js
Last active November 14, 2018 18:00
Tested w/ latest version of parse "parse-1.2.7.js"
var TiParse = function(options) {
// need to convert this to requires
Ti.include("parse-1.2.7.js");
Parse.localStorage = {
getItem : function(_key) {
return Ti.App.Properties.getObject(_key);
},
setItem : function(_key, _value) {
@tonylukasavage
tonylukasavage / index.js
Last active December 15, 2015 00:38
Alloy loose-usage of ListView
function myOnDisplayItem(e) {}
var myTemplate = {
properties: {
onDisplayItem: myOnDisplayItem,
selectedBackgroundColor: 'blue',
height: 120,
},
childTemplates: [
{
@grantges
grantges / WildText.js
Last active December 14, 2015 11:18
CommonJS Module for Titanium that allows you to create gradient filled Labels (note: iOS only) Updated to include updates from Todd Lindner - as noted here : https://gist.github.com/toddlindner/5093536
/*
WildText CommonJS module for Appcelerator Titanium
Create dynamic gradient filled text in your iOS Applications using this simple module.
@params : text - String. The text for your label
font - Font. Specify the font attributes for the label (defaults to standard size, weight and family),
backgroundGradient - BackgroundGradient. Specify your backgroundGradient object (defaults to White to Black linear gradient),
Top - Integer. Top property for your label,
Left - Integer. Left Property for your Label,