Skip to content

Instantly share code, notes, and snippets.

@pzuraq
pzuraq / controllers.application.js
Last active January 13, 2018 03:12
Volatile Computed Bug
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
init() {
this.set('prop', 1);
this.set('computedProp', 1);
},
@pzuraq
pzuraq / components.table-cell.js
Last active May 17, 2017 15:07
Table Component
import Ember from 'ember';
export default Ember.Component.extend({
tagName: 'td'
});
// verses.js - controller
import Ember from 'ember';
import DS from 'ember-data';
export default Ember.ObjectController.extend({
actions: {
getAnotherVerse: function() {
// Here you need to understand a little bit about promises. A promise is
// asynchronous, so in you need to use .then() to get the value of the
// promise that is returned.
Playlists
Grunge Rock
===========
Trophy Wife It Comes In Waves…(Neil Young)
Dead Confederate The Rat
Indie/Folk
==========
Josh Ritter The Temptation of Adam
Ember.ObservableObjectProxy = Ember.Object.extend({
init: function() {
this._super();
Ember.defineProperty(this, 'properties');
this.set('properties', {});
},
unknownProperty: function(property) {
return this.get('properties.'+property);
},
var promises = [
Q.nfcall(db.query, args)
];
if (condition) {
promises.push(Q.nfcall(db.query, args2));
}
Q.all(promises).then(function() {
/* yay callback */
/**
@extends Ember.Mixin
Implements common pagination management properties for controllers.
*/
App.PaginationSupport = Ember.Mixin.create({
hasPaginationSupport: true,
total: 0,
def index(options={}, &block)
respond_with(*(with_chain(collection) << options), &block)
end
# MySQL. Versions 4.1 and 5.0 are recommended.
#
# Install the MYSQL driver
# gem install mysql2
#
# Ensure the MySQL gem is defined in your Gemfile
# gem 'mysql2'
#
# And be sure to use new-style password hashing:
# http://dev.mysql.com/doc/refman/5.0/en/old-client.html
@pzuraq
pzuraq / router.js
Last active December 17, 2015 15:28
Case.Router.reopen({
location: 'history'
});
Case.Router.map(function() {
this.resource('inventory', function(){
this.route('review');
this.route('sheets');
this.resource('vehicle', { path: '/vehicle/:vehicle_id' }, function(){
this.route('index');