Skip to content

Instantly share code, notes, and snippets.

View ricardoalcocer's full-sized avatar
💭
making music at https://alcomusic.com

Alco ricardoalcocer

💭
making music at https://alcomusic.com
View GitHub Profile
@ricardoalcocer
ricardoalcocer / scrollinglabel.js
Created February 7, 2014 17:26
Scrolling Label
var view1 = Titanium.UI.createScrollView({
contentWidth:Ti.UI.FILL,
contentHeight:Ti.UI.FILL,
showVerticalScrollIndicator:true,
showHorizontalScrollIndicator:true
});
var label1 = Titanium.UI.createLabel({
color:'#000',
text: "sdfsdfasdf ",
@ricardoalcocer
ricardoalcocer / orientation_changes.js
Created February 10, 2014 21:58
Orientation changes
/*
Android:
PORTRAIT 1
LANDSCAPE 2
iOS:
PORTRAIT 1
UPSIDE_PORTRAIT 2 (iOS-only)
LANDSCAPE_LEFT 3
LANDSCAPE_RIGHT 4
//
// blog.clearlyionnovative.com
// twitter: @aaronksaunders
//
// Model file for integration Appcelerator Titanium Alloy with Wordpress JSON Plugin
//
exports.definition = {
config : {
"columns" : {},
@ricardoalcocer
ricardoalcocer / app.js
Created March 17, 2014 21:18
Test Case: Titanium AudioPlayer for Android - This code fails to return the current song position and the player state
sound = Ti.Media.createAudioPlayer({
url: 'http://www.televisiontunes.com/themesongs/The%20Gadget%20Show.mp3'
});
sound.play();
var tempIntCount = 0;
trackTempInterval = setInterval(function() {
tempIntCount++;
console.log('Current state: ' + sound.state);
console.log('Current position:' + sound.time);
//taken from http://developer.appcelerator.com/question/117491/removing-children-from-a-view
function removeAllChildren(viewObject){
//copy array of child object references because view's "children" property is live collection of child object references
var children = viewObject.children.slice(0);
for (var i = 0; i < children.length; ++i) {
viewObject.remove(children[i]);
}
}
@ricardoalcocer
ricardoalcocer / gist:8d050ed8126cbc20e8e6
Created August 8, 2014 15:34
Using the same iOS developer certificate on multiple computers
1. On the computer with the developer credentials, Goto Xcode->Preferences->Accounts.
Click on the gears to export the profile. Choose a password as it includes all your credentials of apple-developer program.
2. Share the exported file with the new computer.
3. Import the profile in your Xcode->preferences->Accounts.
@ricardoalcocer
ricardoalcocer / app.js
Created August 12, 2014 18:20
Test Titanium HTTPClient
var w=Ti.UI.createWindow({
backgroundColor: "#fff"
});
var s=Ti.UI.createScrollView({
height: Ti.UI.FILL,
width: Ti.UI.FILL
})
var t=Ti.UI.createLabel({
@ricardoalcocer
ricardoalcocer / post.js
Last active August 29, 2015 14:05
Android POST
var w=Ti.UI.createWindow({
backgroundColor: '#fff'
})
var URL='https://posttestserver.com/post.php';
var xhr = Titanium.Network.createHTTPClient();
xhr.tlsVersion = Titanium.Network.TLS_VERSION_1_1;
xhr.onload = function() {
//var jsonObject = JSON.parse(this.responseText);
@ricardoalcocer
ricardoalcocer / index.js
Last active August 29, 2015 14:06
iOS 8 Interactive Notifications with Appcelerator
var win = $.index;
var acceptAction = Ti.App.iOS.createUserNotificationAction({
identifier: "ACCEPT_IDENTIFIER",
title: "Accept",
activationMode: Ti.App.iOS.USER_NOTIFICATION_ACTIVATION_MODE_FOREGROUND,
destructive: false,
authenticationRequired: true
});