Skip to content

Instantly share code, notes, and snippets.

@mike-north
Created June 5, 2016 04:33
Show Gist options
  • Save mike-north/bd84d6499e4728cebbcac96eee6a34a7 to your computer and use it in GitHub Desktop.
Save mike-north/bd84d6499e4728cebbcac96eee6a34a7 to your computer and use it in GitHub Desktop.
Cat picture generator
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
w: 100,
h: 200,
kittehUrl: Ember.computed('w', 'h', function() {
var { w, h } = this.getProperties(['w', 'h']);
return `https://placekitten.com/${w}/${h}`;
})
});
body {
margin: 12px 16px;
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-size: 12pt;
}
.text-center {
text-align: center;
}
.kitty {
border-radius: 5px;
border: 1px solid black;
box-shadow: 0 0 40px rgba(0,0,0,0.4);
margin: 40px;
}
<h1>Welcome to my cat picture generator</h1>
<br>
<br>
{{outlet}}
<p class="text-center">
{{input type='range' min=40 max=300 value=w placeholder="width"}} {{w}}
</p>
<p class="text-center">
{{input type='range' min=40 max=500 value=h placeholder="height"}} {{h}}
</p>
<p class="text-center">
<img class="kitty" src={{kittehUrl}} />
<br>
<input value={{kittehUrl}} style="width: 450px">
</p>
<br>
<br>
{
"version": "0.8.1",
"EmberENV": {
"FEATURES": {}
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
"ember": "2.5.1",
"ember-data": "2.5.2",
"ember-template-compiler": "2.5.1"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment