Skip to content

Instantly share code, notes, and snippets.

View DevJohnC's full-sized avatar

John Carruthers DevJohnC

View GitHub Profile
@DevJohnC
DevJohnC / gist:3829524
Created October 3, 2012 20:08
Early RSA signing DTO
using System;
using System.Collections.Generic;
using System.Security.Cryptography;
using ServiceStack.Text;
namespace FragLabs.VOIP.Common.DTOs
{
/// <summary>
/// Base class for DTOs that must be securely signed using the RSA algorithm.
/// </summary>
@DevJohnC
DevJohnC / gist:4151070
Created November 26, 2012 22:26
Adjutant extension loading
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace FragLabs.Adjutant.API.Server.Extensions
{
/// <summary>
/// Extension loader.
public interface IService<out TResponse, in TRequest>
{
TResponse Call(TRequest request);
}
public interface IPlayTrack : IService<MediaControlResponse,MediaFile>{}
@DevJohnC
DevJohnC / gist:5218964
Created March 22, 2013 04:37
A* implementation
private IPath AStar(SquareGridWorldLocation start, SquareGridWorldLocation goal, NetworkType validNodeTypes)
{
var closedSet = new Dictionary<int, Node>();
var openSet = new Dictionary<int, Node> {{start.GetHashCode(), new Node() {WorldLocation = start}}};
var cameFrom = new Dictionary<int, Node>();
while (openSet.Count > 0)
{
var current = Lowest(openSet);
if (current.WorldLocation.Equals(goal))
namespace ProjectX.API.App_Start
{
public class AppHost
: AppHostBase
{
public static OrmLiteConnectionFactory Database { get; set; }
public AppHost() //Tell ServiceStack the name and where to find your web services
: base("ProjectX Restful API", typeof(Services.ArtistService).Assembly) { }
class SomeThing
{
public SomeThing(IFoo foo, IBar bar)
{
}
}
interface IFoo {}
interface IBar {}
@DevJohnC
DevJohnC / gist:5457950
Created April 25, 2013 06:43
EncryptedClient that wraps another IClient
using System;
using FragLabs.Adjutant.Network.Interfaces;
namespace FragLabs.Adjutant.Network.Crypto
{
public class EncryptedClient : MarshalByRefObject, IClient
{
private readonly IClient _baseClient;
private readonly ISecurityCredentials _credentials;
private readonly ICredentialsVerifier _verifier;
@DevJohnC
DevJohnC / gist:5471179
Created April 26, 2013 23:45
WPF Testing FFT
using System;
using System.IO;
using System.Windows;
using FragLabs.Audio.Engines;
using FragLabs.Audio.Engines.OpenAL;
namespace VoiceRecognition
{
/// <summary>
/// Interaction logic for MainWindow.xaml
using System;
using System.Collections;
using System.Collections.Generic;
namespace FragLabs.Adjutant.API.Interfaces
{
/// <summary>
/// Data access provider.
/// </summary>
public interface IDataProvider
using System;
using System.IO;
using System.Windows;
using FragLabs.Audio.Engines;
using FragLabs.Audio.Engines.OpenAL;
namespace VoiceRecognition
{
/// <summary>
/// Interaction logic for MainWindow.xaml