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
//Hackers Cup 2013 | |
//Node.js Submission | |
var fs = require('fs') | |
var totalValue | |
var stringInfo | |
var sortedStringInfo | |
fs.readFile("beautiful_stringstxt.txt","UTF-8",function(err,data) { |
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
import Ember from 'ember'; | |
var Light = Ember.Object.extend({ | |
isOn: false, | |
color: 'yellow', | |
age: null, | |
description: Ember.computed('isOn','color',function() { | |
return 'The ' + this.get('color') + ' light is ' + (this.get('isOn') ? 'on' : 'off'); | |
}), | |
// fullDescription: Ember.computed('description','age',function() { | |
// return this.get('description') + ' and the age is ' + //this.get('age') |
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 observer = Ember.observer; | |
var computed = Ember.computed; | |
var Car = Ember.Object.extend({ | |
isOn: 'false', | |
color: 'blue', | |
isOnChanged: observer('isOn','color', function() { | |
console.log("changed set to " + this.get('isOn')); | |
}), | |
}); |
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
export default Ember.Controller.extend({ | |
appName:'Observer Example', | |
lambo: Car.create(), | |
status: computed('lambo.isOn', function() { | |
return "The lambo is " + (this.get('lambo').get('isOn') ? 'on' : 'off') | |
}), | |
actions: { | |
pressed: function() { | |
this.get('lambo').toggleProperty('isOn'); |
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
import Ember from 'ember'; | |
var observer = Ember.observer; | |
var computed = Ember.computed; | |
var Car = Ember.Object.extend({ | |
isOn: 'false', | |
color: 'blue', | |
isOnChanged: observer('isOn','color', function() { | |
console.log("changed set to " + this.get('isOn')); |
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
import Ember from 'ember'; | |
var teacher = Ember.Object.extend({ | |
homeroom: "", | |
age: "", | |
gradeTeaching: "" | |
}); | |
var student = Ember.Object.extend({ |
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
import Ember from 'ember'; | |
var myName = Ember.Object.extend({ | |
name: "Erik Hanchett", | |
otherName: Ember.computed.oneWay('name') | |
}); | |
var erik = myName.create(); | |
//console.log(erik.get('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
import Ember from 'ember'; | |
var student = ['Erik', 'Jim', 'Shelly', "Kate", "Jenny", "Susan"]; | |
student.forEach(function(item, index) { | |
console.log(`Student #${index+1}: ${item}`); | |
}); | |
var upperCaseStudent= student.map(function(item) { | |
return item.toUpperCase(); | |
}); |
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
import Ember from 'ember'; | |
var common = Ember.Mixin.create({ | |
property1: 'This is a Mixin property', | |
edit: function() { | |
console.log('starting to edit'); | |
this.set('isEditing', true); | |
}, | |
isEditing: false | |
}); |
OlderNewer