Last active
January 16, 2016 14:48
-
-
Save andrewtimberlake/d27a2e4483d17476e082 to your computer and use it in GitHub Desktop.
Distance Calculator
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
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
}); |
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
import Ember from 'ember'; | |
const { computed } = Ember; | |
function round(value) { | |
return Math.round(value * 100) / 100; | |
}; | |
// 1.60934 kilometers per mile | |
// 0.621371 miles per kilometer | |
export default Ember.Component.extend({ | |
kilometers: 0, | |
miles: 0, | |
updateMiles(value) { | |
this.set('miles', round(parseFloat(value) * 0.621371)); | |
}, | |
updateKilometers(value) { | |
this.set('kilometers', round(parseFloat(value) * 1.60934)); | |
} | |
}); |
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
body { | |
margin: 12px 16px; | |
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; | |
font-size: 12pt; | |
} | |
input { | |
text-align: right; | |
width: 5em; | |
} |
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
{ | |
"version": "0.5.0", | |
"EmberENV": { | |
"FEATURES": {} | |
}, | |
"options": { | |
"enable-testing": false | |
}, | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js", | |
"ember": "2.2.0", | |
"ember-data": "2.2.0", | |
"ember-template-compiler": "2.2.0" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment