This file contains 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 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 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 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 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 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 util = require('util'); | |
function maybeCallback(cb) { | |
return util.isFunction(cb) ? cb : function(err) { if (err) throw err; }; | |
} | |
function iShouldHaveACallback(opts, callback) { | |
callback = maybeCallback(arguments[arguments.length-1]); | |
if (!opts || util.isFunction(opts)) { | |
opts = {}; |
This file contains 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
{ | |
"browser": true, | |
"camelcase": true, | |
"curly": true, | |
"eqeqeq": true, | |
"expr": true, | |
"immed": true, | |
"indent": 4, | |
"latedef": "nofunc", | |
"newcap": true, |
This file contains 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
grunt.initConfig({ | |
titanium: { | |
create: { | |
options: { | |
command: 'create', | |
name: 'tmp', | |
workspaceDir: '.' | |
} | |
}, | |
build: { |
This file contains 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
if (val === 'sdfdsfsdf' || | |
val === 'sdfsdfsfsf' || | |
val > 23423423 || | |
val < 123) | |
{ | |
// I like the open brace on a new line _only_ in this situation | |
// so that there's a clear distinction between the end of the | |
// multi-line conditional and the beginning of the code | |
} |
This file contains 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 format = require('util').format, | |
fs = require('fs'), | |
path = require('path'); | |
var code = '', testCode = '', | |
test = fs.readFileSync(path.join(__dirname, 'test', 'app_src.js'), 'utf8'), | |
template = 'exports.%s = function %s%s {\n' + | |
'\tthrow new Error(\'%s not yet implemented\');\n' + | |
'};\n\n', | |
testTemplate = '\tit(\'#%s\', function() {\n' + |
OlderNewer