Skip to content

Instantly share code, notes, and snippets.

View alexspeller's full-sized avatar
🏁

Alex Speller alexspeller

🏁
View GitHub Profile
//This is in the appliation route:
setupController:function(controller, model) {
this._super(controller, model);
this.filterable(['ingredient', 'recipe']).then(function(array) {
controller.set('itemCollection', array)
});
},
var MyRoute = Ember.Route.extend({
model: function() {
// this will resolve
return Ember.$.ajax().then(function(data) {
// then this will resolve
return Ember.RSVP.hash({
data: data,
items: Em.RSVP.all([
Ember.$.ajax({url: data.item1url}),
Ember.$.ajax({url: data.item2url})
{{#object-form for=this action="formSubmitted" buttonLabel="Click Me" formClass="narrow"}}
{{form-field for="email"}}
{{form-field for="password" label="Create new password" hint="Minimum 8 characters"}}
{{form-field for="passwordConfirmation" label="Confirm new password"}}
{{/object-form}}
StatsController = Ember.Controller.extend
currentSelection: Ember.computed ->
value = @store.createRecord('selection')
value.populate()
value
@alexspeller
alexspeller / controllers.application.js
Last active August 29, 2015 14:26 — forked from Kerrick/controllers.application.js
Array Computed without arrayComputed?
import Ember from 'ember';
const { computed, get, set } = Ember;
export default Ember.Controller.extend({
appName:'Ember Twiddle',
parts: computed('appName', {
get() {
return get(this, 'appName').split(' ');
},
import Ember from 'ember';
export default Ember.Controller.extend({
show: null,
menus: Ember.computed('model', function() {
return this.model;
}),
actions: {
showMatch(menu) {
//alert('Start');
@alexspeller
alexspeller / hack.sh
Created March 31, 2012 11:35 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
import Ember from 'ember';
export default Ember.Controller.extend({
queryParams: ['b'],
a: "test",
b: Ember.computed('a', {
get() {
return this.get('a');
},
set(key, value) {
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle'
});
#original attribution https://gist.github.com/alexspeller/6251054 & https://gist.github.com/stevekane/6356006
App.ClickElsewhereMixin = Ember.Mixin.create
#use this method hook to define your desired behavior
onClickElsewhere: Ember.K
#bound version of our instance method
clickHandler: Em.computed ->
Em.run.bind @, 'onClickElsewhere'