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
/* | |
Read a file with Node's fs instead of Meteor's Assets lib. | |
Originally used as a swap for Meteor's Assets.getText() method not working consistently. | |
*/ | |
import fs from 'fs'; | |
const file = 'some-file-in-private.html'; | |
// assets/app here is analagous to your /private directory in the root of your app. This is where Meteor ultimately | |
// stores the contents of /private in a built app. |
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.newUser.onRendered( () => { | |
$("#signUpForm").validate({ | |
highlight: function(element, errorClass) { | |
$(element).parent().addClass(errorClass); | |
}, | |
unhighlight: function(element, errorClass, validClass) { | |
$(element).parent().removeClass(errorClass).addClass(validClass); | |
}, | |
onfocusout: true, | |
errorClass: "has-error", |
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({ | |
authorizedMethod() { | |
Modules.server.executeIfAllowed( [ 'admin', 'manager' ], () => { | |
// Some secure task to complete here. | |
}); | |
} | |
}); |
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
Companies = new Meteor.Collection(); | |
{ | |
"Company 1": { | |
_id: "companyOne", | |
roles: [ | |
'bacon', | |
'eggs', | |
'biscuits' | |
] |
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
// RFC-822 formatting string for Moment.js. | |
let timestamp = 'ddd, DD MMM YYYY hh:mm:ss'; | |
// Note, the "z" character responsible for setting the three-character timezone for a date in Moment.js is now deprecated. | |
// An easy workaround for this is to generate your date/time using the string above, appending the timezone manually. | |
// | |
// e.g. return `${ timestamp } CST`; | |
// | |
// Here, "CST" would need to be calculated on your own and would likely be a variable unless timezone is fixed. |
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.publish( 'pagination', function( collection, split, page ) { | |
check( collection, String ); | |
check( split, Number ); | |
check( page, Match.OneOf( String, Number ) ); | |
var documents = global[ collection ].find( {}, { fields: { _id: 1 } } ).fetch(), | |
documentChunks = _.chunk( documents, split ), | |
filter = page ? parseInt( page, 10 ) : 0, | |
ids = _.map( documentChunks[ filter ], '_id' ); |
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
[ | |
{ | |
"offset": "GMT-12:00", | |
"name": "Etc/GMT-12" | |
}, | |
{ | |
"offset": "GMT-11:00", | |
"name": "Etc/GMT-11" | |
}, | |
{ |
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
[ | |
{ | |
"value":"International Date Line West", | |
"name":"(GMT-11:00) International Date Line West" | |
}, | |
{ | |
"value":"Midway Island", | |
"name":"(GMT-11:00) Midway Island" | |
}, | |
{ |
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
[ | |
{"group":"US (Common)", | |
"zones":[ | |
{"value":"America/Puerto_Rico","name":"Puerto Rico (Atlantic)"}, | |
{"value":"America/New_York","name":"New York (Eastern)"}, | |
{"value":"America/Chicago","name":"Chicago (Central)"}, | |
{"value":"America/Denver","name":"Denver (Mountain)"}, | |
{"value":"America/Phoenix","name":"Phoenix (MST)"}, | |
{"value":"America/Los_Angeles","name":"Los Angeles (Pacific)"}, | |
{"value":"America/Anchorage","name":"Anchorage (Alaska)"}, |
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
var isoCountries = { | |
'AF' : 'Afghanistan', | |
'AX' : 'Aland Islands', | |
'AL' : 'Albania', | |
'DZ' : 'Algeria', | |
'AS' : 'American Samoa', | |
'AD' : 'Andorra', | |
'AO' : 'Angola', | |
'AI' : 'Anguilla', | |
'AQ' : 'Antarctica', |
NewerOlder