Skip to content

Instantly share code, notes, and snippets.

View CraigStuntz's full-sized avatar

Craig Stuntz CraigStuntz

View GitHub Profile

Someone said, "...the purpose of this RFC is to rank crates against each other...". I think this puts the cart before the horse. The purpose should be to help visitors to crates.io fund what they need. Ranking crates is one potential way to help, but it isn't the purpose.

Who visits crates.io and why?

Personas

Dee Veloper

let private listWithDifferences (items: 'T list) =
let rec impl (accum, start: 'T list, rest: 'T list) =
match rest with
| [] -> accum
| head :: tail -> impl((head, start @ tail) :: accum, start @ [ head ], tail)
impl([], [], items) |> List.rev
@CraigStuntz
CraigStuntz / after
Created March 29, 2012 14:07 — forked from mgroves/PEVerify output
fireweaver IL
.class private auto ansi beforefieldinit FireWeaverExample.Program
extends [mscorlib]System.Object
{
.method public hidebysig specialname rtspecialname
instance void .ctor () cil managed
{
IL_0000: ldarg.0
IL_0001: call instance void [mscorlib]System.Object::.ctor()
IL_0006: ret
}
@CraigStuntz
CraigStuntz / afmt.cs
Created November 8, 2011 13:53
Possible means of using Autofac with MassTransit
public static void main(string[] args)
{
var builder = new ContainerBuilder();
// register each consumer manually
builder.RegisterType<YourConsumer>().As<IConsumer>();
//or use Autofac's scanning capabilities -- SomeClass is any class in the correct assembly
builder.RegisterAssemblyTypes(typeof(SomeClass).Assembly).As<IConsumer>();
@CraigStuntz
CraigStuntz / DataServiceQuery.cs
Created March 23, 2011 19:05
WCF Data Services doesn't support nested aggregates. But DataServiceQuery does -- with certain gotchas.
var result = _unitOfWork.BillingBatches
.Select(batch => new BillingBatch
{
Id = batch.Id,
Description = batch.Description,
FundingSource = batch.PayerCustomer.Name,
Amount = batch.Bills.Select(bill => bill.NetTotal).Sum(), // turns into $expand -- EF would have used SQL SUM()
Created = batch.Created
});