Skip to content

Instantly share code, notes, and snippets.

View flopezluis's full-sized avatar

Félix López flopezluis

  • Salamanca - Spain
View GitHub Profile
@flopezluis
flopezluis / ordered_hm.js
Created June 3, 2011 07:22
Ordered Hash Map
/*
* Simple hash map using javascript objects and an ordered array.
* Repeated elements are not allowed.
*
* @param sort_method By default is ASC order, but you can specified whatever you want.
*
* The public methods are:
* -set
* -get
* -del
@flopezluis
flopezluis / EventQueuerwhilerequestingdata.js
Created May 10, 2011 09:38
Event Queuer while requesting data. When you have taks that cannot be done between the ajax request
var function_after_ajax = [];
function fetchData() {
$.ajax({
url: url,
method: 'GET/POST',
dataType: 'json',
data:params,
success: onDataReceived
});
function onDataReceived() {
@flopezluis
flopezluis / tic_tac_toe
Created April 13, 2011 17:07
Just for fun
players = ('0','X')
turn = 0
exit = False
board = {0:'-', 1:'-',2:'-', 3:'-', 4:'-',5:'-',6:'-', 7:'-',8:'-'}
win_combinatios= [[0,1,2], \
[3,4,5], \
[6,7,8], \
[0,3,6], \
[1,4,7], \
[2,5,8], \
@flopezluis
flopezluis / app.js
Created February 2, 2011 08:46
Create 2 tabs
var isAndroid = Ti.Platform.osname == 'android';
// create tab group
var tabGroup = Titanium.UI.createTabGroup();
var indicator = Titanium.UI.createActivityIndicator({
bottom:10,
height:50,
width:10,
message:"Cargando..."
});
// this sets the background color of the master UIView (when there are no windows/tab groups on it)
Titanium.UI.setBackgroundColor('#000');
// create tab group
var tabGroup = Titanium.UI.createTabGroup();
//
// create base UI tab and root window
//