Skip to content

Instantly share code, notes, and snippets.

View HazemKhaled's full-sized avatar

Hazem Khaled HazemKhaled

View GitHub Profile
function CustomImageView(args) {
var self = Ti.UI.createImageView(args);
//override any customizations to image, images, repeatCount, or duration
self.image = args.animatedImages[0];
self.repeatCount = null;
self.duration = null;
//instance variables
var animationIndex = 0,
animationCount = 0,
@xalakox
xalakox / couchdb csv list
Created June 30, 2012 23:28
CouchDB JSON to CSV view converter use ?include_docs=true&reduce=false
{
"csv":"function(head, req){
start({
'headers': {
'Content-Type': 'text/csv'
}
});
Array.prototype.unique = function() {
var a = this.concat();
@Mode54
Mode54 / ActionBarView.js
Created July 22, 2012 16:00
Action Bar Module for Titanium Mobile
/*
* Android API Guide
* http://developer.android.com/guide/topics/ui/actionbar.html
* Android Design Guide
* http://developer.android.com/design/patterns/actionbar.html
* Titanium Mobile will support someday
* https://jira.appcelerator.org/browse/TIMOB-2371
*/
var osName = Ti.Platform.osname,
isAndroid = osName==='android',
@pedrofaria
pedrofaria / sqlx.js
Created October 6, 2012 22:08
New adapter for alloy models
/*
* Local SQLite sync adapter which will store all models in
* an on device database
*/
var _ = require('alloy/underscore')._,
db;
function S4() {
return (((1+Math.random())*0x10000)|0).toString(16).substring(1);
};
@DianthuDia
DianthuDia / ActionBarView.js
Created November 12, 2012 16:46 — forked from Mode54/ActionBarView.js
Action Bar Module for Titanium Mobile
/*
* Android API Guide
* http://developer.android.com/guide/topics/ui/actionbar.html
* Android Design Guide
* http://developer.android.com/design/patterns/actionbar.html
* Titanium Mobile will support someday
* https://jira.appcelerator.org/browse/TIMOB-2371
*/
var osName = Ti.Platform.osname,
isAndroid = osName==='android',
@aaronksaunders
aaronksaunders / app_snippet.js
Last active July 11, 2020 14:07
One way to do bulk updates and deletes with Appcelerator Alloy Collections
// add all items to collection
Alloy.Collections.Fugitive.reset([{
"name" : "Jeff Haynie"
}, {
"name" : "Nolan Wright"
}, {
"name" : "Don Thorp"
}, {
"name" : "Marshall Culpepper"
}, {
@ricardoalcocer
ricardoalcocer / index.js
Last active December 16, 2015 16:29
Quick and dirty Appcelerator Alloy + FireFoxOS hack. This sample App works EXACTLY the same on iOS, Android and FirefoxOS.
function onsuccess(data){
var jdata=JSON.parse(data);
var data=[];
jdata.forEach(function(item){
var payload={
tweet:item.text
};
var row=Alloy.createController('tweet.row',payload).getView();
@jasonkneen
jasonkneen / 1readme.md
Last active May 28, 2021 16:48
Quick example of registering a URLScheme in a Titanium app using the TiApp.xml without info.plist file. Just add the following into your TiApp.xml (I put it under the </iphone> tag. Works on Android and iOS.

Quick Example of registering a scheme in TiApp.xml, implementing the code in app.js / alloy.js

@FokkeZB
FokkeZB / DOWNSIZE.md
Last active December 8, 2016 10:39
Automatically generate non-retina and Android images for Alloy projects

UPDATE: With the assets command of the TiCons CLI / Module this can be done even simpeler by calling $ ticons assets or an alloy.ymk using:

task("pre:load", function(event, logger) {
    require('ticons').assets();
});

@LHIOUI
LHIOUI / tiYoutube.js
Last active April 3, 2018 08:20
Titanium commonJS module to play youtube video on Ti.Media.VideoPlayer many thanks to The Endless Hack https://github.com/endlesshack/youtube-video
//
// tiYoutube.js
//
// Created by Coyote on 2014-10-07.
// Copyright 2014 Coyote. All rights reserved.
//
var YoutubeVideo = function(id, callback) {
var client = Ti.Network.createHTTPClient();
client.onload = function(video_info) {
Ti.API.debug('on load');