Skip to content

Instantly share code, notes, and snippets.

View mikermcneil's full-sized avatar
🧑‍🚀

Mike McNeil mikermcneil

🧑‍🚀
View GitHub Profile
{
"generators": {
"modules": {
"gruntfile": "sails-generate-gruntfile-federated",
"frontend": "sails-generate-frontend-angular"
}
}
}
@mikermcneil
mikermcneil / dominance-in-many-to-many-cross-adapter-associations.md
Last active August 29, 2015 13:56
Understanding "dominance" in cross-adapter (many-to-many) associations

Example Ontology

// User.js
module.exports = {
  connection: 'ourMySQL',
  attributes: {
    email: 'string',
 wishlist: {
# So there's stuff on the `v0.10` branch you want to show up on `master`.
# First, get everything up to date locally:
git checkout master
git pull origin master
git checkout v0.10

Because I always forget.

To grant operator status to someone in a channel on freenode:

/msg chanserv op #sailsjs mikermcneil

To change the topic

#so if you publish to the beta tag and it sets it as the latest you can do:
npm tag waterline@0.9.11 latest
#and it fixes it I just found out
@mikermcneil
mikermcneil / closure-policy-example.md
Created March 24, 2014 23:55
you can specify either a string or a function on the right hand side in your config/policies.js file - see http://blog.thesparktree.com/post/77311774912/creating-a-sails-application-using-passport

so you'd do something like:

var isAllowedTo = require('../api/policies/isAllowedTo');
module.exports = {
  UserController: {
    create: isAllowedTo('createUser')
  }
}
// Exciting globals!!!
var getIsACommandKeyDown = function () {
return IS_RIGHT_COMMAND_KEY_PRESSED || IS_LEFT_COMMAND_KEY_PRESSED;
};
var IS_LEFT_COMMAND_KEY_PRESSED;
var IS_RIGHT_COMMAND_KEY_PRESSED;
$(window).keydown(function (e) {
// Count all records
(function (){async.each(Object.keys(sails.models), function(mi, n) { var m = sails.models[mi]; m.count({}).exec(function(err, c) { if (err) return n(err); console.log('there are ' + c + ' ' + m.identity + ' records.'); }) }, console.log)})()
// Expanded version, for reference
//async.each(Object.keys(sails.models), function(mi, n) {
// var m = sails.models[mi];
// m.count({}).exec(function(err, c) {
// if (err) return n(err);
// console.log('there are ' + c + ' ' + m.identity + ' records.');
# for posterity
==> Pouring mysql-5.6.17_1.mavericks.bottle.tar.gz
==> Caveats
A "/etc/my.cnf" from another install may interfere with a Homebrew-built
server starting up correctly.
To connect:
mysql -uroot