Skip to content

Instantly share code, notes, and snippets.

@benfoster
benfoster / gist:9009407
Created February 14, 2014 21:14
Simple pipeline example
using NUnit.Framework;
namespace PipelineDemo
{
public abstract class Handler<T>
{
protected Handler<T> next;
public void SetInnerHandler(Handler<T> handler)
{
@alexbeletsky
alexbeletsky / proc.js
Created March 22, 2014 13:23
Callbacks + Async
async.waterfall([
download,
process,
upload
], function (err, results) {
if (err) {
return console.error('processing failed, error: ', err);
}
console.log('processing completed, results: ', results);
});
<configuration>
<config>
<add key="DependencyVersion" value="HighestMinor" />
</config>
</configuration>
@damianh
damianh / ChaosMiddleware.cs
Created June 23, 2015 07:48
Middleware that trolls front end devs. Use in conjunction with LimitsMiddleware and FakeReverseProxyHost to emulate real-world scenarios. Mwhahahahah!
namespace Chaos
{
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.Owin;
using AppFunc = System.Func<System.Collections.Generic.IDictionary<string, object>, System.Threading.Tasks.Task>;
using MidFunc = System.Func<
System.Func<System.Collections.Generic.IDictionary<string, object>, System.Threading.Tasks.Task>,
System.Func<System.Collections.Generic.IDictionary<string, object>, System.Threading.Tasks.Task>>;
using System;
using System.Collections.Generic;
using System.IO;
using FluentNHibernate;
using FluentNHibernate.AutoMap;
using FluentNHibernate.Cfg.Db;
using NHibernate;
using NHibernate.Cfg;
using NHibernate.Context;
using NHibernate.Event;
@jonhilt
jonhilt / rakefile.rb
Created May 19, 2010 12:53
A simple Rake build script example
require 'albacore'
require 'fileutils'
PROJECT_NAME = "Your Project Here"
DOT_NET_PATH = "C:/Windows/Microsoft.NET/Framework/v4.0.30319/"
NUNIT_PATH = "Tools/nunit/"
MSPEC_PATH = "Tools/mspec/"
PROJECT_CONFIG = (ENV['PROJECT_CONFIG'] == nil) ? "Debug" : ENV['PROJECT_CONFIG']
COMPANY_NAME = "Your Company Here"
BUILD_NUMBER = (ENV['BUILD_NUMBER'] == nil) ? "1.0.0.0" : ENV['BUILD_NUMBER']
#!/usr/bin/env bash
# where do you want couchdb and its deps to be installed
COUCHDB_PREFIX="/opt/couchdb-1.0.1"
# Let's determine the correct arcitecture and choose the installer
if [ "`uname -m`" = "x86_64" ]; then
echo "Using 64-bit installer"
COUCHDB_INSTALLER_DOC_ID="26f246a0fe23d6a53d5326713308f43c"
COUCHDB_INSTALLER_BIN="install-couchdb-1.0.1_rel1-linux-x64.bin"
@lifeeth
lifeeth / selenium.sh
Created February 8, 2011 18:09
selenium init.d script for debian
#!/bin/bash
# /etc/init.d/selenium
# debian-compatible selenium-grid startup script.
# Based on jenkins startups
# Praneeth Bodduluri <lifeeth[at]gmail.com>
# update-rc.d -n -f selenium start 90 2 3 4 5 . stop 10 0 1 6 .
### BEGIN INIT INFO
# Provides: selenium-grid
# Required-Start: $remote_fs $syslog $network
# Required-Stop: $remote_fs $syslog $network
@ntotten
ntotten / Global.asax.cs
Created February 10, 2011 16:59
Multi-Tenant Facebook Application
public class MvcApplication : System.Web.HttpApplication
{
protected void Application_Start()
{
// Register your multi-tenant application on app startup
FacebookApplication.SetApplication(new MultiTenantFacebookApplication());
}
}
anonymous
anonymous / gist:852307
Created March 3, 2011 03:58
using System;
using System.Collections.Generic;
using System.Web;
using NHibernate;
using NHibernate.Context;
using NHibernate.Engine;
namespace WebHub.Infrastracture.SessionManagement
{