Skip to content

Instantly share code, notes, and snippets.

public class Startup
{
public void Configuration(IAppBuilder app)
{
var routingOptions = new RoutingOptions() { Routes = new Dictionary<string, Func<IDictionary<string, object>, Task>>() };
routingOptions.Routes.Add("/plop", environment =>
{
var responseBody = (Stream)environment["owin.ResponseBody"];
var writer = new StreamWriter(responseBody);
writer.AutoFlush = true;
WHERE (0 = [Extent2].[IsDeleted]) AND ( EXISTS (SELECT
1 AS [C1]
FROM (SELECT
[UnionAll51].[C1] AS [C1]
FROM (SELECT
[UnionAll50].[C1] AS [C1]
FROM (SELECT
[UnionAll49].[C1] AS [C1]
FROM (SELECT
[UnionAll48].[C1] AS [C1]
@jchannon
jchannon / gist:8904557
Created February 9, 2014 19:18
loadtest
Jonathans-iMac:bin jonathanchannon$ node loadtest -n 10000 -c 1000 http://localhost:1337/
[Sun Feb 09 2014 18:55:39 GMT+0000 (GMT)] INFO Requests: 0 (0%), requests per second: 0, mean latency: 0 ms
[Sun Feb 09 2014 18:55:44 GMT+0000 (GMT)] INFO
[Sun Feb 09 2014 18:55:44 GMT+0000 (GMT)] INFO Target URL: http://localhost:1337/
[Sun Feb 09 2014 18:55:44 GMT+0000 (GMT)] INFO Max requests: 10000
[Sun Feb 09 2014 18:55:44 GMT+0000 (GMT)] INFO Concurrency level: 1000
[Sun Feb 09 2014 18:55:44 GMT+0000 (GMT)] INFO Agent: none
[Sun Feb 09 2014 18:55:44 GMT+0000 (GMT)] INFO
[Sun Feb 09 2014 18:55:44 GMT+0000 (GMT)] INFO Completed requests: 10000
[Sun Feb 09 2014 18:55:44 GMT+0000 (GMT)] INFO Total errors: 532
Jonathans-iMac:jstestbed jonathanchannon$ sudo npm install -g node-inspector
Password:
npm http GET https://registry.npmjs.org/node-inspector
npm http 304 https://registry.npmjs.org/node-inspector
npm http GET https://registry.npmjs.org/socket.io
npm http GET https://registry.npmjs.org/express
npm http GET https://registry.npmjs.org/async
npm http GET https://registry.npmjs.org/glob
npm http GET https://registry.npmjs.org/rc
npm http GET https://registry.npmjs.org/strong-data-uri
var getFiles = function () {
console.log('got files');
return fs.readdirAsync(process.cwd() + "/zips/").filter(function (filename) {
return path.extname(filename) == '.zip';
});
};
then(getFiles).
map(function (filename) {
console.log('on: ' + filename);
return unzipFile(filename)
}).
then(function () {
console.log('read xml file after unzip');
}).
catch (TypeError, function (e) {
console.dir(e);
'use strict';
var path = require('path');
var AdmZip = require('adm-zip');
var Promise = require("bluebird");
var fs = Promise.promisifyAll(require('fs'));
var glob = require('glob');
module.exports = (function () {
var aTimer;
var aFtpClient;
@jchannon
jchannon / ??.js
Last active August 29, 2015 13:57
'use strict';
var path = require('path');
var AdmZip = require('adm-zip');
var Promise = require("bluebird");
var fs = Promise.promisifyAll(require('fs'));
var glob = require('glob');
module.exports = (function () {
var aTimer;
var aFtpClient;
var fs = require('fs'),
path = require('path'),
Promise = require('rsvp').Promise,
request = require('request'),
files = [
'https://www.google.com/images/srpr/logo11w.png',
'http://rack.1.mshcdn.com/media/ZgkyMDEzLzA5LzE2L2JjL0Jpbmdsb2dvb3JhLmFkYjJkLnBuZwpwCXRodW1iCTEyMDB4OTYwMD4/996d9598/35b/Bing-logo-orange-RGB.png',
'http://assets.fontsinuse.com/static/use-media-items/15/14246/full-2048x768/52c4c6bc/Yahoo_Logo.png'
A cyclical dependency was detected between the constructors of two services.
Activation path:
2) Injection of dependency IFilterType into parameter filterTypes of constructor of type MessageFilterer
1) Request for IMessageFilterer
Suggestions:
1) Ensure that you have not declared a dependency for IFilterType on any implementations of the service.
2) Consider combining the services into a single one to remove the cycle.
3) Use property injection instead of constructor injection, and implement IInitializable