Skip to content

Instantly share code, notes, and snippets.

@adampax
adampax / gist:1241077
Created September 25, 2011 20:05
Use Titanium Picker to Update Scrollable View
var win = Titanium.UI.createWindow({
title : 'test'
});
var view1 = Ti.UI.createView({
backgroundColor:'red'
});
var l1 = Ti.UI.createLabel({
text:'View 1',
color:'#fff',
@yagitoshiro
yagitoshiro / gist:1247519
Created September 28, 2011 09:54
Titanium Mobile (Android) sample -- save file to sdcard and register to photo gallery.
save_button.addEventListener('click', ()->
if Ti.Filesystem.isExternalStoragePresent
save_image = Ti.Filesystem.getFile(path).read()
new_path = Titanium.Filesystem.externalStorageDirectory + Date.now().toString() + ".png"
f = Ti.Filesystem.getFile(new_path)
result = f.write(save_image)
unless result
return null
@applehat
applehat / alloy.js
Last active December 11, 2015 06:28
Alloy.Globals.settings = {}; // Create Empty Object.
/* Settings Getter - Can also just access Alloy.Globals.settings[key] */
Alloy.Globals.settings.get = function(key) {
return Alloy.Globals.settings[key] || null;
}
/* Settings Saver */
Alloy.Globals.settings.set = function(key,value) {
var settings = Alloy.createCollection('settings');
@bhatfield
bhatfield / index.js
Last active December 11, 2015 10:48
Alloy Migration Test
$.index.open();
function doClick(e) {
Ti.API.info(JSON.stringify(e));
}
var library = Alloy.Collections.book;
library.fetch();
Ti.API.info(JSON.stringify(library));
@tonylukasavage
tonylukasavage / alloy.js
Created February 20, 2013 18:34
Alloy - global transform function
Alloy.Globals.transformFunction = function(model) {
// code for your transform function
}
@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"
}, {
@asiviero
asiviero / child_window.js
Created November 7, 2013 01:43
Open a child window on Alloy/Titanium
$.child_window.open();
@staltz
staltz / introrx.md
Last active April 21, 2025 04:15
The introduction to Reactive Programming you've been missing
@bmoren
bmoren / fence.js
Created July 1, 2015 21:55
HTML5 geolocation geofence location detection (without geofence API)
window.onload = function() {
var startPos;
var startPosLat;
var startPosLong;
var distance;
if (navigator.geolocation) {
startPosLat = 44.95716993150707;
startPosLong = -93.28439280496818;
@keegoid
keegoid / WindowsBootEFI.sh
Last active May 24, 2024 15:30
How to repair Windows Boot Manager from Linux
# use Windows repair disc to run Startup Repair
# update grub config file for EFI system
grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg # Fedora
sudo update-grub # Ubuntu
# if grub doesn't find Windows Boot Manager
# find EFI partition (could be on sdb, sdc, etc if you have more than one hard drive)
gdisk -l /dev/sda