Skip to content

Instantly share code, notes, and snippets.

View mfloryan's full-sized avatar
:octocat:

Marcin Floryan mfloryan

:octocat:
View GitHub Profile

Keybase proof

I hereby claim:

  • I am mfloryan on github.
  • I am mfloryan (https://keybase.io/mfloryan) on keybase.
  • I have a public key whose fingerprint is 1537 05E8 0FCE 9D0B 15FD BA22 7A3D 36D5 DDAC 8CB1

To claim this, I am signing this object:

public DistributorThrottler(
IDistributorProviderConfiguration distributorProviderConfiguration,
IPropertySource propertyStore) {
counter = new Counter();
numberOfProviders = distributorProviderConfiguration.NumberOfEnabledProviders;
var maximumPossibleRequestsInFlight =
HomeDistributorProviderProperty
.ProviderMaxRequestsPending
.From(propertyStore).ToInt() * numberOfProviders;
@mfloryan
mfloryan / app.config
Created July 8, 2014 19:28
WCF capture messages
<system.diagnostics>
<sources>
<source name="System.ServiceModel.MessageLogging">
<listeners>
<add name="messages"
type="System.Diagnostics.XmlWriterTraceListener"
initializeData="c:\logs\messages.svclog" />
</listeners>
</source>
</sources>
@mfloryan
mfloryan / example.js
Created February 3, 2014 13:17
LoDash foo
var list = [
{ colour: 'Blue', taste: 'sweet'},
{ colour: 'Green', taste: 'bitter'}
];
var result = _.map(list, function(item) { return _.omit(item,'taste')});
@mfloryan
mfloryan / twitter-dump.js
Created October 5, 2012 21:54
First Experience with OAuth and node.js
var oauth = require('oauth-client');
var twitterFeed = (function() {
var pub = {};
var body = {
track: ''
};
@mfloryan
mfloryan / EnumerableExtensions.cs
Created January 18, 2012 13:53
Enumerate a tree deep
public static class EnumerableExtensions
{
public static IEnumerable<T> SelectDeep<T>(
this IEnumerable<T> source, Func<T, IEnumerable<T>> selector)
{
if (source == null) yield break;
foreach (T item in source)
{
yield return item;
foreach (T subItem in SelectDeep(selector(item), selector))
@mfloryan
mfloryan / ServiceClientBaseHeaderInjectingExtension.cs
Created January 16, 2012 15:33
ServiceClientBaseHeaderInjectingExtension
using System;
using System.Security.Principal;
using System.ServiceModel;
using System.ServiceModel.Channels;
using Adp.Shared.Security;
namespace Adp.Shared.ServiceClient
{
public static class ServiceClientBaseHeaderInjectingExtension
{
@mfloryan
mfloryan / md5.cs
Created August 16, 2011 13:55
MD5 for Strings in C#
static string getMd5Hash(string input)
{
// Create a new instance of the MD5CryptoServiceProvider object.
MD5CryptoServiceProvider md5Hasher = new MD5CryptoServiceProvider();
// Convert the input string to a byte array and compute the hash.
byte[] data = md5Hasher.ComputeHash(Encoding.Default.GetBytes(input));
// Create a new Stringbuilder to collect the bytes
// and create a string.
@mfloryan
mfloryan / decorator.cs
Created June 29, 2011 10:55
Unity Decorator Setup
unityContainer.RegisterType(typeof (Interface), typeof (ConcreteImplementation), "RealDeal");
unityContainer.RegisterType(typeof (Interface), typeof (DecoratedImplementation), new InjectionConstructor(unityContainer.Resolve<Interface>("RealDeal")));
@mfloryan
mfloryan / InitialiserFromInstance.cs
Created June 9, 2011 10:49
InitialiserFromInstance
using System;
using System.Reflection;
using System.Text;
namespace Adp.Run.Mobile.Payrun
{
public static class InitialiserFromInstance
{
public static string Create(object o)