Skip to content

Instantly share code, notes, and snippets.

View tsteur's full-sized avatar

Thomas Steur tsteur

View GitHub Profile
@tsteur
tsteur / alloy.jmk
Created July 15, 2013 22:12
Simple build configuration file for Titanium Mobile Alloy. It extends the destroy method of each controller to automatically remove all event listeners which are defined in the view (XML).
function readContentFromFile(file)
{
return require('fs').readFileSync(file).toString();
}
function writeContentToFile(file, content)
{
require('fs').writeFileSync(file, content);
}
@tsteur
tsteur / alloy.jmk
Last active November 8, 2017 02:12
Simple build configuration file for Titanium Mobile Alloy to remove unimportant log calls if build type is production
function isProduction(alloyConfig)
{
return 'production' == alloyConfig.deploytype;
}
function removeUnimportantLogCallsFromContent(content)
{
if (!content) {
return;
}
@tsteur
tsteur / find_unused_styles_in_titanium_mobile_alloy.php
Created April 26, 2013 18:26
Finds unused styles within a Titanium Mobile - Alloy project. In order to execute it you need to place it within the root of your Titanium project and execute it using `php find_unused_styles_in_titanium_mobile_alloy.php`. PHP should be preinstalled on almost all Macs. Script only searches for app/styles/*.tss files. It does not perform a search…
<?php
foreach (getAllTssFilenames() as $tssfile){
echo "\nSearching for unused styles in $tssfile:\n";
outputUnusedStyles($tssfile);
}
function getAllTssFilenames()
{
return glob('app/styles/*.tss');
@tsteur
tsteur / titanium_mobile_apidoc_2_sublimetext.php
Last active October 13, 2015 19:30
Converts Titanium Mobile documentation from API.JSON to sublime-completions (Sublime Text 2 Auto Completion)
<?php
// usage: php -d memory_limit=256M titanium_mobile_apidoc_2_sublimetext.php > Tita.sublime-completions
function shorten_titanium($key)
{
return str_replace('Titanium', 'Ti', $key);
}
function get_completions($content)
{
$processed = array();