Skip to content

Instantly share code, notes, and snippets.

Meteor.methods({
'findUrls': function getGists(url) {
var cheerio = Meteor.require('cheerio');
var urlResponse;
try{
urlResponse = Meteor.http.get(url);
if(urlResponse.statusCode !== 200){
return {images:new Array()};
}
}
Errors.deny({
insert: function(userId,doc){
if(Errors.find().count() > 0)
{
return true;
}
else
{
return false;
}
subs = new SubsManager({
// will be cached only 20 recently used subscriptions
cacheLimit: 20,
// any subscription will be expired after 5 minutes of inactivity
expireIn: 20
});
Router.configure({
layoutTemplate: 'layout',
loadingTemplate: 'loading'
Meteor.publish('userData', function() {
if(!this.userId)
{
this.ready();
return null;
}
return Meteor.users.find(this.userId, {fields: {username:1,roles:1}});
});
this.route('project',{
path: '/:_domain/projects/:_project',
layoutTemplate: 'privateLayout',
loadingTemplate: 'loading',
data: function(){
return {'domainname':this.params._domain};
},
waitOn: function(){
return [subs.subscribe('userDomain',this.params._domain),subs.subscribe('projects'),subs.subscribe('tasks'),subs.subscribe('images')];
},
Meteor.publish('userDomain', function(domainName) {
var domain,users;
domain = Domains.find({name:domainName});
if(domain.count() <= 0)
{
this.ready();
return null;
}
var domainId = domain.fetch()[0]._id;
if(!domainId)
var subs = new SubsManager({
// will be cached only 20 recently used subscriptions
cacheLimit: 20,
// any subscription will be expired after 5 minutes of inactivity
expireIn: 20
});
Router.configure({
layoutTemplate: 'layout',
loadingTemplate: 'loading'
this.route('project',{
path: '/:_domain/projects/:_project',
onBeforeAction : 'loading',
data: function(){
return {'name':this.params._domain};
},
waitOn: function(){
var subscription = subs.subscribe('userDomain',this.params._domain,function(){
if(Domains.find().count() <= 0)
{
Template.sidebarProject.projectPath = function(){
return Router.path('project',{_project:'blabla',_domain:'cyan'});
};
Template.sidebarProject.events({
'click #projectLink' : function(e,t)
{
e.preventDefault();
}
});
=> Started proxy.
=> Started MongoDB.
I20140718-11:38:32.833(2)? Jasmine-Unit is loaded
I20140718-11:38:32.930(2)? [velocity] PWD /Users/mango/Desktop/mymeteorapp
I20140718-11:38:33.041(2)? Check for test package configs... [ 'packages/blaze-layout/examples/simple/smart.json',
I20140718-11:38:33.041(2)? 'packages/blaze-layout/smart.json',
I20140718-11:38:33.041(2)? 'packages/chosen-package/smart.json',
I20140718-11:38:33.041(2)? 'packages/collection-hooks/smart.json',
I20140718-11:38:33.041(2)? 'packages/collection2/smart.json',
I20140718-11:38:33.042(2)? 'packages/handlebar-helpers/smart.json',