This is a little in-terminal
Please remember it's a simulation and take it with a grain of salt. 😄
- clone this gist:
git clone https://gist.github.com/Sequoia/94d192908e05f7674423 eventloop-simulation cd eventloop-simulation
| //server/boot/create-some-data.js | |
| module.exports = function(app) { | |
| //@TODO: check ENV for NODE_ENV!==PRODUCTION | |
| //data sources | |
| var mongoDs = app.dataSources.mongoDs; | |
| function createReviewers(cb) { | |
| mongoDs.automigrate('Reviewer', function(err) { | |
| if (err) return cb(err); | |
| var Reviewer = app.models.Reviewer; | |
| Reviewer.create([ |
| /* jshint esnext: true */ | |
| var input = parseInt(process.argv[2]); | |
| var iterations = Number.isNaN(input) ? 10 : input; | |
| console.log('%d iterations', iterations); | |
| var fib = function(iter){ | |
| var state; | |
| state = { curr: 1, last: 0 }; | |
| for(var i=0; i<iter-1; i++){ | |
| state = { |
| PollGh = require('./pollGh'); | |
| function handleRes(resBody){ | |
| //emit event ?? | |
| //write to another process? | |
| //write to disk? | |
| console.log(resBody); | |
| } | |
| function handleErr(err){ | |
| console.error(err); |
| //stuff shared across many vs of compose | |
| //util | |
| const call = method => (...args) => obj => obj[method](...args); | |
| let l = console.log.bind(console); | |
| /// | |
| const compose = require(/*one of them*/); | |
| //fs = [x, y, z]; | |
| //return a => x(y(z(a))); |
This is a little in-terminal
Please remember it's a simulation and take it with a grain of salt. 😄
git clone https://gist.github.com/Sequoia/94d192908e05f7674423 eventloop-simulationcd eventloop-simulation| var app = require('express')(); | |
| var luck = require('./luck-filter'); | |
| var prettyLucky = luck(0.6); | |
| var reallyQuiteLucky = luck(0.9); | |
| app.use('/blog', prettyLucky); | |
| //bad luck is contagious; only allow luckiest of all users to contact you | |
| app.use('/contact', prettyLucky); |
| var app = require('express')(); | |
| app.use('/admin',function(rq,rs){ | |
| rs.send('/admin'); | |
| }); | |
| app.use('/admin*',function(rq,rs){ | |
| rs.send('/admin*'); | |
| }); | |
| app.use('/admin/*',function(rq,rs){ | |
| rs.send('/admin/*'); |
| var express = require('express') | |
| var a1 = express(); | |
| var a2 = express(); | |
| a1.listen(3000, function(err){ | |
| if(err){ console.error('a1 ERROR!!'); } | |
| else{ console.log('Server a1 started on port 3000'); } | |
| }); | |
| function! SetSoftTab(n) | |
| "for changing tabstops | |
| let &l:shiftwidth=a:n | |
| let &l:softtabstop=a:n | |
| let &l:expandtab=1 | |
| endfunction | |
| function! SetHardTab() | |
| let &l:expandtab=0 | |
| let &l:shiftwidth=4 |
I'm just a developer not so much a core contributor so forgive me if I'm missing something, but I can't help but wonder:
require('bluebird').promisifyAll(...)? I feel like I must be missing something cuz this seems like a lot of squeeze for very little juice.From the non-core-dev peanut gallery: please don't make node core chase the latest API. The wild mix of approaches to handling async flow control exist because core doesn't pick a solution. Promises themselves have evolved quite a bit since Futures/Defereds hit the scene. If core had settled on the prevailing API of the the time (jquery/Q.deferred or whatever), a lot of this evolution might no