Skip to content

Instantly share code, notes, and snippets.

View anfaguerrero's full-sized avatar

Andres Fabian anfaguerrero

View GitHub Profile
/**
* We're going to create an infinite scrollable list. In this case, we're going to show a date. When you swipe left,
* you'll see yesterday. Then the day before yesterday, and so on. Swiping right shows you tomorrow, and so on.
*/
var win = Ti.UI.createWindow({ backgroundColor: '#fff' });
var isAndroid = Ti.Platform.osname === 'android';
/**
* Track where we are in the infinite scrollable views, and define how large of a step goes between each view.
*/
var currentDate = new Date(), msIntervalBetweenViews = 1000/*ms*/ * 60/*s*/ * 60/*m*/ * 24/*h*/;
@anfaguerrero
anfaguerrero / app.js
Last active August 29, 2015 14:11 — forked from Barneybook/app.js
var win = Titanium.UI.createWindow({
title: 'Video Recording from Appcelerator Titanium',
backgroundColor: '#fff'
});
// const value grabbed from
// http://developer.android.com/reference/android/provider/MediaStore.Audio.Media.html#RECORD_SOUND_ACTION
var RECORD_SOUND_ACTION = "android.provider.MediaStore.RECORD_SOUND";
var soundUri = null; // Will be set as a result of recording action.
@anfaguerrero
anfaguerrero / app.js
Last active August 29, 2015 14:11 — forked from theamith/app.js
//Import bencoding alarmmanager module into our Titanium App
var alarmModule = require('bencoding.alarmmanager');
var alarmManager = alarmModule.createAlarmManager();
var isRunning = Ti.App.Properties.getBool("service_running", false);//get service running bool status
if (isRunning) {
Ti.API.info('service is running');
} else {
Ti.API.info('service is not running');
alarmManager.addAlarmService({
/* Kosso : March 12th 2011
This the only way I managed to do this without the app crashing on resume.
Done slightly differently to the KS example, since they unregister the service and
do not use a setInterval timer.
*/
//############ in app.js :
// test for iOS 4+
@anfaguerrero
anfaguerrero / app.js
Last active August 29, 2015 14:11 — forked from jonalter/app.js
var win = Titanium.UI.createWindow({
backgroundColor: 'blue'
});
var btn = Ti.UI.createButton({
title : 'Add Notification'
});
btn.addEventListener('click', function(e) {
var activity = Ti.Android.currentActivity();
var activity = Ti.Android.currentActivity;
var win = Ti.UI.currentWindow;
activity.addEventListener("create", function(e) {
var button = Ti.UI.createButton({title: "Hello world"});
button.addEventListener("click", function(e) {
activity.finish();
});
win.add(button);
});
@anfaguerrero
anfaguerrero / app.js
Last active August 29, 2015 14:10 — forked from aaronksaunders/app.js
//
// Aaron K. Saunders
//
// http://www.clearlyinnovative.com
// http://blog.clearlyinnovative.com
// @aaronksaunders
//
//
(function() {
var group, tab1, tab2, win1, win2;
@anfaguerrero
anfaguerrero / app.js
Last active August 29, 2015 14:09 — forked from jonalter/app.js
var win = Titanium.UI.createWindow({
backgroundColor: 'blue'
});
var btn = Ti.UI.createButton({
title : 'Add Notification'
});
btn.addEventListener('click', function(e) {
var activity = Ti.Android.currentActivity();
var activity = Ti.Android.currentActivity;
var win = Ti.UI.currentWindow;
activity.addEventListener("create", function(e) {
var button = Ti.UI.createButton({title: "Hello world"});
button.addEventListener("click", function(e) {
activity.finish();
});
win.add(button);
});
@anfaguerrero
anfaguerrero / Parse.js
Last active August 29, 2015 14:06 — forked from mattberg/Parse.js
var baseUrl = 'https://api.parse.com/1',
appId = 'XXXXXXXXXXXXXXX',
apiKey = 'XXXXXXXXXXXXXX'; // make sure to use the REST API Key
var _register = function(params, lambda, lambdaerror) {
var method = 'POST',
url = baseUrl + '/installations',
payload = (params) ? JSON.stringify(params) : '';
_helper(url, method, payload, function(data, status) {