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
EditableText.registerCallbacks({ | |
// Callback for editing category limit/budget. | |
budgetCurrency: function(doc) { | |
// Variables based on editing. | |
var oldVal = this.oldValue; | |
var newVal = this.newValue; | |
// Verification: | |
if (isNaN(newVal)) { |
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
// Application interface (main) | |
Router.route('/app', function() { | |
this.render('/app', { | |
data: { | |
categories: function() { | |
return Categories.find({userId: Meteor.userId()}); | |
}, | |
transactions: function() { | |
return Transactions.find({userId: 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
Template.groupsSingle.helpers({ | |
// Generate tag list | |
tagList: function() { | |
return this.tags; | |
}, | |
rosterList: function() { | |
var theHTML = ""; |
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
for (var i = 1; i <= numRanks; i++) { | |
var rankName = theRanks[i-1].name + "s"; | |
theHTML += "<h5>" + rankName + "</h5>"; | |
var theGroup = _.filter(theRoster, function(item) { return item.rank === i; }); | |
console.log(JSON.stringify(theGroup)); | |
// Check for empty rank (no members of rank) | |
if (_.isEmpty(theGroup)) { | |
theHTML += "<ul><li>None</li></ul>"; | |
} else { | |
theHTML += "<ul>"; |
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
# Generate client objects from list of users at time of startup. | |
theNames.forEach (doc) -> | |
CLIENTS[doc.profile.name] = new WASDbot | |
server: 'irc.twitch.tv' | |
port: 6667 | |
nick: "wasdboss" | |
realname: "wasdboss" | |
username: "wasdboss" | |
servpass: "oauth:cd3sm3q4klbgl7dt3c6gwbu5x08gj5" | |
channels: ["#" + doc.profile.name] |
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.route('profile', { | |
path: '/profile/:username', | |
waitOn: function() { | |
return this.subscribe("userByUsername", this.params.username); | |
}, | |
data: function() { | |
var userDoc = Meteor.users.findOne({"username": this.params.username}); | |
// Guard against non-ready user document. | |
if (!userDoc) { |
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.route('profile', { | |
path: '/profile/:username', | |
data: function() { | |
console.log(this.params.username); | |
var userCursor = Meteor.users.findOne({"username": this.params.username}); | |
console.log(JSON.stringify(userCursor)); | |
var bookCursor = Books.find({owner: userCursor._id}); | |
return { | |
theUser: userCursor, | |
theBooks: bookCursor |
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
Meteor.startup (function() { | |
if (Prefixes.find().count() == 0) { | |
prefixes = [ | |
{ | |
"prefix": "ADNR" | |
}, | |
{ | |
"prefix": "AHNR" |
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
classCount: function() { | |
// Attempt aggregation of the books table to count by class, maybe. | |
var db = MongoInternals.defaultRemoteCollectionDriver().mongo.db; | |
var col = db.collection("books"); | |
var aggregateSync = Meteor._wrapAsync(col.aggregate.bind(col)); | |
var pipeline = [ | |
{$group: {_id: "$class", count: {$sum: 1}}}, | |
{$sort: {_id: 1}} | |
]; |
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.route('browse-class', { | |
path: '/browse/:class', | |
data: function() { | |
"class": this.params.class, | |
numBooks: Books.find({"class": this.params.class},{sort:{"createdAt": 1}}).count(), | |
books: Books.find({"class": this.params.class},{sort:{"createdAt": 1}}) | |
} | |
}); |
NewerOlder