Skip to content

Instantly share code, notes, and snippets.

def _stepper_buttons(self):
buttons = []
mutes = self._mute_buttons.submatrix[4:8, :1]
assigns = self._crossfade_buttons.submatrix[4:8, :1]
for mute, assign in izip(mutes, assigns):
buttons.extend([mute, assign])
return buttons
class Parent(object):
def log_message(self, string):
self.c_instance.log_message(string) # Calling a C bridge
def create_children(self):
self.child1 = Child(self)
self.child2 = Child2(self)
class Child(object):
def __init__(self, parent):
# I used to do this with Rabl
class BaseController < ApplicationController
before_filter @load_active_distributors
def load_active_distributors
# RABL template uses this
@active_distributors ||= Enterprise.distributors_with_active_order_cycles
end
end
Darkswarm.factory "Loading", ->
new class Loading
message: null
Darkswarm.directive "loading", (Loading)->
scope: {}
restrict: 'E'
templateUrl: 'loading.html'
controller: ($scope)->
window.Loading = Loading
console.log $scope
ChildScope {$id: "00F", this: ChildScope, $$listeners: Object, $$listenerCount: Object, $parent: ChildScope…}
$id: "00F"
$parent: ChildScope
accordion: Object
checkout: Constructor
show: function (name) {
this: ChildScope
__proto__: ChildScope
.columns.small-12.large-6{"ng-bind-html" => "producer.long_description"}
// producer.long_description is <p>text here</p>
Darkswarm.directive "ofnModal", ($modal)->
restrict: 'E'
replace: true
transclude: true
template: "<a>{{title}}</a>"
link: (scope, elem, attrs, ctrl, transclude)->
scope.title = attrs.title
contents = null
Darkswarm.controller "ForgotCtrl", ($scope, $http, $location, SpreeUser, AuthenticationService) ->
$scope.spree_user = SpreeUser.spree_user
$scope.path = "/forgot"
$scope.sent = false
$scope.active = ->
$location.path() == $scope.path
$scope.select = ->
AuthenticationService.select($scope.path)
%ng-include{src: "login.html"}
%ng-include{src: "signup.html"}
%ng-include{src: "forgot.html"}
Darkswarm.directive "ofnModal", ($modal)->
restrict: 'E'
replace: true
transclude: true
template: "<a>{{title}}</a>"
link: (scope, elem, attrs, ctrl, transclude)->
scope.title = attrs.title
scope.cancel = ->