This file contains hidden or 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 (Meteor.isClient) { | |
| StaticPosts = new Mongo.Collection(null); | |
| fetchAndInsert('test', StaticPosts, (error, response) => { | |
| // ... | |
| }); | |
| } | |
| if (Meteor.isServer) { | |
| Meteor.methods({ |
This file contains hidden or 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
| { | |
| "env": { | |
| "browser": true, | |
| "meteor": true | |
| }, | |
| "ecmaFeatures": { | |
| "arrowFunctions": true, | |
| "blockBindings": true, | |
| "classes": true, | |
| "defaultParams": true, |
This file contains hidden or 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
| ... = new SimpleSchema({ | |
| password: { | |
| label: "Password *", | |
| type: String | |
| }, | |
| passwordConfirm: { | |
| label: "Password (Confirm)", | |
| type: String, | |
| custom: function() { | |
| if (this.value !== this.field('password').value) { |
This file contains hidden or 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.foo.helpers({ | |
| stepsWithIndex: function() { | |
| return _.map(this.steps, function(value, index) { | |
| return { | |
| index: index, | |
| value: value | |
| }; | |
| }); | |
| } | |
| }); |
This file contains hidden or 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 timeout; | |
| var batch = []; | |
| batcher = function(attributes) { | |
| batch.push(attributes); | |
| if (! timeout) { | |
| // send whatever we have in the queue after 5 seconds | |
| timeout = setTimeout(function() { | |
| console.log('sending a batch of ' + batch.length + '...'); |
This file contains hidden or 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
| Blaze.TemplateInstance.prototype.setDefault = function(key, value) { | |
| return Session.setDefault(this.view.name + '.' + key, value); | |
| }; | |
| Blaze.TemplateInstance.prototype.set = function(key, value) { | |
| return Session.set(this.view.name + '.' + key, value); | |
| }; | |
| Blaze.TemplateInstance.prototype.get = function(key) { | |
| return Session.get(this.view.name + '.' + key); |
This file contains hidden or 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 (Meteor.isClient) { | |
| Template.hello.created = function() { | |
| this.setDefault('counter', 0); | |
| }; | |
| Template.hello.helpers({ | |
| counter: function() { | |
| var template = Template.instance(); | |
| return template.get('counter'); | |
| } |
This file contains hidden or 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.foo.events({ | |
| 'keyup .bar': _.debounce(function(event) { | |
| // ... | |
| }, 300) | |
| }); |
This file contains hidden or 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
| Router.static = function(options) { | |
| options = options || {}; | |
| if (! options.path) | |
| throw new Meteor.Error("Router.static: options.path is required"); | |
| return { | |
| where: 'server', | |
| path: options.path, | |
| action: function() { |
This file contains hidden or 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 (Meteor.isServer) { | |
| Router.handlebars = (function(fn) { | |
| return function (options) { | |
| options.template = Handlebars.templates[options.template]; | |
| return fn(options); | |
| }; | |
| }(Router.handlebars)); | |
| } | |
| Router.configure({ |