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 Promise = require('bluebird'); | |
| var CLIENT_URL = 'https://js.stripe.com/v2/'; | |
| var PUBLISHABLE_KEY = '...'; | |
| var _promise; | |
| function loadClient() { | |
| // If we haven't started loading yet, create a promise | |
| if (!_promise) { |
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
| class Firebase { | |
| url = null | |
| headers = { | |
| "Content-Type": "application/json" | |
| } | |
| constructor(url) { | |
| this.url = url | |
| } | |
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 categories = new Promise(function(resolve, reject) { | |
| var onChange = function() { | |
| CategoryStore.removeChangeListener('change', onChange) | |
| resolve(CategoryStore.getAll()) | |
| } | |
| CategoryStore.addChangeListener('change', onChange) | |
| CategoryActions.loadAll() | |
| }) |
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
| /* global jest */ | |
| var superagent = jest.genMockFunction().mockReturnThis(); | |
| var Response = jest.genMockFunction().mockImplementation(function() { | |
| this.status = 200; | |
| this.ok = true; | |
| }); | |
| Response.prototype.get = jest.genMockFunction(); |
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
| 'use strict'; | |
| var KEYS = { | |
| enter: 13, | |
| left: 37, | |
| right: 39, | |
| escape: 27, | |
| backspace: 8, | |
| comma: 188, | |
| shift: 16, |
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
| \},\s+[\}\]] |
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 lodash = require('lodash') | |
| var getAncestors = function(node, nodes) { | |
| var ancestors = [] | |
| var ancestor = node | |
| while (ancestor) { | |
| ancestors.unshift(ancestor) | |
| ancestor = lodash.find(nodes, {id: ancestor.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
| var webpack = require('webpack') | |
| var config = { | |
| devtool: 'source-map', | |
| entry: { | |
| app: [ | |
| './src/styles/index.styl', | |
| './src/scripts/index.js', | |
| 'moment/locale/nb' |
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') | |
| var server = express() | |
| server.use(express.static('build')) | |
| server.use(function(request, response) { | |
| response.sendfile('src/index.html') | |
| }); | |
| server.listen(3000) |
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 middleware = function(routes) { | |
| return function(req, res, next) { | |
| var path = req.path | |
| var query = req.query | |
| var match = Router.matchRoutes(routes, path, query) | |
| if (!match.route) return next() | |
| var props = lodash.reduceRight(match.activeTrace, function(props, trace) { | |
| return lodash.assign(props, trace.match) |