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
const express = require('express') | |
const bodyParser = require('body-parser') | |
const store = require('./store') | |
const app = express() | |
app.use(express.static('public')) | |
app.use(bodyParser.json()) | |
app.post('/createUser', (req, res) => { | |
store |
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
// http://tools.ietf.org/html/rfc6265#section-4.1.1 | |
var allowedChars = [0x21, [0x23, 0x2B], [0x2D, 0x3A], [0x3C, 0x5B], [0x5D, 0x7E]] | |
var chars = [] | |
allowedChars.forEach(function (range) { | |
if (!range.length) { | |
chars.push(String.fromCharCode(range)) | |
return | |
} | |
for (var code = range[0]; code < range[1]; code++) { | |
chars.push(String.fromCharCode(code)) |
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("jquery"); | |
var Router = require("cherrytree"); | |
var Route = require("cherrytree/route"); | |
var HistoryLocation = require("cherrytree/location/history_location"); | |
// for router to keep the app's state in sync with the url | |
// we need to use a custom location, the default `none` location | |
// doesn't touch the URL. This allows you implementing your own | |
// URL manager say if you want to save some space, or you already | |
// use a framework that can manage URLs like Backbone. |
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
// Change require to new context | |
var newRequire = require.config({ | |
context: "new" | |
}); | |
// Define and then require module under context "new" | |
define("someModule", [], function () {return "newContext"; }); | |
newRequire(["someModule"], function (something) {console.log(something); }); | |
// Revert back to global context |