Skip to content

Instantly share code, notes, and snippets.

@sharpred
sharpred / gist:13cda452cab8348ef635
Created June 5, 2014 09:55
performs jshint on files in your commit
#!/bin/sh
files=$(git diff --cached --name-only --diff-filter=ACM | grep ".js$")
if [ "$files" = "" ]; then
exit 0
fi
pass=true
echo "\nValidating JavaScript:\n"
@mschmulen
mschmulen / animate annotation
Created January 3, 2011 21:44
animate an annotation on a mapview
// this sets the background color of the master UIView (when there are no windows/tab groups on it)
Titanium.UI.setBackgroundColor('#000');
var win = Ti.UI.createWindow({
title: "Window Title",
exitOnClose: true
});
win.open();
// CREATE MAP VIEW
@stereoket
stereoket / gpstest.js
Created June 4, 2011 21:45
GPS Lookup demo
var GO = {
init: function(){
// Delete the property data
Ti.API.debug('Removing properties');
Ti.App.Properties.removeProperty("latitude");
Ti.App.Properties.removeProperty("longitude");
Ti.App.Properties.removeProperty("geoAccuracy");
Ti.App.Properties.removeProperty("geoTimestamp");
var propTimestamp = Ti.App.Properties.getString("geoTimestamp");
@jonalter
jonalter / app.js
Created August 31, 2011 22:03
Ti.App.iOS.scheduleLocalNotification example
var win = Ti.UI.createWindow({
backgroundColor:'white'
});
win.open();
var label = Ti.UI.createLabel({
top: 20,
height: 200,
width: 200,
text: "Background the app"
});
var win = Ti.UI.createWindow({
backgroundColor:'white'
});
var v = Ti.UI.createScrollView();
win.add(v);
var v1 = Ti.UI.createView({
height:Ti.UI.SIZE,
backgroundColor:'red'
@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();
@joshjensen
joshjensen / alloy.py
Last active November 30, 2016 18:25
Alloy Grid - Open Alloy controllers, views, and styles in Sublime Text grid layout.
# Version: 0.0.022
# Please note: This has only been tested on Sublime Text 3 Build 3065
# Installation:
# 1. Click "Download Gist"
# 2. Put alloy.py in: ~/Library/Application Support/Sublime Text 3/Packages/User/
# 3. Set your layout to Grid 4 - Go to view > layout > Grid: 4
# 4. Add to the bliss of working with Alloy...
@tzmartin
tzmartin / video.thumbnail.js
Created July 10, 2012 17:46
Create Thumbnail Image From Video File, Titanium Mobile
/**
Create Thumbnail of Video File
This snippet captures a thumbnail JPG image, based on a frame @ 2 second time-lapse.
Titanium Mobile
*/
var movie = Titanium.Media.createVideoPlayer({
contentURL:FILENAME,
// Creates our main root window. Fullscreen all the way!
var win = require('/ui/common/window_home').createWindow();
if(Ti.Platform.osname==='android'){
// This Theme makes sure the windows are full screen and buttons aren't always in caps.
// mytheme.xml lives in /platform/android/res/values - see below.
win.open({theme: "MyAmazingTheme"});
} else {
var rootNavWin = Titanium.UI.iOS.createNavigationWindow({
@skypanther
skypanther / app.js
Created September 1, 2011 21:48
Draw gridlines in a Titanium window
// implement like this:
var window = Ti.UI.createWindow({
backgroundColor:'#fff'
});
// draw the gridlines first so your other elements stack on top of them
// without requiring you to set the z-index property of each
var grid = require('gridlines');
grid.drawgrid(10,window);