Skip to content

Instantly share code, notes, and snippets.

View kbshl's full-sized avatar

Konstantin Büschel kbshl

  • Marburg, Hessen, Deutschland
  • 19:59 (UTC +02:00)
  • X @iskostja
View GitHub Profile
@kbshl
kbshl / gist:21fd9de4441daec6c50063c65263bc26
Created August 7, 2017 15:08 — forked from aaronksaunders/gist:389b209cf9499b0b1a86
[Appcelerator Titans] Auto increment <version> in tiapp.xml
From:
Chris Barber <cbarber@appcelerator.com>
To:
"Jerry.Porter@gulfstream.com" <Jerry.Porter@gulfstream.com>,
"titans@lists.appcelerator.org" <titans@lists.appcelerator.org>,
Date:
04/09/2014 01:21 AM
Subject:
Re: [Appcelerator Titans] Auto increment <version> in tiapp.xml
@kbshl
kbshl / main.rb
Last active April 25, 2016 16:35 — forked from anonymous/main.rb
search my bitbucket repositories
#!/usr/bin/env ruby
# encoding: utf-8
require 'rubygems' unless defined? Gem # rubygems is only needed in 1.8
require_relative "bundle/bundler/setup"
require "alfred"
require 'json'
basic_user = ENV['BB_USER_NAME']
basic_password = ENV['BB_PASSWORD']
@kbshl
kbshl / ALLOY.md
Last active January 20, 2017 21:48 — forked from FokkeZB/ALLOY.md
If you want to your CommonJS modules to work in both Alloy and plain Titanium projects, you might need a way to detect if you're in Alloy. For instance, if you're in Alloy you would get Underscore from the alloy-module, while in plain Titanium you would require Underscore directly.

If you want to your CommonJS modules to work in both Alloy and plain Titanium projects, you might need a way to detect if you're in Alloy. For instance, if you're in Alloy you would get Underscore from the alloy-module, while in plain Titanium you would require Underscore directly.

Well, you can:

var _ = require((typeof ENV_TEST === 'boolean') ? 'alloy' : 'underscore')._;

The above works by utilizing Alloy's optimization process. In this process, constants like ENV_TEST will be either TRUE or FALSE. The actual expressions in wich they are used will then be evaluated. If FALSE the code block will be removed. In plain Titanium projects the constants are undefined and this typeof ENV_TEST will be undefined, so the code block will be executed.

@kbshl
kbshl / androidPrefs.js
Last active October 30, 2017 18:40 — forked from IGx89/android_prefs
Titanium Mobile: Emulates the standard Android preferences grid
// the following code is both the logic and examples of using it
var win = Titanium.UI.currentWindow;
// I've set anyDensity to true in my app and this function enables the UI to properly scale
// you can safely delete this function and all references to it if you'd like
var adj = function(pixels) {
if(Titanium.Platform.name == 'iPhone OS') {
return pixels;
} else {
@kbshl
kbshl / app.js
Last active October 30, 2017 18:40 — forked from FokkeZB/app.js
Titanium Mobile: Add event listener once respectively remove event listener for anonymous callback function
var win = Ti.UI.createWindow({
backgroundColor: 'white'
});
win.addEventListener('click', function foo(e) { // note the named function expression needed for the second way
// oringal idea by @fukhaos
// http://www.tidev.io/2014/09/10/the-case-against-ti-app-fireevent-2/#comment-13013
e.source.removeEventListener(e.type, arguments.callee);
@kbshl
kbshl / shell
Last active October 30, 2017 18:39 — forked from rborn/gist:63113167aace181f4f8b
Delete iOS8 simulator NSUserDefaults (Ti.App.Properties) on app uninstall
Delete this file
/Users/YOUR_USER/Library/Developer/CoreSimulator/Devices/SIM_UDID/data/Library/Preferences/APP_ID.plist