Skip to content

Instantly share code, notes, and snippets.

View afifmohammed's full-sized avatar
💭
(+2)(-3)

Afif Mohammed afifmohammed

💭
(+2)(-3)
View GitHub Profile
@afifmohammed
afifmohammed / queriteusage.cs
Created April 22, 2012 03:49
new querite api
public class FileSystem
{
public void Evaluate(IFolder folder)
{
int? count;
TimeSpan? howLong;
var firstTen = Query(folder)
.Statistics(x => count = x.Count)
.Statistics(x => howLong = x.ExecutionSpan)
@afifmohammed
afifmohammed / raventransformuerytest.cs
Last active October 12, 2015 17:47
raven transform query
namespace RavenIndexSandbox.Customers
{
using System;
using System.Collections.Generic;
using System.Linq;
using FizzWare.NBuilder;
using NUnit.Framework;
using Raven.Client;
using Raven.Client.Embedded;
using Raven.Client.Indexes;
@afifmohammed
afifmohammed / ravenlocationstest.cs
Last active October 12, 2015 21:39
multipmap reduce on locations
namespace RavenIndexSandbox
{
using System;
using System.Linq;
using NUnit.Framework;
using Raven.Client.Embedded;
using Raven.Client.Indexes;
[TestFixture]
public class WhenGroupinByLocation
@afifmohammed
afifmohammed / multimapreducespatialquery.cs
Last active December 14, 2015 04:18
test for a spatial query over a multi map reduce index
namespace MultiMapSpatialTests
{
using System;
using System.Collections.Generic;
using System.Linq;
using NUnit.Framework;
using Raven.Client.Embedded;
using Raven.Client.Indexes;
[Serializable]
namespace Sagas
{
using System;
using System.Collections.Generic;
class Program
{
static ActivityHost[] processes;
public class ConcurrentGateway
{
private ConcurrentQueue<Action> _workQueue = new ConcurrentQueue<Action>();
private int _writeLock = 0;
private static AutoResetEvent _waitEvent = new AutoResetEvent(false);
protected static AutoResetEvent GetThreadWaitEvent()
{
//returns same event for all threads ,but we could easily provide a
@afifmohammed
afifmohammed / stacktest.cs
Last active August 29, 2015 13:56
Test that proves using a Stack<T> as a property on a document does not work with RavenDB
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Raven.Imports.Newtonsoft.Json;
using Raven.Tests.Helpers;
using Xunit;
@afifmohammed
afifmohammed / mastermasteridentitytest.cs
Last active August 29, 2015 13:56
Testing sequential generation of ids when storing documents with master master setup in parallel execution
void Main()
{
var orders = false;
if(orders)
ParallelExecute(db => {
using(var session = db.OpenSession())
{
var list = new [] {new Order(), new Order()};
foreach (var order in list)
using System;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Collections.Concurrent;
using System.Reflection.Emit;
using System.Threading;
@afifmohammed
afifmohammed / autofacdecoration.cs
Created May 4, 2015 03:24
autofac docoration by hand
void Main()
{
var c = new ContainerBuilder();
c.RegisterInLifetimeScope<Handler, ConcreteReflectionActivatorData>(x => x.RegisterType<Handler>());
var scope = c.Build();
scope.Resolve<IHandler>().Dump();
}