Skip to content

Instantly share code, notes, and snippets.

@aaronthorp
aaronthorp / README.md
Last active August 29, 2015 13:56
Meteor.js - Iron-Router Login Controller. @aaronthorp

Meteor.js - Iron-Router Login Controller

My code that utilises the accounts-entry package and manages authentication on routes

Support us via Gittip

@aaronthorp
aaronthorp / README.md
Last active August 29, 2015 13:56
Meteor.js Render and run JS once

Meteor.js - Render Run Once

Code implementation to execute code once on initial template render

Support us via Gittip

@aaronthorp
aaronthorp / README.md
Last active March 16, 2016 13:01
Meteor.js - Multiplayer Meteor Login Logic. @aaronthorp

Meteor.js - Multiplayer Game Logic

Code implementation for simple multiplayer on login. Requrires accounts-entry or similar login forms and profile-online

Support us via Gittip

@aaronthorp
aaronthorp / fix-arrays.js
Created January 16, 2014 01:48
Convert Single value array to non-Array values in Array of Objects
FixArrays = function(arrayObject) {
var temp = {};
_.each(arrayObject , function(value, key, list) {
if (value instanceof Array)
if (value.length === 1)
temp[key] = value[0];
else
temp[key] = value;
@aaronthorp
aaronthorp / README.md
Last active January 3, 2016 05:29
Meteor.js - DDP Remote Connection for Meteor. @aaronthorp

Meteor.js - DDP Remote Connection for Meteor

Simple code fragment for connecting to remote collections via DDP

Support us via Gittip

@aaronthorp
aaronthorp / mail-sendgrid.js
Last active November 9, 2017 03:23
SMTP via SendGrid using Email package with Meteor
if (Meteor.isServer) {
Meteor.startup(function () {
process.env.MAIL_URL = 'smtp://username:[email protected]';
Accounts.emailTemplates.siteName = "My Website Name";
Accounts.emailTemplates.from = "My Website Name <[email protected]>";
Accounts.emailTemplates.resetPassword.subject = function(user) {
return "How to reset your password for My Website Name";
@aaronthorp
aaronthorp / logout.js
Created January 13, 2014 12:12
Meteor - logoutOtherClients()
Meteor.autorun(function() {
if (Meteor.user()) {
Meteor.logoutOtherClients(function(err) {
if (err)
console.log("Logout Error: " + err);
});
console.log("login");
} else {
console.log("logout");
}
@aaronthorp
aaronthorp / user-sessions.js
Created January 8, 2014 21:23
"UserSessions" Object for Meteor, place in /lib folder. (Hacked from https://github.com/BenjaminRH/meteor-user-session and made work properly.)
// This collection is where the UserSession variables are ultimately stored
UserSessionCollection = new Meteor.Collection('userSessionCollection');
// Anonymous user error
noUserError = function () {
console.log('You cannot use UserSession methods when there is no user logged in.');
}
// Missing userId error
noUserIdError = function () {
@aaronthorp
aaronthorp / README.md
Last active September 22, 2017 19:09
Meteor.js - Fibers/Future For Client-Server Return. @aaronthorp

Meteor.js - Fibers/Future For Client-Server Return

Provides future implementation for Meteor.call functions returning data to the client side.

Support us via Gittip

@aaronthorp
aaronthorp / README.md
Last active January 2, 2016 08:49
Meteor.js Collection with PeerDB integration. @aaronthorp

Meteor.js Collections with PeerDB and CoffeeScript

Collections exteneded with PeerDB package for denormalized approach to data storage in MongoDB. Requires coffeescript and peerdb packages.

Support us via Gittip