Skip to content

Instantly share code, notes, and snippets.

View botmaster's full-sized avatar
🎧

Pascal Achard botmaster

🎧
View GitHub Profile
@botmaster
botmaster / alloy.js
Created October 16, 2013 09:06 — forked from FokkeZB/alloy.js
// For iOS7 only, set the window's top to 20 so they start under the status bar.
Alloy.Globals.windowTop = (OS_IOS && parseInt(Ti.Platform.version[0], 10) >= 7) ? 20 : 0;
@botmaster
botmaster / app.js
Created October 16, 2013 09:08 — forked from FokkeZB/app.js
http://developer.android.com/guide/topics/resources/providing-resources.html#ScreenAspectQualifier
if ((Ti.Platform.displayCaps.platformWidth / Ti.Platform.displayCaps.platformHeight) < (((Ti.Gesture.orientation === Ti.UI.LANDSCAPE_LEFT)) ? (320 / 240) : (240 / 320)))) {
Ti.API.info('I am LONG');
} else {
Ti.API.info('I am NOTLONG');
}
@botmaster
botmaster / app.tss
Created October 16, 2013 09:11 — forked from FokkeZB/app.tss
'Label[platform=android]': {
color: '#000' // all platforms except Android default to black
}
'Window': {
backgroundColor: '#fff' // white background instead of default transparent
}
'Window[platform=android]': {
modal: false // make android windows all heavyweight
@botmaster
botmaster / ALERT.md
Created October 16, 2013 09:17 — forked from FokkeZB/ALERT.md

I guess just like me you like to do alert('My message'); instead of:

Ti.UI.createAlertDialog({
        message: 'My message'
}).show();

But I'd even more like to do alert('My message', 'My title', myCallback); instead of:

@botmaster
botmaster / app.js
Created October 16, 2013 09:22 — forked from FokkeZB/app.js
var v = Ti.UI.createView();
var s = new require('spinner').Spinner(
v, // View to spin
30 // Degrees to spin per millisecond
); // Auto-starts
// Stop
s.stop();
@botmaster
botmaster / app.js
Created October 16, 2013 09:23 — forked from FokkeZB/app.js
How to decide what window to open first in Titanium Alloy. You can remove all markup from the index.xml view (the file itself must be there!) and then create another controller based on your logic.
/* /Resources/app.js - Generated by Alloy, here to understand the flow */
var Alloy = require("alloy"), _ = Alloy._, Backbone = Alloy.Backbone;
Alloy.createController("index");
<meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />
@botmaster
botmaster / app.tss
Created October 16, 2013 09:57 — forked from FokkeZB/app.tss
'Label[platform=android]': {
color: '#000' // all platforms except Android default to black
}
'Window': {
backgroundColor: '#fff' // white background instead of default transparent
}
'Window[platform=android]': {
modal: false // make android windows all heavyweight
@botmaster
botmaster / CommonJS Fundamentals
Created November 8, 2013 10:52
The following code example shows all eight types of members and methods in one class; it also demonstrates which members are available to the different types of methods, and how they're accessed. Original post here : http://smorgasbork.com/index.php?option=com_content&view=article&id=132
var _privateStaticMember = 'PrSM';
function MyClass ()
{
var _privateInstanceMember = 'PrIM';
var _privateInstanceMethod = function ()
{
return _privateStaticMember + ','
+ _privateInstanceMember + ','