Skip to content

Instantly share code, notes, and snippets.

View protodave's full-sized avatar

protodave protodave

View GitHub Profile
@protodave
protodave / gist:8d4d4700509ed36b825e
Last active August 29, 2015 14:06
Meteor app level Mongo `Distinct` emulation
var userTeams = Teams.find({
members: {
$in: [this.userId]
}
});
var userTeamMembers = _.chain(userTeams.fetch())
.map(function (team) {
return team.members;
})
@protodave
protodave / gist:ffddb1273dd75563b3d2
Created December 30, 2014 22:14
Meteor shared function pattern
// Common, shared functions kept it the "app" namespace
Meteor.app = Meteor.app || {};
Meteor.app.helpers = {
placeholder: function () {
return null;
}
};
views/main/main.js
Template.main.rendered = function () {
$('body').scroll(function() {
var scrollTop = $(window).scrollTop();
// Do something now with this change here directly...
// :TODO:
// and/or save to Session so we can use it reactively
@protodave
protodave / gist:40698bbdc50b1a70a20f
Last active August 29, 2015 14:13
Avoiding the FOUI (Flash of Unstyled Icon) in Iconic
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Demo for Brian K.</title>
<script src="js/iconic.min.js"></script>
</head>
<body>