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 / tisqlitesample.js
Created May 8, 2012 15:13
Simple Titanium SQLite sample
Ti.Database.install('/dbname.sqlite','dbname');
var mydb = Ti.Database.open('dbname');
var sql="SELECT ..... ";
var RS=mydb.execute(sql);
var data='';
while(RS.isValidRow()){
data += RS.fieldByName('fieldname') + ' - ';
RS.next();
@ricardoalcocer
ricardoalcocer / http.js
Created November 7, 2012 01:10
Puerto Rico Elections 2012 - Quick and Dirty Titanium App
Based on Alloy
==============================
index.js
==============================
var h=require('http').HTTP;
var http=new h();
http.get('http://div1.ceepur.org/REYDI_NocheDelEvento/data/GOBERNADOR_ISLA.xml',function(data){
try{
@ricardoalcocer
ricardoalcocer / categories.js
Created November 18, 2012 21:20
ClasificadosOnline Scrapping Excercise
var http = require('http');
var options = {
host: 'query.yahooapis.com',
port: 80,
path: '/v1/public/yql?q=select%20*%20from%20html%20where%20url%3D%22http%3A%2F%2Fclasificadosonline.com%2Fm%2FMiscellaneosSearchM.asp%22%20and%0A%20%20%20%20%20%20xpath%3D%27%2Fhtml%2Fbody%2Fdiv%2Fdiv%2Fdiv%2Fform%2Fselect%27&format=json&diagnostics=true&callback=',
method: 'GET'
};
var req = http.get(options, function(httpObj) {
@ricardoalcocer
ricardoalcocer / index.js
Created November 22, 2012 21:49
Basic Alloy : Opening Windows
function showWin1(e) {
var w=Alloy.createController('win2').getView();
w.open();
}
$.index.open();
@ricardoalcocer
ricardoalcocer / index.js
Created November 23, 2012 19:36
Basic Alloy : Static TableView Handling
function showItems(e) {
Ti.API.info(e.rowData.itemName);
}
$.win.open();
@ricardoalcocer
ricardoalcocer / index.js
Created November 23, 2012 19:49
Basic Alloy : Dynamic TableView Handling
function showItems(e) {
Ti.API.info(e.rowData.itemName);
}
var rowData=[];
for(var i=1;i<=10;i++){
var payload={
rowId:i,
itemName:'Test' + i
}
@ricardoalcocer
ricardoalcocer / detailwin.js
Created November 23, 2012 20:27
Basic Alloy : Dynamic TableView Handling + Open Window
var args = arguments[0] || {};
$.rowId.text=args.rowId;
$.itemName.text=args.itemName;
function closeme(){
$.win.close();
}
@ricardoalcocer
ricardoalcocer / index.js
Created November 25, 2012 19:45
Titanium Allow - Creating a FaceBook-like UI
function doClick(e) {
alert($.label.text);
}
function showmenu(e){
$.main.animate({left:200,duration:100});
}
function hidemenu(e){
$.main.animate({left:0,duration:100});
@ricardoalcocer
ricardoalcocer / gist:4252276
Created December 10, 2012 18:17
Make tumblr title clickable
{block:Title}<a href="{Permalink}" title="{Title}">{Title}</a>{/block:Title}
@ricardoalcocer
ricardoalcocer / tiapp.xml
Created December 22, 2012 19:09
For Christian
<?xml version="1.0" encoding="UTF-8"?>
<ti:app xmlns:ti="http://ti.appcelerator.org">
<id>ti.hackpr1</id>
<name>hackpr1</name>
<version>1.0</version>
<publisher>not specified</publisher>
<url>not specified</url>
<description>not specified</description>
<copyright>not specified</copyright>
<icon>appicon.png</icon>