This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from functools import partial | |
def some_view(request): | |
line_chart = LineChart() | |
render(request, 'template.html', { | |
'line_chart_as_html_200': partial(line_chart.as_html, line_chart, '200'), | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('button').on('click', function(e) { | |
var self = this; | |
e.preventDefault(); | |
user.get({ | |
limit: 1, | |
'mark_read': [$(this).attr('group')], | |
}).then(function(results) { | |
window.location = $(self).attr('href'); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var stream = require('getstream'); | |
var client = stream.connect('API_KEY', 'API_SECRET'); | |
var feed = client.feed('notification', 'bandsintown-' + Date.now()); | |
function errorHandler(error) { | |
console.error('Error: ', error['error']); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
HomeController = RouteController.extend({ | |
onBeforeAction: function () { | |
this.feedSubscription = feedSubscription; | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
activities: function() { | |
return Stream.feeds.flat.find({}, {sort: {time: -1}, limit: 3}); | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Template.cook.helpers({ | |
firstName: function() { | |
return this.userName.split(' ')[0]; | |
}, | |
recipeTitle: function() { | |
return RecipesData[this.recipeName].title; | |
}, | |
path: function() { | |
return Router.path('recipe', { name: this.recipeName }, | |
{ query: { activityId: this._id } }) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template name="cook"> | |
<a href="{{path}}" class="item-activity"> | |
<span class="attribution"> | |
<span class="avatar"> | |
<img src="{{userAvatar}}" class="image-avatar"> | |
</span> | |
<span class="meta"> | |
<span class="author">{{firstName}}</span> made <span class="recipe">{{recipeTitle}}</span>: {{text}} | |
{{#if place}}<span class="location">—{{place}}</span>{{/if}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template name="activity"> | |
{{#if equals this.verb 'cook'}} | |
{{> cook object}} | |
{{/if}} | |
{{#if equals this.verb 'bookmark'}} | |
{{> bookmark}} | |
{{/if}} | |
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (! this.isSimulation && loc && loc.coords) | |
activity.place = getLocationPlace(loc); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template name="activity"> | |
{{#with object}} | |
<a href="{{path}}" class="item-activity"> | |
<span class="attribution"> | |
<span class="avatar"> | |
<img src="{{userAvatar}}" class="image-avatar"> | |
</span> | |
<span class="meta"> | |
<span class="author">{{firstName}}</span> made <span class="recipe">{{recipeTitle}}</span>: {{text}} |
NewerOlder