Skip to content

Instantly share code, notes, and snippets.

View doublerebel's full-sized avatar

Charles Phillips doublerebel

View GitHub Profile
@doublerebel
doublerebel / project.sublime-project
Last active October 11, 2015 00:08
Adding Tintan for Titanium Mobile build system to a Sublime Text 2 project
{
"folders":
[
{
"path": "/path/to/the/project/folder"
}
],
"build_systems":
[
{
@doublerebel
doublerebel / tiger-swipe-nav.coffee
Created September 26, 2012 21:19
Example of Swipe Navigation with Tiger on Titanium Mobile
Tiger = require '/lib/tiger'
Route = require '/lib/tiger.route'
class BaseView extends Tiger.Window
close: ->
direction = Tiger.Route.direction
left = if direction is 'prev' then '-100%' else '100%'
@animate {left: left, duration: 400}, @element.close
@doublerebel
doublerebel / titanium-inspector.sh
Last active October 11, 2015 07:18
How to use Node-Inspector to Debug Titanium Mobile Applications
npm install -g node-inspector
/path/to/.titanium/mobilesdk/linux/3.1.0.GA/android/builder.py simulator projectname /path/to/android-sdk-linux /path/to/project com.your.project 16 WVGA800 127.0.0.1:5858
node-inspector
@doublerebel
doublerebel / example.js
Created October 11, 2012 17:55
How to get Titanium Mobile API autocomplete with CoffeeScript in Sublime Text 2
/* Step 1:
** Place (only one) Titanium API lib (from jsca2js package) in:
** /path/to/project_root/.codeintel/libs
*/
/* Step 2:
** Create text file: /path/to/project_root/.codeintel/config
*/
{
"JavaScript": {
@doublerebel
doublerebel / checkboxwidget.coffee
Created October 11, 2012 21:27
Example of a Tiger View Widget: Checkbox with Label
dip = (val) -> "#{val} dip"
class Settings.CheckBox extends Tiger.View
defaults:
width: '92%'
height: dip 48
# style: Ti.UI.Android.SWITCH_STYLE_CHECKBOX
constructor: (props) ->
@label = new Tiger.Label
@doublerebel
doublerebel / await-confirm.coffee
Created October 31, 2012 23:43
IcedCoffeeScript await-defer wrapping of Appcelerator Titanium Confirm Dialog with Tiger
class ConfirmDialog extends Tiger.OptionDialog
defaults:
options: ['Confirm', 'Cancel']
cancel: 1
confirm: (title, callback) ->
((@tiOne 'click', callback).set title: title).show()
...
@doublerebel
doublerebel / androidrotation.js
Created November 21, 2012 19:51
Rotation animation of element in Titanium Mobile on Android
rotation = Ti.UI.create2DMatrix().rotate(0, 360);
animation = Ti.UI.createAnimation({duration: 500, repeat: 100, transform: rotation});
element.animate(animation);
@doublerebel
doublerebel / tiapp.xml
Created January 17, 2013 20:55
Building Titanium Mobile app against Android SDK API 16 with hardware acceleration
<android xmlns:android="http://schemas.android.com/apk/res/android">
<tool-api-level>16</tool-api-level>
<manifest android:versionCode="1" android:versionName="2.2">
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="16" />
<application android:hardwareAccelerated="true" />
</manifest>
</android>
@doublerebel
doublerebel / srtextract.sh
Last active December 11, 2015 09:29
Extract subtitles from video and format them to SRT spec
#/bin/sh
#
# Extract subtitles from video and format them to SRT spec
# Useful for Samsung Smart TVs
#
# Depends on mkvtoolnix package (available for most distros) for mkvmerge and mkvextract
# To list tracks in the video, use command: ./srtextract.sh tracks <filename>
#
# Depends on ass2srt.pl for susbtitle format conversion
# http://code.google.com/p/ass2srt/downloads/list
@doublerebel
doublerebel / routeexample-app.js
Created March 8, 2013 16:55
Example of Tiger routing in plain JS (for Titanium Mobile)
// 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
//
var win1 = Titanium.UI.createWindow({
title:'Tab 1',