Skip to content

Instantly share code, notes, and snippets.

View samueleastdev's full-sized avatar

Samuel East samueleastdev

View GitHub Profile
@samueleastdev
samueleastdev / RecordingVideo.js
Created August 31, 2012 08:50 — forked from ericdagenais/RecordingVideo.js
How to record video, then share or save it. Using Appcelerator Titanium!
/**
* This sample lets you record and share video with Appcelerator Titanium on Android.
* REQUIRES THE 1.6.0 RC OF TITANIUM MOBILE SDK
* http://developer.appcelerator.com/blog/2011/02/release-candidate-for-titanium-mobile-1-6-0.html
*/
/**
* First, create our UI. We'll have two buttons: record, and share.
*/
var win = Titanium.UI.createWindow({
@samueleastdev
samueleastdev / settings.txt
Last active September 22, 2016 17:45
Converting Appcelerator language xml file to Pot file and then translate using poedit
// install poedit https://poedit.net/
// install itstool
brew install itstool
// go into your language folder
cd /Users/username/Documents/Appcelerator_Studio_Workspace/app/app/i18n/en
// convert all & signs to & throughout your string.xml file else it fails
@samueleastdev
samueleastdev / base.js
Created September 23, 2016 09:49
Appcelerator requesting location permissions
/*
* function to check for all location services outcomes
*/
function requestLocationPermissions(authorizationType, callback) {
// FIXME: Always returns false on Android 6
// https://jira.appcelerator.org/browse/TIMOB-23135
if (OS_IOS && !Ti.Geolocation.locationServicesEnabled) {
return callback({
success : false,
@samueleastdev
samueleastdev / shell.sh
Created September 29, 2016 10:15
Useful Appcelerator commands
// check for updates
appc setup
// logout
appc logout
// login
appc login
@samueleastdev
samueleastdev / index.js
Created September 30, 2016 10:30
Appcelerator Ti.UI.ATTRIBUTE_LINK with link color set.
var termsText = L('terms_and_policy', 'No Translation');
if (OS_IOS) {
var attr = Ti.UI.createAttributedString({
text : termsText,
attributes : [{
type : Ti.UI.ATTRIBUTE_LINK,
value : "terms",
range : [termsText.indexOf('Terms of Use'), ('Terms of Use').length]
@samueleastdev
samueleastdev / index.js
Last active October 10, 2016 16:58
Show Annotations Android Appcelerator
// function
function showAnnotationsAndroid(_data) {
var largestLat = Math.max.apply(Math, _data.map(function(o) {
return o.latitude;
}));
var smallestLat = Math.min.apply(Math, _data.map(function(o) {
return o.latitude;
}));
@samueleastdev
samueleastdev / index.js
Last active October 12, 2016 11:15
Cross Platform Appcelerator Calendar Permissions With Calendar Select
var cals = require("permissions");
cals.addCalendarEvent({
iosEvent: {
title: 'Sample Event',
notes: 'This is a test event which has some values assigned to it.',
location: 'Appcelerator Inc',
begin: new Date(new Date().getTime() + 3000),
end: new Date(new Date().getTime() + 900000),
availability: Ti.Calendar.AVAILABILITY_FREE,
allDay: false,
@samueleastdev
samueleastdev / shell.sh
Last active May 15, 2018 09:47
Fixing Appc [ERROR] : An error occurred during build after 21s 27ms [ERROR] : pod install returned a non-zero exit code
sudo gem uninstall cocoapods
sudo gem install cocoapods
sudo rm -fr ~/.cocoapods/repos/master
pod setup
pod install
pod update
@samueleastdev
samueleastdev / index.js
Last active November 8, 2016 12:51
Appcelerator ListView set a background selected colour
function toggleCheck(_event) {
var items = _event.section.getItems();
for (var i = 0; i < items.length; i++) {
var resetItem = _event.section.getItemAt(i);
resetItem.properties.backgroundColor = Alloy.Globals.Device.brandColorBg;
_event.section.updateItemAt(i, resetItem);
};
@samueleastdev
samueleastdev / index.js
Created November 18, 2016 09:52
Base64Encode ImageView With Appcelerator
var image = logsData[i].image;
var logImage = Ti.UI.createImageView({
image : image
});
var tb = logImage.toBlob();
htmlPdfBuilder += '<img src="data:image/png;base64,' + Ti.Utils.base64encode(tb) + '" />';