Skip to content

Instantly share code, notes, and snippets.

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 + '...');
Template.foo.helpers({
stepsWithIndex: function() {
return _.map(this.steps, function(value, index) {
return {
index: index,
value: value
};
});
}
});
@dburles
dburles / gist:d461e4701eeeb89e884a
Created February 26, 2015 10:31
SimpleSchema password + password (confirm)
... = new SimpleSchema({
password: {
label: "Password *",
type: String
},
passwordConfirm: {
label: "Password (Confirm)",
type: String,
custom: function() {
if (this.value !== this.field('password').value) {
http://localhost:3000/enroll-account/vHHzHoBaN5Hc65mye
@dburles
dburles / .eslintrc
Last active March 24, 2017 15:44
Eslint configuration for Meteor projects
{
"env": {
"browser": true,
"meteor": true
},
"ecmaFeatures": {
"arrowFunctions": true,
"blockBindings": true,
"classes": true,
"defaultParams": true,
if (Meteor.isClient) {
StaticPosts = new Mongo.Collection(null);
fetchAndInsert('test', StaticPosts, (error, response) => {
// ...
});
}
if (Meteor.isServer) {
Meteor.methods({
{
"color_scheme": "Packages/User/SublimeLinter/PlainText (SL).tmTheme",
"draw_white_space": "all",
"folder_exclude_patterns":
[
".svn",
".git",
".hg",
"CVS",
".meteor"
/* Meteor's ES6 Javascript linting configuration
*
* Documentation on rules can be found at:
* http://eslint.org/docs/rules/ <- Optionally append the rulename
*
*/
{
"parser": "babel-eslint",
"env": {
"browser": true,
{
"extends": ".eslintrc-meteor",
"rules": {
/**
* ES6 Specific
*/
"no-var": 0, // http://eslint.org/docs/rules/no-var
"prefer-arrow-callback": 1, // http://eslint.org/docs/rules/prefer-arrow-callback
"prefer-const": 1, // http://eslint.org/docs/rules/prefer-const
"prefer-spread": 1, // http://eslint.org/docs/rules/prefer-spread
// Backend config example
// http://jlongster.com/Backend-Apps-with-Webpack--Part-I
var path = require('path');
var webpack = require('webpack');
var fs = require('fs');
var nodeModules = {};
fs.readdirSync('node_modules')
.filter(function(x) {