Skip to content

Instantly share code, notes, and snippets.

View robneville73's full-sized avatar

Rob Neville robneville73

View GitHub Profile
@robneville73
robneville73 / commit.js
Created November 3, 2015 16:23
combined functions from ember data 1.13.9 dealing with persisting records to the store with heavy comments
//record (internal-model)
save: function(options) {
var promiseLabel = "DS: Model#save " + this;
var resolver = Ember.RSVP.defer(promiseLabel); //http://emberjs.com/api/classes/RSVP.html#method_defer
this.store.scheduleSave(this, resolver, options);
return resolver.promise;
},
//store.js
_extractRelationshipErrors: function(store, typeClass, payload) {
var relationshipNames = Ember.get(typeClass, 'relationshipNames'); //returns obj with key hasMany and belongsTo arrays of names.
var relationshipsByName = Ember.get(typeClass, 'relationshipsByName'); //returns object with key, kind, and typeClass
var relationTypes = ['hasMany', 'belongsTo'];
relationTypes.forEach(function(relationType) {
relationshipNames[relationType].forEach(function(relationshipName) {
var relationship = relationshipsByName.get(relationshipName);
if (payload.hasOwnProperty(relationshipName)) {
for (var i = 0; i < payload[relationshipName].length; i++) {
_extractRelationshipErrors: function(store, typeClass, payload) {
var relationshipNames = Ember.get(typeClass, 'relationshipNames'); //returns obj with key hasMany and belongsTo arrays of names.
var relationshipsByName = Ember.get(typeClass, 'relationshipsByName'); //returns object with key, kind, and typeClass
var relationTypes = ['hasMany', 'belongsTo'];
relationTypes.forEach(function(relationType) {
relationshipNames[relationType].forEach(function(relationshipName) {
var relationship = relationshipsByName.get(relationshipName);
if (payload.hasOwnProperty(relationshipName)) {
for (var i = 0; i < payload[relationshipName].length; i++) {
_extractRelationshipErrors: function(store, typeClass, payload) {
var relationshipNames = Ember.get(typeClass, 'relationshipNames'); //returns obj with key hasMany and belongsTo arrays of names.
var relationshipsByName = Ember.get(typeClass, 'relationshipsByName'); //returns object with key, kind, and typeClass
var relationTypes = ['hasMany', 'belongsTo'];
relationTypes.forEach(function(relationType) {
relationshipNames[relationType].forEach(function(relationshipName) {
var relationship = relationshipsByName.get(relationshipName);
if (payload.hasOwnProperty(relationshipName)) {
for (var i = 0; i < payload[relationshipName].length; i++) {
_extractRelationshipErrors: function(store, typeClass, payload) {
var relationshipNames = Ember.get(typeClass, 'relationshipNames'); //returns obj with key hasMany and belongsTo arrays of names.
var relationshipsByName = Ember.get(typeClass, 'relationshipsByName'); //returns object with key, kind, and typeClass
var relationTypes = ['hasMany', 'belongsTo'];
relationTypes.forEach(function(relationType) {
relationshipNames[relationType].forEach(function(relationshipName) {
var relationship = relationshipsByName.get(relationshipName);
if (payload.hasOwnProperty(relationshipName)) {
for (var i = 0; i < payload[relationshipName].length; i++) {
@robneville73
robneville73 / controllers.application.js
Last active October 4, 2016 20:00
template_binding
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
actions: {
setInputValue: function() {
this.set('model.firstname', 'hello');
}
}
@robneville73
robneville73 / controllers.application.js
Created October 12, 2016 17:12 — forked from samselikoff/mirage.config.js
Mirage dev boilerplate
import Ember from 'ember';
export default Ember.Controller.extend({
});
reports: computed(function() {
return get(this, 'getReports').perform();
}),
firstReport: computed('reports.value.length', function() {
return get(this, 'reports.value.firstObject');
}),
someOtherThing: computed('reports.value.length', function() {
get(this, 'reports.value').forEach((report) => {
import Ember from 'ember';
export default Ember.Component.extend({
});
DO $$
DECLARE
d1 pickupcapacities.deliverydate%TYPE;
d2 pickupcapacities.deliverydate%TYPE;
day pickupcapacities.dayofweek%TYPE;
BEGIN
d1 := '11-05-2017';
d2 := '12-31-2017';
LOOP