This file contains hidden or 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 Q = require('q'), | |
| _ = require('lodash'); | |
| var mapAndResolveAll = _.compose(Q.all, _.map); | |
| function loadWithPattern(pattern) { | |
| return function(entity) { | |
| return loadEntity(entity, pattern); | |
| }; | |
| } |
This file contains hidden or 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 Q = require('q'), | |
| _ = require('lodash'); | |
| /* | |
| * Functional Helpers | |
| */ | |
| /** | |
| * Compose two functions into one | |
| * @param {Function} a |
This file contains hidden or 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
| // place in root launchpad folder | |
| var entityDao = require('./server/services/entity-dao'), | |
| config = require('./server/config/config'), | |
| systemService = require('./server/services/mj-entity-service/mj-entity-service'); | |
| entityDao.connect(config.db) | |
| .then(actions) | |
| .fail(onError); |
This file contains hidden or 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 Parser = {}; | |
| Parser.parseFields = function(fields) { | |
| var parser = new LoadTierParser(), | |
| tokenizer = new Tokenizer(fields); | |
| return parser.parseTier(tokenizer, false); | |
| }; | |
| function LoadTierParser(parent) { |
This file contains hidden or 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
| /* | |
| * JavaScript Constant | |
| * | |
| * Create constants via Api | |
| * Retreive values from window/global without Api | |
| * | |
| * This will work in both browsers and node | |
| * | |
| * Enforces standard rules: | |
| * Requires uppercase naming conventions |
This file contains hidden or 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
| // delimter to join flattened keys | |
| var delimiter = ' ' | |
| /* | |
| * Flattens an object | |
| * @param {object} object - object to flatten | |
| * @param {boolean} shallow - if true object is only flattened one level | |
| * @return {object} - flattened object | |
| */ | |
| function flatten(object, shallow) { |
This file contains hidden or 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 _ = require('lodash'), | |
| argv = require('yargs').argv, | |
| input = _.first(argv._); | |
| // everything else will default to 1 | |
| var defaults = { | |
| ideaCount: 4, | |
| questionCount: 2 | |
| }; |
This file contains hidden or 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 mongoose = require('mongoose'); | |
| var Entity = require('./server/models/entity') | |
| var Q = require('q'); | |
| var db = mongoose.connect('mongodb://localhost/lp-test'); | |
| test1(); |
This file contains hidden or 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
| <!-- Alerts are easily shown using the below syntax. | |
| This HTML snippet can be used to display all Bootstrap alert styles. --> | |
| <div ng-show='alert' class="alert alert-{{ alert.type }}"> | |
| <p>{{ alert.message }}</p> | |
| </div> | |
| <!-- I decided to go the fading alert route | |
| but you could esily make the alerts dismissable |
This file contains hidden or 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
| -- A little practice exploring a relatively complex SQL query, | |
| -- and comparing it to the ActiveRecord equivelent. | |
| -- This is close to something I implemented in a real Rails project. | |
| -- This gets the first 10 applications in the database that have 'Games' as their primary genre. | |
| SELECT app.title AS 'Application Title', g.name as 'Primary Genre' | |
| FROM application AS app | |
| JOIN genre_application AS g_app | |
| ON app.application_id = g_app.application_id |