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
| // ... | |
| rendr_stitch: { | |
| // ... | |
| files: [{ | |
| // ... | |
| src: [ | |
| // ... | |
| // add your handlebars helpers to the src array to be stitched | |
| 'assets/handlebars/*.js' | |
| ] |
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 express = require('express'), | |
| http = require('http'), | |
| rendr = require('rendr'), | |
| config = require('config'), | |
| mw = require('./server/middleware'), | |
| DataAdapter = require('./server/lib/data_adapter'), | |
| io = require('socket.io'), | |
| ioServer, | |
| webSocket, | |
| app, |
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
| //could look more like | |
| function _getGeoJson(req, res) { | |
| GeoJsonModel.findByOptions(req.params.lsad, req.query) | |
| .then(function success (stream) { | |
| if (req.query.asGeoJSON === true) { | |
| utils.streamApiDataAsGeoJson(res, stream); | |
| } else { | |
| utils.streamApiDataAsArray(res, stream); |
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
| //Building RendrRoutes | |
| // given | |
| [ '/', { controller: 'maps', action: 'index' }, [Function] | |
| //render.server.initApp.js (sole export) | |
| function (req, res, next) { | |
| var App, app; | |
| App = require(rendr.entryPath + '/app/app'); |
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 basic example of how Ruby's constantize _could_ work in JS | |
| // See https://apidock.com/rails/String/constantize | |
| function constantize (str) { | |
| if (typeof str !== 'string') { | |
| throw new TypeError('must pass in type of string'); | |
| } | |
| if (str.match(/\W|\d/)) { | |
| throw new SyntaxError('must pass in a valid Javascript name'); | |
| } |
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 rough demo of extends vs extend | |
| /* | |
| * Extends - the second object needs to already be initialized | |
| * after that, it will extend the first object | |
| * | |
| * var o1 = {"a": 1, "b": 2}; | |
| * var o2 = {}; | |
| * o2.extends(o1); | |
| */ |
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
| function parse_git_branch { | |
| git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' | |
| } | |
| function superprompt { | |
| local RED="\[\033[0;31m\]" | |
| local LIGHT_RED="\[\033[1;31m\]" | |
| export PS1="\[\e]2;\u@\h\a[\[\e[37;44;1m\]\t\[\e[0m\]]$RED\$(parse_git_branch) \[\e[32m\]\W\[\e[0m\] \$ " | |
| PS2='> ' |
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
| [client] | |
| user="root" | |
| pass="root" | |
| port=8889 | |
| socket="/Applications/MAMP/tmp/mysql/mysql.sock" |
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 mta = {}; //simple object w/ a few properties | |
| mta.visibleStops = 10; //10 visible items/stops at time | |
| mta.unformattedStops = []; // will hold the FULL array of stops | |
| mta.formattedStops = []; // will hold the formatted array of stops | |
| mta.sint = 0; //starting int | |
| //wrapper function that calls everything else | |
| mta.startTrain = function(){ | |
| //format if not already formatted | |
| if($('#next').children().length === 0){ |