Skip to content

Instantly share code, notes, and snippets.

@paulfalgout
paulfalgout / marionette-fast
Created June 19, 2017 06:45
js-benchmark speed-up
'use strict';
const _ = require('underscore');
const Bb = require('backbone');
const Mn = require('backbone.marionette');
const morphdom = require('morphdom');
const rowTemplate = function(data) {
//return `<td class="col-md-1">${ data.id }</td>
//<td class="col-md-4">
@paulfalgout
paulfalgout / NextCompositeView-alt.js
Created April 2, 2017 15:05
NextCompositeView Alt
var NextCompositeView = Marionette.NextCollectionView.extend({
constructor: function(options) {
Marionette.NextCollectionView.call(this, options);
this.templateView = new Marionette.View(_.pick(this, ['el','template','ui','model']));
},
childView: function() {
return this.constructor;
},
getChildViewContainer: function() {
var selector = _.result(this, 'childViewContainer');
@paulfalgout
paulfalgout / NextCompositeView.js
Created April 2, 2017 14:48
Make a CompositeView with NextCollectionView
var MixinFromView = _.pick(Marionette.View.prototype, 'serializeModel', 'getTemplate', '_renderTemplate', 'mixinTemplateContext', 'attachElContent');
var NextCompositeView = Marionette.NextCollectionView.extend({
childView: function() {
return this.constructor;
},
serializeData: function() {
return this.serializeModel();
},
getChildViewContainer: function() {
@paulfalgout
paulfalgout / obj.js
Created March 10, 2017 17:39
Add radio-mixin to Mn 2.x Object
import _ from 'underscore';
import Marionette from 'marionette';
import RadioMixin from './radio-mixin';
const Obj = Marionette.Object.extend({
constructor(options) {
this.options = _.extend({}, _.result(this, 'options'), options);
this._initRadio();
@paulfalgout
paulfalgout / backbone.radio
Created March 18, 2016 08:57
radio v1.0.4
// Backbone.Radio v1.0.3
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('underscore'), require('backbone')) :
typeof define === 'function' && define.amd ? define(['underscore', 'backbone'], factory) :
(global.Backbone = global.Backbone || {}, global.Backbone.Radio = factory(global._,global.Backbone));
}(this, function (_,Backbone) { 'use strict';
_ = 'default' in _ ? _['default'] : _;
Backbone = 'default' in Backbone ? Backbone['default'] : Backbone;
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); // Template Cache
// --------------
var _underscore = require('underscore');
// MarionetteJS (Backbone.Marionette)
// ----------------------------------
// v3.0.0-pre.2
//
// Copyright (c)2016 Derick Bailey, Muted Solutions, LLC.
// Distributed under MIT license
//
// http://marionettejs.com
@paulfalgout
paulfalgout / leankit-aging.js
Last active February 7, 2016 04:10
RoundingWell - Leankit Oldest 2 mo
// var data = [ copy/paste results of https://roundingwell.leankit.com/kanban/api/boards/193188337 ]
// Change this to get a different range
var ago = _.moment().subtract('month', 2);
var lanes = data.ReplyData[0].Lanes;
var cards = _.flatten(_.map(lanes, 'Cards'),true);
var oldCards = _.reject(cards, function(card){ return _.moment(card.LastMove).isAfter(ago); });
@paulfalgout
paulfalgout / backbone.marionette.js
Created November 29, 2015 22:15
Mn v3 ES6 build example
// MarionetteJS (Backbone.Marionette)
// ----------------------------------
// v2.4.1
//
// Copyright (c)2015 Derick Bailey, Muted Solutions, LLC.
// Distributed under MIT license
//
// http://marionettejs.com
@paulfalgout
paulfalgout / index.html
Last active August 29, 2015 14:21
Inline preloader
<div class='inline-preloader'>
<div class='inline-preloader__bullet'></div>
<div class='inline-preloader__bullet'></div>
<div class='inline-preloader__bullet'></div>
</div>