Skip to content

Instantly share code, notes, and snippets.

View shouse's full-sized avatar

Steven shouse

  • SIVCI
  • Kansas City, MO
View GitHub Profile
@shouse
shouse / index.js
Created November 13, 2017 16:37
Speech Recognition using Appcelerator Titanium and Hyperloop
'use strict';
/**
* Android sample showing speech recognition using Hyperloop.
*
* @version Titanium 6.1.2.GA
* @version Alloy 1.9.13
* @version Hyperloop 2.1.3
*/
@shouse
shouse / avaudioplayer.js
Created November 13, 2017 15:56 — forked from hansemannn/avaudioplayer.js
Use the AVAudioPlayer with Hyperloop.
var AVAudioEngine = require('AVFoundation/AVAudioEngine');
var AVAudioPlayerNode = require('AVFoundation/AVAudioPlayerNode');
var AVAudioFile = require('AVFoundation/AVAudioFile');
var NSBundle = require('Foundation/NSBundle');
var win = Ti.UI.createWindow({
backgroundColor: '#fff'
});
var btn = Ti.UI.createButton({
@shouse
shouse / beacons.js
Created November 13, 2017 15:47 — forked from hansemannn/beacons.js
Discover iBeacons with Hyperloop
var CLBeaconRegion = require("CoreLocation/CLBeaconRegion"),
NSUUID = require("Foundation/NSUUID"),
CLLocationManager = require("CoreLocation/CLLocationManager"),
CLProximityFar = require("CoreLocation").CLProximityFar,
CLProximityNear = require("CoreLocation").CLProximityNear,
CLProximityImmediate = require("CoreLocation").CLProximityImmediate,
CLProximityUnknown = require("CoreLocation").CLProximityUnknown,
UILocalNotification = require("UIKit/UILocalNotification"),
UIApplication = require("UIKit/UIApplication"),
locationManager;
@shouse
shouse / appc.js
Created November 12, 2017 01:29 — forked from jkotchoff/appc.js
This Titanium code can be used in an appcelerator project (with Hyperloop enabled) to determine if an iOS advertisement was the cause of the current installation
module.exports = {
hyperloop: {
ios: {
xcodebuild: {
frameworks: [
'iAd'
]
}
}
}
@shouse
shouse / titanium-auth-session.js
Created November 7, 2017 21:08 — forked from hansemannn/titanium-auth-session.js
Use Axway Hyperloop to perform OAuth-sessions with the iOS 11+ API "SFAuthenticationSession"
const SFAuthenticationSession = require('SafariServices/SFAuthenticationSession');
const NSURL = require('Foundation/NSURL');
const session = SFAuthenticationSession.alloc().initWithURLCallbackURLSchemeCompletionHandler(
NSURL.alloc().initWithString('https://github.com/login/oauth/authorize?scope=repo&client_id=XXXXX'),
'appcgithub://',
function(url, error) {
if (error != null) {
Ti.API.error('Error performing OAuth: ' + error.localizedDescription);
cb({ success: false, error: 'Error performing OAuth: ' + error.localizedDescription });
@shouse
shouse / ios-sim-inspector.sh
Created November 7, 2017 20:06
Open up Safari's Web Inspector to be used for debugging
#!/bin/sh
function ios-sim-inspector() {
appName="$1"
osascript <<EOF
# Name of the device as visible in Safari->Develop menu
set deviceName to "Simulator"
# Number of seconds to wait for the simulator window to show up
set maxWait to 20
@shouse
shouse / README.md
Last active October 28, 2017 21:23
Ti.Geohash: Encoding/decoding and associated functions

geohash

Functions to convert a geohash to/from a latitude/longitude point, and to determine bounds of a geohash cell and find neighbours of a geohash.

Methods summary:

  • encode: latitude/longitude point to geohash
  • decode: geohash to latitude/longitude
/*
* Below is the background service to monitor the health of the app internet connection.
* It'll set a variable to tell any other controller what's going on with the current connection.
* 1 = Everything's good.
* 2 = Poor connectivity, but still have a connection.
* 3 = We have internet, but are having problems with the API.
* 4 = No internet.
*/
function appConnectionHealth() {
@shouse
shouse / page.indicator.js
Created March 9, 2017 03:38 — forked from giorgiopagnoni/page.indicator.js
Page indicator (circles, lines, squares...) for scrollableViews for Appcelerator Titanium (Android)
/*
* Simple page indicator for scrollableViews for Appcelerator Titanium (Android).
* To be added after the views have been set.
*
* var p = require('page.indicator');
* var options = { color: 'red' };
* var indicator = p.pageIndicator(myScrollableView, options);
*/
@shouse
shouse / ti.dynamiclib.js
Created January 28, 2017 16:18 — forked from hansemannn/ti.dynamiclib.js
Support embedded binaries (aka dynamic libraries) in Titanium modules and Hyperloop
/**
* Ti.DynamicLib
* @abstract Support embedded binaries (aka dynamic libraries) in Titanium modules and Hyperloop.
* @version 1.1.0
*
* Install:
* 1) Search and replace '../../src/<YourFramework>.framework' with your framework location.
The path is relative to the `build/iphone` directory.
* 2a) For classic modules:
* - Add 'LD_RUNPATH_SEARCH_PATHS=$(inherited) "@executable_path/Frameworks" $(FRAMEWORK_SEARCH_PATHS)'