- Set
NODE_ENV
toproduction
on Heroku withheroku config:set NODE_ENV=production
- This sets the
NODE_ENV
environment variable on Heroku
This file has been truncated, but you can view the full file.
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
{ | |
"a": "The first letter of the English and of many other alphabets.The capital A of the alphabets of Middle and Western Europe, as alsothe small letter (a), besides the forms in Italic, black letter,etc., are all descended from the old Latin A, which was borrowed fromthe Greek Alpha, of the same form; and this was made from the firstletter (Aleph, and itself from the Egyptian origin. The Aleph was aconsonant letter, with a guttural breath sound that was not anelement of Greek articulation; and the Greeks took it to representtheir vowel Alpha with the ä sound, the Phoenician alphabet having novowel symbols. This letter, in English, is used for several differentvowel sounds. See Guide to pronunciation, §§ 43-74. The regular longa, as in fate, etc., is a comparatively modern sound, and has takenthe place of what, till about the early part of the 17th century, wasa sound of the quality of ä (as in far).", | |
"ab": "The fifth month of the Jewish year according to theecclesiastical reckoning, the eleventh by the |
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
// Put this before your routes | |
// ---------------------------------------- | |
// Mongoose | |
// ---------------------------------------- | |
const mongoose = require('mongoose'); | |
app.use((req, res, next) => { | |
if (mongoose.connection.readyState) { | |
next(); | |
} else { |
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
function randomDate(start, end) { | |
return new Date(start.getTime() + Math.random() * (end.getTime() - start.getTime())); | |
} | |
console.log(randomDate(new Date(2012, 0, 1), 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
/* | |
Modified from this SO post: | |
https://stackoverflow.com/questions/24069344/split-spaces-avoiding-double-quoted-js-strings-from-a-b-c-d-to-a | |
*/ | |
/('|")(?:\\('|")|\\\\|[^'|"])*('|")|\S+/ | |
"a b 'c d'".match(/('|")(?:\\('|")|\\\\|[^'|"])*('|")|\S+/g) | |
//=> [ 'a', 'b', '\'c d\'' ] |
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
const fn = num => ( | |
num >= 0 && num < 10 ? '1-9' : | |
num >= 10 && num < 20 ? '10-19' : | |
num >= 20 && num < 30 ? '20-29' : | |
num >= 30 && num < 40 ? '30-39' : | |
num >= 40 && num < 50 ? '40-49' : | |
num >= 50 && num < 60 ? '50-59' : | |
num >= 60 && num < 70 ? '60-69' : | |
num >= 70 && num < 80 ? '70-79' : | |
num >= 80 && num < 90 ? '80-89' : |
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
/* | |
String Permutations Tree | |
Devise a class that when instantiated it create a tree that maps out all of the possible permutations of a given string. | |
- The root node will have a value of `undefined` | |
- The direct children of the root node will be each char of the string | |
- This pattern will continue until it maps out each unique permutation of the string |
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
{ | |
"keys": ["tab"], | |
"command": "expand_abbreviation_by_tab", | |
// put comma-separated syntax selectors for which | |
// you want to expandEmmet abbreviations into "operand" key | |
// instead of SCOPE_SELECTOR. | |
// Examples: source.js, text.html - source | |
"context": [ | |
{ |
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
const _ = require('lodash'); | |
function _createPages(current, max, delta) { | |
// Return nada if we got | |
// no pages | |
if (!max) { | |
return []; | |
} |
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
// Pagination algorithm | |
// Refactored by https://github.com/BideoWego | |
// Originally from: | |
// https://gist.github.com/kottenator/9d936eb3e4e3c3e02598 | |
function pagination(current, max, delta) { | |
// Return nada if we got | |
// no pages |