This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// now you can use it in a titanium app | |
useSomeApi(Ti.App.Properties.getString('SOME_API_KEY')); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// getter assertion | |
should.Assertion.add('CRAZY', function() { | |
this.params = { | |
operator: 'to be the string "CRAZY"', | |
expected: 'CRAZY', | |
showDiff: true | |
}; | |
this.obj.should.equal('CRAZY'); | |
}, true); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var win = Ti.UI.createWindow(); | |
var key = '#foo'; | |
var start = new Date().getTime(); | |
for (var i = 0; i < 10000; i++) { | |
if (key.indexOf('#') === 0 && key !== '#' && !win.__iamalloy) { | |
var bar = 1; | |
} | |
} | |
console.log('time (__iamalloy): ' + ((new Date().getTime()) - start) + 'ms'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find-up() { | |
local path=$(pwd) | |
while [[ "$path" != "" && ! -e "$path/$1" ]]; do | |
path=${path%/*} | |
done | |
if [ "$path" != "" ] | |
then | |
echo "$path" | |
fi | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
((alloy AND appcelerator) OR #tialloy) -Q&A |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports.createController = function(name, args) { | |
var newController = new (require('alloy/controllers/' + name))(args); | |
_.each(_.keys(args), function(key) { | |
if (key.indexOf('#') === 0 && key !== '#') { | |
newController[key.substring(1)].applyProperties(args[key]); | |
} | |
}); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.nav.open(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var EVENTS = 'fetch change destroy'; | |
var args = arguments || {}; | |
// remove existing bindings to prevent unexpected behavior and memory leaks | |
$.user.off(EVENTS); | |
// add bindings to new model | |
args.user.on(EVENTS, function() { | |
$.name.text = args.user.get('name'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find-up() { | |
local path=$(pwd) | |
while [[ "$path" != "" && ! -e "$path/$1" ]]; do | |
path=${path%/*} | |
done | |
if [ "$path" != "" ] | |
then | |
echo "$path" | |
fi | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"globals": [ | |
"Ti": false, | |
"Titanium": false, | |
"Alloy": false, | |
"describe": false, | |
"it": false, | |
"before": false, | |
"beforeEach": false, | |
"after": false, |