Skip to content

Instantly share code, notes, and snippets.

ParentCollection = require('collections/common/parent_collection')
Channel = require('models/channel')
module.exports = class Channels extends ParentCollection
model: Channel
modelSingular: 'channel'
driverLabel: 'Cost driver'
driverList:
exclude: 'Exclude this channel from the plan'
manual: 'Forecast this channel manually'
NestedParentView = require('views/analysis/common/nested_parent_view')
module.exports = class ChannelsIndexListView extends NestedParentView
pageGuideContext:
title: 'Channel list'
items: [
target: '.breadcrumbs .last'
direction: 'right'
description: 'Channels are simply sources of new customers. By building
customer acqusition strategy around a portfolio of channels, it much
module.exports = class BaseChartView extends View
className: 'chart-container'
initialize: (@options) ->
# ...
@chart = new Tactile.Chart @options
@chart.addSeries(series) if series
@chart.element(@el)
module.exports = class ChartUpperView extends BaseChartView
initialize: (options) ->
super(options)
@chart.height(400)
# Base class for all views which display dynamically
#
# Backbone.js still does not have convenient way for avoiding memory leaks
# This class added this functionality. Most of the code inspired by backbone.marionette
#
# Examples:
#
# # Way to add subview in current view
# # When router will remove this view all nested/sub view will be remove automatically
# @createView SubView, collection: @something
calculate: (periodId) =>
r =
periodUnix: app.periods.idToUnix(periodId)
beginningCash: @get(app.periods.prevId(periodId))?.endingCash
if app.periods.notPast(periodId)
s = app.scenario.toJSON()
keys = ['revenue', 'cogs', 'custAcq', 'team', 'vendor']
_.each keys, (key) =>
days = if key is 'custAcq' then s.cust_acq_days else s["#{key}_days"]
calculate: (periodId) =>
# we use a 1 character variable for the return value since calculations are
# reused so many times for other calculations
r =
periodUnix: app.periods.idToUnix(periodId)
# regardless of plan/actual, beginning cash is last month's ending cash
beginningCash: @get(app.periods.prevId(periodId))?.endingCash
@adamrneary
adamrneary / time-slider-example.js
Last active August 29, 2015 14:08
Sample implementation of react-time-slider component
var TimeSlider = require('react-time-slider');
var Example = React.createClass({
render: function() {
var timeSlider = TimeSlider({
minFrom: 201402,
maxTo: 201411,
initialFrom: 201404,
initialTo: 201408,
onChange: function(values) {
@adamrneary
adamrneary / devops.js
Created December 3, 2014 16:45
new devops rules
if ( youHaveEnoughTimeToFuckingNailDevOps ) {
beSureToCaptureEverythingViaDevOpsToolsLikeAnAdult();
} else {
useSomethingLikeHerokuWhereAllConfigMustExpicitlyBeDeclared();
}
function beSureToCaptureEverythingViaDevOpsToolsLikeAnAdult () {
useVagrantAndOrDockerToCreateEnvironmentsYouCanSpinUpLocallyWithOneCommand();
useSomethingLikeConsulToCaptureAllGoofyConfigSoThatYouCanSpinUpProductionEnvsWithOneClick();
}
diff --git a/application.py b/application.py
index 15cb3eb..a37a14f 100644
--- a/application.py
+++ b/application.py
@@ -11,6 +11,7 @@ from util import ThrottleQueue
from boto.dynamodb.table import Table
from boto.dynamodb.item import Item
from boto import connect_dynamodb
+from boto import connect_kinesis