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 Net = require('node:net') | |
const Repl = require('node:repl') | |
const Vm = require('node:vm') | |
const Fastify = require('fastify')({ logger: true }) | |
const Jsonic = require('@jsonic/jsonic-next') | |
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
module.exports = function( options ) { | |
var seneca = this | |
var plugin = 'loadbalance-transport' | |
var so = seneca.options() | |
options = seneca.util.deepextend( | |
{ | |
loadbalance: { | |
workers: [ ... ] |
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
seneca.act({role:'web',use:{ | |
name:name, | |
prefix:'/well/:event/', | |
pin:{role:name,cmd:'*'}, | |
map:{ | |
whoami:{GET:setcontext}, | |
leader:{GET:setcontext}, | |
members: { alias:'player/members/:team', GET: setcontext }, |
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://en.wikipedia.org/wiki/Dara_Ó_Briain | |
http://desbishop.net/ | |
http://en.wikipedia.org/wiki/Russell_Howard | |
http://en.wikipedia.org/wiki/Michael_McIntyre | |
http://en.wikipedia.org/wiki/Have_I_Got_News_For_You | |
http://en.wikipedia.org/wiki/Mock_the_Week | |
http://www.bbc.co.uk/programmes/b008cnxn | |
http://www.thecatlaughs.com/ |
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
/* | |
Workaround for property order inconsistency in Chrome V8. | |
Although unspecified by ECMA, most JavaScript engines return | |
properties in insertion order when you use for..in to iterate through | |
them. | |
For example: |
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
// the stack trace you really want that tells you how you originally got to the fs.readFile call | |
var stacktrace = new Error() | |
Error.captureStackTrace(stacktrace) | |
fs.readFile( path, encoding, function(err,data) { | |
if( err ) { | |
var stackerr = new Error('Unable to read file: '+path+' (error code: '+err.code+')') | |
stackerr.errno = err.errno | |
stackerr.code = err.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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta name="viewport" content="user-scalable=no,initial-scale=1.0,maximum-scale=1.0" /> | |
<style> | |
body { padding:10px; margin:0px; background-color: #ccc; } | |
#main { margin: 10px auto 0px auto; } | |
</style> |
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
#main { | |
margin: 0px; | |
width: 480px; | |
height: 300px; | |
} |
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
function StreamBuffer(req) { | |
var self = this | |
var buffer = [] | |
var ended = false | |
var ondata = null | |
var onend = null | |
self.ondata = function(f) { | |
for(var i = 0; i < buffer.length; i++ ) { |
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
socket.on('error', function(err) { | |
debug('AGENT SOCKET ERROR: ' + err.message); | |
var req; | |
if (socket._httpMessage) { | |
req = socket._httpMessage; | |
} else if (self.queue.length) { | |
req = self.queue.shift(); | |
assert(req._queue === self.queue); | |
req._queue = null; | |
} else { |
NewerOlder