Skip to content

Instantly share code, notes, and snippets.

View particlebanana's full-sized avatar

Cody Stoltman particlebanana

View GitHub Profile
@particlebanana
particlebanana / keybase.md
Created October 23, 2017 20:45
Keybase Proof

Keybase proof

I hereby claim:

  • I am particlebanana on github.
  • I am particlebanana (https://keybase.io/particlebanana) on keybase.
  • I have a public key ASAh5PURM8Grk0dq4iEGRXSFQ2QmMBy-JpMxUAW0_4TCXwo

To claim this, I am signing this object:

@particlebanana
particlebanana / repos.md
Last active September 22, 2016 00:22
Waterline Repos

Nu Waterline Repos

These are the various pieces that involved in the new version of Waterline. It's a major update that brings in a lot of low-level functionality into userland code.

Top Level

Waterline Query Docs

URL: https://github.com/treelinehq/waterline-query-docs

@particlebanana
particlebanana / set-npmrc.js
Created June 9, 2016 22:56
Script to dynamically build up .npmrc in production
// ╔═╗╦═╗╔═╗╦╔╗╔╔═╗╔╦╗╔═╗╦ ╦ ┌─┐┌─┐┌┬┐ ┌┐┌┌─┐┌┬┐┬─┐┌─┐ ┌─┐┬┬ ┌─┐
// ╠═╝╠╦╝║╣ ║║║║╚═╗ ║ ╠═╣║ ║ └─┐├┤ │ │││├─┘│││├┬┘│ ├┤ ││ ├┤
// ╩ ╩╚═╚═╝╩╝╚╝╚═╝ ╩ ╩ ╩╩═╝╩═╝ └─┘└─┘ ┴ ┘└┘┴ ┴ ┴┴└─└─┘ └ ┴┴─┘└─┘
//
// Used in production to install npm private modules
if(process.env.NODE_ENV !== 'production') {
return;
}
var fs = require('fs');
@particlebanana
particlebanana / connections.js
Created January 25, 2016 20:48
Mongo Connections Issue
module.exports.connections = {
localMongoDb: {
adapter: 'sails-mongo',
host: 'localhost',
port: 27017,
database: 'mongo-one'
},
localMongoDbTwo: {
@particlebanana
particlebanana / User.js
Created March 29, 2015 21:23
Mongo association examples
/**
* User.js
*
* @description :: TODO: You might write a short summary of how this model works and what it represents here.
* @docs :: http://sailsjs.org/#!documentation/models
*/
module.exports = {
attributes: {
var _ = require('lodash'),
async = require('async'),
Waterline = require('waterline');
// Instantiate a new instance of the ORM
var orm = new Waterline();
var mysqlAdapter = require('sails-mysql');
var config = {
@particlebanana
particlebanana / waterline-express-example.js
Last active October 31, 2019 15:53
How to load the beta of Waterline v0.10 when using Express.js Make sure to use the `associations` branch of any adapters you plan on loading.
/**
* A simple example of how to use Waterline v0.10 with Express
*/
var express = require('express'),
_ = require('lodash'),
app = express(),
Waterline = require('waterline');
@particlebanana
particlebanana / bootstrap.js
Created September 18, 2013 21:43
Mocha before helper to show how to lift Sails
/**
* Bootstrap
*/
var Sails = require('sails');
/**
* Before ALL the test bootstrap the server
*/
@particlebanana
particlebanana / StoreController.js
Created September 5, 2013 03:38
An example of injecting dynamic routes for a language based app. See: https://github.com/balderdashy/sails/issues/821
// An example controller from /api/controllers/StoreController.js
module.exports = {
typeA: function(req, res) {
res.send('typeA action with Lang Type: ' + req.languageType);
},
typeB: function(req, res) {
res.send('typeB action with Lang Type: ' + req.languageType);
// Simple User model
// /api/models/User.js
module.exports = {
attributes: {
name: 'string'
}
};