Skip to content

Instantly share code, notes, and snippets.

View tripitakit's full-sized avatar

Patrick De Marta tripitakit

View GitHub Profile
@tripitakit
tripitakit / Ti-touches.js
Last active March 15, 2017 18:42
Appcelerator Titanium touch events usage example: connecting a blue box to a red box with a touch and finger slide.
/***
* Connects the blue box to the red box with touch and finger slide.
* The window's backgroundColor and the label's text give feedback to the user.
* ... the blue box is not going to move anywhere
*
* @Copyleft 2013 Patrick De Marta
* @License GNU GPL
*/
/**
@tripitakit
tripitakit / Ti-touches-kiss.js
Last active July 17, 2016 12:05
Appcelerator Titanium touch events example. Connects the blue box to the red box with touch and finger slide. The windows backgroundColor and the Label will give action feedback to the user. Or how to take advantage of pointInWindowCoords() to keep things simple.
/***
* Connects the blue box to the red box with touch and finger slide.
* The window's backgroundColor and label's text will give action feedback to the user.
* Or how to take advantage of convertPointToView() to keep things simple
*
* @Copyleft 2013 Patrick De Marta
* @License GNU GPL
*/
/**
@tripitakit
tripitakit / confirmTableViewDelete.js
Last active December 27, 2015 20:48
Appcelerator Titanium example of custom confirm dialog for TableView's delete events. Asks to confirm/cancel a delete operation. On cancel restores the deleted row in its former position in the table data.
/***
* Appcelerator Titanium example of custom confirm dialog for TableView's delete events.
* Asks to confirm/cancel a delete operation. On cancel restores the deleted row in
* its former position in the table data.
*
* @Copyleft 2013 Patrick De Marta
* @License GNU GPL
*/
var win = Titanium.UI.createWindow({
@tripitakit
tripitakit / Ti-tableViewsFunctional.js
Last active December 28, 2015 00:49
A functional rewrite of an Appcelerator Titanium iOS tableView test code which displays four tables with combination of moving/moveable/editing/editable properties to test their effects on rows' appearance and behavior.
(function(win) {
["moving editing",
"moving editable",
"moveable editing",
"moveable editable"
].map(function(test){
var table = { headerTitle: test };
test.split(" ").map(function(property){
table[property] = true;
});
@tripitakit
tripitakit / Ti-tableViews-basic.js
Created November 11, 2013 17:37
Appcelerator Titanium iOS tableView test code which displays four tables with combination of moving/moveable/editing/editable properties to test their effects on row appearance and behavior
var win = Ti.UI.createWindow({
backgroundColor:'#fff',
layout:'vertical',
});
var tableData = [{title:"Alpha"}, {title:"Beta"}, {title:"Gamma"}];
var test1 = Ti.UI.createTableView({
headerTitle: 'moving editing',
moving: true,
@tripitakit
tripitakit / app.js
Created November 13, 2013 13:30
A test with two commonJS modules in Titanium
var win = Titanium.UI.createWindow({
backgroundColor:'#fff',
layout:"vertical"
});
win.open();
var module = require('myModule');
module.createScanPage(win);
@tripitakit
tripitakit / Ti-LabelBender.js
Last active December 28, 2015 15:59
Label Bender for Appcelerator Titanium. A proof of concept experiment for a factory function(string, angle) returning a view with the single char labels composed along an arc, resulting in a curved label.
/*
* Titanium Label Bender
* Proof of concept for a factory function(string, angle) returning a single view
* with the single char labels composed along an arc, resulting in a curved label
*
* @Copyright (c) 2013 Patrick De Marta
* @License MIT
*/
var win = Titanium.UI.createWindow({
@tripitakit
tripitakit / recursiveDownload.js
Last active December 29, 2015 03:09
recursive double download example
var button1 = Ti.UI.createButton({
top:"10%",
title: "Get Files"
});
$.index.add(button1);
button1.addEventListener('click', getfiles);
function getfiles(){
Ti.API.info('get files was pushed');
cachedImageView = function(basedir, uri, obj, attr, cacheage) {
/**
Appcelerator Titanium ImageView /w cache
This function attempts to cache a remote image and then returns it again
when it's requested.
The file is stored in a directory "basedir," this is to try and help
you keep files unique. It's not special or magical, but not dirty either.
@tripitakit
tripitakit / coordinate_comuni_italiani.csv
Last active May 29, 2018 18:00
Lista dei comuni italiani con coordinate di geo-localizzazione (7983 comuni)
Comune latitudine longitudine
Agliè 45.3641546 7.7686265
Airasca 44.9182892 7.4856624
Ala di Stura 45.3113703 7.293252600000001
Albiano d'Ivrea 45.4327781 7.9476302
Alice Superiore 45.459751 7.778170599999999
Almese 45.1173797 7.3950789
Alpette 45.4106335 7.580299800000001
Alpignano 45.0991116 7.516632899999999
Andezeno 45.0367203 7.867391800000001