Skip to content

Instantly share code, notes, and snippets.

<?php
/**
* Magento
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
@ianmstew
ianmstew / gist:6d0db2981c438b800d04
Last active August 29, 2015 14:02
Backbone.Model.set override that bubbles change events
var ModelWithNesting = Backbone.Model.extend({
/*
* Backbone.Model.set() override that sniffs out child Backbone Models and bubbles up events.
* Accepts the same parameters as Backbone.Model.set().
*/
set: function (key, val, options) {
var self = this,
attrs;
if (key == null) return this;
ContactManager.module("ContactsApp.Show", function(Show, ContactManager, Backbone, Marionette, $, _){
var localCh = require('mymodule/mymodule.channel');
Show.Controller = Marionette.Controller.extend({
initialize: {
_.bindAll(this, 'contactEdited');
this.listenTo(localCh, "contact:edit", this.contactEdited);
},
contactEdited: function (contact) {
define(function (require) {
var Backbone = require('backbone');
var Marionette = require('marionette');
var eventedClasses = [
Backbone.Model,
Backbone.Collection,
Marionette.Controller,
Marionette.Object,
Marionette.Region,
define(function (require) {
var sinon = require('sinon');
var database = require('test/data/database');
var server = sinon.fakeServer.create();
var CONTENT_JSON = { 'Content-Type': 'application/json' };
var lastAppId = 0;
server.autoRespond = true;
server.autoRespondAfter = 100;
define(function (require) {
var Mixin = require('lib/classes/mixin');
var Radio = require('backbone.radio');
var logger = require('lib/util/logger');
var HasChannel = Mixin.extend({
// Declarative option for channel name
// channelName: nameOfChannel
<section class="listing" data-view="listings/index" data-model_id="687210" data-model_name="listing">
<div class="slideshow"> ... </div>
<section class="details tab_panel" data-view="listings/details" data-model_id="687210" data-model_name="listing">
<ul> ... </ul>
</section>
<section class="user" data-view="listings/user" data-model_id="2088962" data-model_name="user" data-lazy="true"> ... </section>
</section>

Hey Sayra!

Everything is working to perfection. Here’s what you have:

Top left

  • Coda with landing.view.html and landing.less opened as tabs
  • File sidebar open to Sayra/SquareknotWorkspace/Patrick/public_html/app/subapps/landing

Bottom left

@ianmstew
ianmstew / key-github-access.md
Last active August 29, 2015 14:09
Enabling key-based Github access
@ianmstew
ianmstew / has-channel.mixin.js
Last active August 29, 2015 14:10
HasChannel mixin
define(function (require, exports, module) {
var Radio = require('backbone.radio');
var logger = require('lib/util/logger')(module);
// Supports a declarative channelName and semi-custom channelEvents hash.
// Example:
// channelName: 'notify'
// channelEvents: {
// 'error': ['on', 'onError'],
// 'show:message': ['comply', 'showMessage']