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
console.col = { | |
colours: { | |
red: "31", // prefix with 1; for light/bold colours | |
green: "32", | |
yellow: "33", | |
blue: "34", | |
magenta: "35", | |
cyan: "36", | |
default: "0", | |
white: "0", |
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
// monkey patch Meteor.Accounts to store login token in sessionStoage instead of localStorage | |
// https://forums.meteor.com/t/security-dont-store-tokens-in-localstorage/50539/13 | |
// original code: https://github.com/meteor/meteor/blob/af26e8b052a5135033e561cf4e4347eee585ab3b/packages/accounts-base/accounts_client.js#L477 | |
Accounts._storeLoginToken = function(userId, token, tokenExpires) { | |
Meteor._localStorage.setItem(this.USER_ID_KEY, userId); | |
sessionStorage.setItem(this.LOGIN_TOKEN_KEY, token); | |
if (! tokenExpires) | |
tokenExpires = this._tokenExpiration(new Date()); |
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
<script> | |
// <Interval delay="10m" @tick="doSomething()" immediate /> | |
// delay = 100[ms|s|m|h|d] - default is ms | |
// immediate = true/false, emit the 'tick' event immediately upon creation | |
export default { | |
props: { | |
delay: { | |
required: true, | |
}, |
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
Date.prototype.addMins = function(mins) { | |
var dat = new Date(this.valueOf()); // make a new date coz we can't change the original | |
dat.setMinutes(dat.getMinutes() + mins*1); // force mins to be integer instead of string | |
return dat; | |
}; | |
Date.prototype.addDays = function(days) { | |
var dat = new Date(this.valueOf()); // make a new date coz we can't change the original | |
dat.setDate(dat.getDate() + days*1); // force days to be integer instead of string | |
return dat; |