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.route('/hello/:param', function(){ | |
this.render('home'); | |
}); |
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 name="postsList"> | |
<div class="posts"> | |
{{#each posts}} | |
{{> postItem}} | |
{{/each}} | |
{{# if postsReady}} | |
{{# unless allPostsLoaded}} | |
{{listenScroll}} | |
{{/unless}} |
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 bobId = Meteor.users.insert({ | |
profile: {name: 'Bob Jones'} | |
}); | |
var bob = Meteor.users.findOne({_id: bobId}); | |
for (var i = 0; i < 45; i++) { Posts.insert({ | |
title: 'Test post #' + i, | |
author: bob.profile.name, | |
userId: bob._id, |
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
//This node.js file generates a file called pythonfile.py in the CWD. | |
var fs = require('fs'); | |
python = fs.createWriteStream('pythonfile.py'); | |
python.write('def myfun(*args):\n'); | |
python.write('\tx = 0\n'); | |
python.write('\tfor i in args:\n'); | |
python.write('\t\tx+=i\n'); |
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
def takesArbitraryNumberOfArgs(*args): | |
return args | |
#args tuple provided in function scope | |
def defineArbitraryArgsOnTheFly(**kwargs): | |
return kwargs | |
#kwargs dictionary provided in function scope. | |
x = takesArbitraryNumberOfArgs('bob,234,'lol') |
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.configure({ | |
layoutTemplate: 'ApplicationLayout', | |
notFoundTemplate: 'notFound', | |
yieldTemplates: { | |
'header': {to: 'heading'} | |
} | |
}); | |
Router.map(function(){ | |
this.route('postsList', { |
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.configure({ | |
layoutTemplate: 'ApplicationLayout', | |
notFoundTemplate: 'notFound', | |
yieldTemplates: { | |
'header': {to: 'heading'} | |
} | |
}); | |
// function requireLogin(pause){ | |
// if (!Meteor.userId()){ |
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
function requireLogin(pause){ | |
console.log('requireLogin run') | |
if (!Meteor.userId()){ | |
if (Meteor.loggingIn()){ | |
this.render('loading'); | |
} else { | |
console.log('accessDeny'); | |
this.render('accessDenied'); | |
} | |
pause(); |
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.configure({ | |
layoutTemplate: 'ApplicationLayout', | |
notFoundTemplate: 'notFound', | |
yieldTemplates: { | |
'header': {to: 'heading'} | |
} | |
}); | |
var requireLogin = function(pause){ | |
if (!Meteor.userId()){ |
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.configure({ | |
layoutTemplate: 'ApplicationLayout', | |
notFoundTemplate: 'notFound', | |
yieldTemplates: { | |
'header': {to: 'heading'} | |
} | |
}); | |
var requireLogin = function(pause){ | |
if (!Meteor.userId()){ |