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
Blaze.registerHelper('ifEqualReturn', function (cond1, cond2, first, second) { | |
return cond1 === cond2 ? first : second; | |
}); |
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
(function () { | |
var url = Meteor.absoluteUrl(); | |
url = url.replace(/https?:\/\//, ''); | |
var slash = url.indexOf('/'); | |
var subpath = url.substring(slash); | |
subpath = subpath.substring(0, subpath.length-1); | |
var oldRoute = Router.route; | |
Router.route = function (name, options) { | |
arguments[1].path = subpath + options.path; | |
return oldRoute.apply(this, arguments); |
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
Blaze.registerHelper('isEqual', function (lhs, rhs) { | |
return lhs === rhs; | |
}); |
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
#!/usr/bin/env node | |
var fs = require('fs'); | |
console.log('Copy the following into .idea/PROJECT_NAME.iml inside of module>component>content:\n'); | |
console.log( | |
['<excludeFolder url="file://$MODULE_DIR$/app/.meteor" />'].concat( | |
// read the packages directory | |
fs.readdirSync(process.argv[2] || 'packages') | |
// filter out hidden folders/files | |
.filter(function (d) { | |
return d[0] !== '.'; |
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="main"> | |
{{> my_tmpl op1=5 op2=10 }} | |
</template> | |
<template name="my_tmpl"> | |
{{#with newData}} | |
{{#with}} | |
</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
function allowedSelector(selector, updateStatement) { | |
var selectors = []; | |
var allowed = true; | |
_.each(Object.keys(selector), function (key) { | |
var matcher; | |
if (key !== '_id') { | |
var parts = key.split('.') | |
matcher = parts.length > 1 ? new RegExp('^' + escapeRegex(parts[0] + '.$.') + '[A-Za-z]+$') : | |
new RegExp('^' + escapeRegex(parts[0] + '.$') + '$'); | |
if (!usesKey(matcher updateStatement)) { |
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
/* global Tinytest:true */ | |
/* global testAsyncMulti:true */ | |
'use strict'; | |
if (Meteor.isServer) { | |
Meteor.methods({ | |
'remove-all-users': function () { return Meteor.users.remove({}); } | |
}); | |
} | |
if(Meteor.isClient) (function () { |
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
Meteor.methods({ | |
average_sales: function(options) { | |
var self, start_day, total_sales, yesterday; | |
self = this; | |
this.unblock(); | |
start_day = moment().tz("America/Los_Angeles").subtract("days", 77).startOf('day'); | |
yesterday = moment().tz("America/Los_Angeles").subtract("days", 1).endOf("day"); | |
total_sales = 0; | |
var query = { |
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
_.each(large_array, function (el) { | |
setTimeout(function () { | |
// do calculation | |
}, 0); | |
}); |
NewerOlder