Skip to content

Instantly share code, notes, and snippets.

View ppcano's full-sized avatar

Pepe Cano ppcano

View GitHub Profile
@ppcano
ppcano / a_models.js
Last active August 28, 2015 12:17
Does it make sense to sideload dependent records on a `save resource action` response?
var Project = DS.Model.extend({
userCounter: DS.attr('number'), // provides the value of project.users.length without requiring fetching
users: DS.hasMany('user', {async: true}) // links --> /project/:id/users
});
var User = DS.Model.extend({
project: DS.belongsTo('project', {async: true})
});
var el1, el2,
hammer1, hammer2,
event;
module("Hammer Integration - Multiple Gestures", {
setup: function() {
el1= document.getElementById('toucharea1');
el2= document.getElementById('toucharea2');
hammer1 = new Hammer(el1);
hammer2 = new Hammer(el2);
#!/usr/bin/env node
var exec = require('child_process').exec,
rmdir = require('rimraf'),
outputPath = 'public';
rmdir(outputPath, function(error){
@ppcano
ppcano / Brocfile.js
Created April 20, 2014 12:40
Failing broccoli plugin
var features = match('.', 'ember_features.json');
emberModules = defeatureifyFilter2([features, emberModules]);
@ppcano
ppcano / animated_component.js
Created April 30, 2014 11:10
First Route Animation
var AnimatedLayoutComponent = Ember.Component.extend({
action: 'animationEnd',
animatedProperties: null,
transitionEnd: function(evt) {
var animatedProperties = this.get('animatedProperties').split(' ');
var propertyName = evt.originalEvent.propertyName;
if (animatedProperties.indexOf(propertyName) !== -1) {
@ppcano
ppcano / handler_info.js
Created April 30, 2014 18:05
Rewriting HandlerInfo.js
import Promise from 'rsvp/promise';
var HandlerInfo = requireModule("router/handler-info")['HandlerInfo'];
var bind = requireModule("router/utils").bind;
HandlerInfo.prototype.resolve = function(async, shouldContinue, payload) {
var checkForAbort = bind(this.checkForAbort, this, shouldContinue),
beforeModel = bind(this.runBeforeModelHook, this, async, payload),
model = bind(this.getModel, this, async, payload),
afterModel = bind(this.runAfterModelHook, this, async, payload),
animation = bind(this.runAnimationHook, this, async, payload),
@ppcano
ppcano / animated_component.js
Last active August 29, 2015 14:00
Ember Route Animation
// Component which send `animationEnd` action when
// a transitionEnd event is fired in a property defined included at `animatedProperties`
var AnimatedLayoutComponent = Ember.Component.extend({
action: 'animationEnd',
animatedProperties: null,
transitionEnd: function(evt) {
var animatedProperties = this.get('animatedProperties').split(' ');
@ppcano
ppcano / test_create_record_with_sideloaded_and_belongs_to.js
Created May 8, 2014 19:27
Failing tests: RESTAdapter create - a sideloaded record with a relationship to the primary record should not fetch the relationship
test("create - a sideloaded record with a belongsTo relationship to the primary record should not fetch the relationship", function() {
expect(3);
var postName = "Rails is omasake";
ajaxResponse({
post: [{
id: "1",
name: postName
}],
@ppcano
ppcano / tests.js
Created May 8, 2014 19:31
findQuery//update - a sideloaded record with a relationship to the primary record should not fetch the relationship record
test("update - a sideloaded record with a relationship to the primary record should not fetch the relationship record", function() {
expect(4);
var postName = "Rails is omasake";
var postName2 = "EmberJS is omasake";
ajaxResponse({
post: [{
id: "1",
name: postName
Remote Address:46.137.168.22:443
Request URL:https://production-cybersource-invibe.herokuapp.com/payment_confirmation
Request Method:POST
Status Code:200 OK
**Request Headersview source**
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8