Skip to content

Instantly share code, notes, and snippets.

Avatar

Matthisk Heimensen matthisk

View GitHub Profile
View example.py
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'),
})
View linkplusaction.js
$('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');
});
@matthisk
matthisk / notification-delete.js
Last active Jun 22, 2016
Reproducing an issue with the Notification feed
View notification-delete.js
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']);
}
View router.js
HomeController = RouteController.extend({
onBeforeAction: function () {
this.feedSubscription = feedSubscription;
}
});
View home.js
activities: function() {
return Stream.feeds.flat.find({}, {sort: {time: -1}, limit: 3});
},
View activity.js
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 } })
View activity.html
<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">&mdash;{{place}}</span>{{/if}}
View activity.html
<template name="activity">
{{#if equals this.verb 'cook'}}
{{> cook object}}
{{/if}}
{{#if equals this.verb 'bookmark'}}
{{> bookmark}}
{{/if}}
</template>
View localmarket-bug.js
if (! this.isSimulation && loc && loc.coords)
activity.place = getLocationPlace(loc);
View activity.html
<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}}
You can’t perform that action at this time.