Reference: nodejs/node#9618
git clone https://github.com/targos/node.git node-async-await
cd node-async-await
git checkout v8-5.5
./configure
make -j4
// Custom bound parameters. | |
// :something for values and ?something for identifiers. | |
// https://github.com/mysqljs/mysql#custom-format | |
const DIRECTIONS = ['ASC', 'DESC']; | |
module.exports = function(query, values) { | |
if (!values) { | |
return query; | |
} |
141M node_modules/ | |
26M node_modules/typescript | |
8.9M node_modules/caniuse-db | |
7.4M node_modules/rxjs | |
6.9M node_modules/core-js | |
5.7M node_modules/node-sass | |
5.3M node_modules/webpack | |
5.1M node_modules/less | |
4.9M node_modules/lodash | |
2.4M node_modules/har-validator |
Local<Object> TermQuery(Local<Value> termString) { | |
Local<Object> variables = Nan::New<Object>(); | |
String::Utf8Value string(termString); | |
term_t t = PL_new_term_ref(); | |
if (!PL_chars_to_term(*string, t)) { | |
Nan::ThrowError("PL_chars_to_term failed."); | |
return variables; | |
} | |
functor_t f; | |
if (!PL_get_functor(t, &f)) { |
// http://www.javaist.com/blog/2008/11/06/eight-queens-problem-in-prolog/ | |
const EMPTY_LIST = []; | |
function* between(start, end) { | |
for (let v = start; v < end; v++) { | |
yield v; | |
} | |
} |
const assert = require('assert'); | |
// Helper to debounce function calls. | |
module.exports = (time, fn) => { | |
assert.equal(typeof time, 'number'); | |
assert.equal(typeof fn, 'function'); | |
let debounce = false; | |
return function() { | |
if (debounce) { |
// Middleware to redirect to HTTPS. | |
module.exports = () => { | |
return (req, res, next) => { | |
if (req.protocol !== 'https') { | |
const host = req.hostname; | |
if (host && !req.url.match(/\.well-known/)) { | |
res.redirect(301, `https://${host}${req.url}`); | |
} else { | |
next(); |
server { | |
location ~ ^/something(.*)$ { | |
return 301 https://someplace.com; | |
} | |
return 301 https://example.com; | |
} |
Reference: nodejs/node#9618
git clone https://github.com/targos/node.git node-async-await
cd node-async-await
git checkout v8-5.5
./configure
make -j4
$ optipng download.png | |
** Processing: download.png | |
658x318 pixels, 4x8 bits/pixel, RGB+alpha | |
Reducing image to 8 bits/pixel, 113 colors (112 transparent) in palette | |
Input IDAT size = 11654 bytes | |
Input file size = 11723 bytes | |
Trying: | |
zc = 9 zm = 8 zs = 0 f = 0 IDAT size = 3451 | |
zc = 9 zm = 8 zs = 1 f = 0 IDAT size = 3419 |
User.pre('save', wrap(async () => { | |
var user = this; | |
if (!user.isModified('password')) return; | |
var salt = await bcrypt.genSalt(10); | |
var hash = await bcrypts.hash(user.password, salt, null); | |
user.password = hash; | |
})); | |
const wrap = (fn) => { | |
return (next) => { |