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
@TodoController = () -> | |
@todos = [] | |
@newTodo = "" | |
@addTodo = () -> | |
if @newTodo.length > 0 | |
@todos.push( { content: @newTodo, done: false, editing: false } ) | |
@newTodo = "" | |
@editTodo = (todo) -> |
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 toType = function(obj) { | |
return ({}).toString.call(obj).match(/\s([a-zA-Z]+)/)[1].toLowerCase() | |
} |
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
Ext.define('My.sample.Person', { | |
/** @readonly */ | |
name: 'Unknown', | |
config: { | |
midname: undefined | |
}, | |
constructor: function(name, config) { | |
this.initConfig(config); | |
this.name = name; |
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 sum = function (a, b, context) { | |
var res = a+b; | |
context.result = res; | |
}; | |
var prod = function (a, b, context) { | |
var res = a*b; | |
context.result = res; | |
}; |
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
Ext.define('PrivateTest', (function () { | |
var privTest = function (param) { | |
return 'privTest method!!!'; | |
}; | |
var privTest2 = function (param) { | |
return 'another privTest2('+param+') method!!!'; | |
}; | |
return { |
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
Ext.define('Util', { | |
config: {}, | |
constructor: function () {}, | |
/** | |
* Returns a string with the object properties and values. Could be static | |
* @param {Object} obj |
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
Ext.define('My.Cat', { | |
statics: { | |
speciesName: 'Cat', // My.Cat.speciesName = 'Cat' | |
domestic: { | |
is: undefined | |
}, | |
// Bad: this.self is undefined if called as My.Cat.dump(); | |
dump: function () { | |
var domestic = this.self.domestic.is? 'domestic': 'wild'; |
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
// FullParallel businessLogichronous engine | |
function fullParallel(callbacks, last) { | |
var results = []; | |
var result_count = 0; | |
callbacks.forEach(function(callback, index) { | |
callback( function() { | |
results[index] = Array.prototype.slice.call(arguments); |
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
namespace('MINE'); | |
MINE.parent = (function() { | |
// private funcs and vars here | |
// Public API - constructor | |
var Parent = function (coords) { | |
// ...do constructor stuff here | |
}; |
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 Animal = function () { | |
var helloCount = 0; | |
var self = this; | |
//priviledge methods | |
this.AnimalHello = function() { | |
helloCount++; | |
console.log(self.Name + ' says hello (animalHello)'); | |
}; |
OlderNewer