Skip to content

Instantly share code, notes, and snippets.

using UnityEngine;
using System;
using System.Collections.Generic;
namespace BelacCorp
{
[KSPAddon(KSPAddon.Startup.SpaceCentre, true)]
public class BeamActionTracker : MonoBehaviour
{
public class BeamAction
var DialogRegion = Backbone.Marionette.Region.extend({
el: '#form_dialog_div',
constructor: function () {
_.bindAll(this, "getEl", "showDialog", "hideDialog");
Backbone.Marionette.Region.prototype.constructor.apply(this, arguments);
this.on("show", this.showDialog, this);
},
getEl: function (selector) {
var $el = $(selector);
return $el;
var TabsLayoutView = Backbone.Marionette.LayoutView.extend({
initialize: function(options){
this.tabOneViewInstance = new TabOneiew();
this.tabTwoViewInstance = new TabTwoView();
this.tabThreeViewInstance = new TabThreeView();
},
template: "#tabs_layout_template",
regions: {
content: ".content-pane"
},
var SpectrumDrawer = function(buffer){
this.buffer = buffer;
this.bufferPosition = 0;
this.bufferLength = this.buffer.length;
var pixelWidth = $('#wave').width();
this.sampleBufferLength = Math.floor(this.bufferLength / pixelWidth);
$('#spectrum').width(pixelWidth);
$('#spectrum').height($('#wave').height());
this.spectrumCanvas = $('#spectrum').get(0);
@belackriv
belackriv / slideOutAndInRegion.js
Last active December 1, 2015 16:35
Marionette Transition Region Example
'use strict';
import TransitionRegion from './transitionRegion';
export default TransitionRegion.extend({
//can override transitionIn and transitionOut with diff effects
//must trigger 'transition:out:complete' and optionally 'transition:in:complete'
transitionOut(){
var region = this;
@belackriv
belackriv / layout.js
Last active December 15, 2015 19:29
Dynamic Tabs Layout
var TabOneContentView = Marionette.LayoutView.extend({
template: '#viewOne'
});
var TabTwoContentView = Marionette.LayoutView.extend({
template: '#viewTwo'
});
var TabItemView = Marionette.ItemView.extend({
template: '#itemView',
'use strict';
import Backbone from 'backbone';
import Radio from 'backbone.radio';
import Marionette from 'marionette';
import MyselfModel from 'lib/common/models/myselfModel';
import UserAccountCollection from 'lib/common/models/userAccountCollection';
import AccountCollection from 'lib/common/models/accountCollection';
let filterChecklistItemViewTpl = '<label><input type="checkbox" name="{{name}}"" {{if isActive}}checked{{/if}} />{{title}}</label>';
let filterViewTpl = '<div>{{filterTitle}}:<span data-ui="expandFilterButton" class="down-carret-thing></span></div><div data-region="filterChecklist"></div>';
let FilterChecklistItemView = Marionette.LayoutView.extend({
template: filterChecklistItemViewTpl,
ui: {
'checkbox': 'input[type="checkbox"]'
},
events: {
'use strict';
import Marionette from 'marionette';
import viewTpl from './boxItemView.hbs!';
import TrashListView from './trashListView.js';
export default Marionette.LayoutView.extend({
template: viewTpl,
tagName: 'li',
regions: {
@belackriv
belackriv / gist:008087f6f005aee1167f
Last active September 21, 2016 21:22
Marrionette Table without composite view
//
//Regions
//
var NoWrapRegion = Backbone.Marionette.Region.extend({
attachHtml: function (view) {
this.el.innerHTML="";
var children = view.el.childNodes;
while (children.length > 0) {
this.el.appendChild(children[0]);