This file contains 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
import inspector from "inspector"; | |
const url2scriptid = new Map<string, string>(); | |
const session = new inspector.Session(); | |
session.connect(); | |
setupDebugger(); | |
function setupDebugger() { |
This file contains 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 echoHttp (hook) { | |
hook.debug(hook.params); | |
hook.debug(hook.req.path); | |
hook.debug(hook.req.method); | |
hook.req.pipe(hook.res); |
This file contains 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 collectLikes(arr) { | |
arr = Array.prototype.slice.call(arr); | |
if (arr.length) { | |
// our current type | |
var current_type = typeof arr[0]; | |
// our start of type | |
var left = 0; | |
return arr.reduce(function (current, value, index, arr) { | |
// only need to do work if type is different | |
if (typeof value !== current_type) { |
This file contains 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 directories = [ | |
'./app', | |
'./app/controllers', | |
'./app/helpers', | |
'./app/repositories', | |
'./app/validations', | |
'./app/views', | |
'./app/views/partials' | |
] |
This file contains 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
// Target API: | |
// | |
// var s = require('net').createStream(25, 'smtp.example.com'); | |
// s.on('connect', function() { | |
// require('starttls')(s, options, function() { | |
// if (!s.authorized) { | |
// s.destroy(); | |
// return; | |
// } | |
// |
This file contains 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
// 1: how could you rewrite the following to make it shorter? | |
if (foo) { | |
bar.doSomething(el); | |
} else { | |
bar.doSomethingElse(el); | |
} | |
This file contains 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
// 1: how could you rewrite the following to make it shorter? | |
if (foo) { | |
bar.doSomething(el); | |
} else { | |
bar.doSomethingElse(el); | |
} | |