Skip to content

Instantly share code, notes, and snippets.

@davisford
davisford / SocketStream.publish.spy.js
Created June 18, 2012 16:03
Using sinon.js to stub net.Socket and SocketStream pub/sub
// Example test that spies on SocketStream.publish.channel() calls
// Using Mocha to drive: http://visionmedia.github.com/mocha/
// sinon.js for stubs/mocks/spies: http://sinonjs.org
// should.js for assertions: https://github.com/visionmedia/should.js
var sinon = require('sinon')
, should = require('should')
, ss = require('socketstream').start();
describe("Spying on SocketStream for testing", function() {
@assaframan
assaframan / MongoDBAuthRepository.cs
Created June 3, 2012 04:41
This is a MangoDB implementation of ServiceStack's IUserAuthRepository.
//////////////////////////////////
// A more updated version of this code could be found here:
// https://github.com/ServiceStack/ServiceStack.Contrib/blob/master/src/ServiceStack.Authentication.MongoDB/MongoDBAuthRepository.cs
///////////////////
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text.RegularExpressions;
using ServiceStack.Common;
@cyberzed
cyberzed / ServiceClient.cs
Created February 15, 2012 19:59
Rx powered ServiceStack SL Client
public class ServiceClient<TRequest, TResponse>
where TRequest : class
where TResponse : class
{
private readonly string _baseUri;
private ISubject<TResponse> completionChannel;
public ServiceClient(string baseUri = "/api")
{
// make sure the base uri is set appropriately