Skip to content

Instantly share code, notes, and snippets.

View ayende's full-sized avatar

Ayende Rahien ayende

View GitHub Profile
[Fact]
public void CanQueryMapReduceIndex_WithUpdates()
{
using (var store = NewDocumentStore())
{
store.DatabaseCommands.PutIndex("TagCloud",
new IndexDefinition
{
Map =
@"
@ayende
ayende / Program.cs
Created July 22, 2011 05:59
Sample of what appears to be a memory leak in the WCF Discovery
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Net.Security;
using System.ServiceModel;
using System.ServiceModel.Discovery;
using System.Text;
using System.Threading.Tasks;
public class ConcurrentLeastFrequentlyUse<T> where T : class
{
private readonly int[] generationSizes;
private readonly ConcurrentQueue<T>[] queues;
public ConcurrentLeastFrequentlyUse(params int[] generationSizes)
{
this.generationSizes = generationSizes;
queues =new ConcurrentQueue<T>[generationSizes.Length];
}
public T GetCache<T>(string id)
{
return Cache[id] ??
Cache[id] = Session.Get<T>(id);
}
@ayende
ayende / gist:1186051
Created September 1, 2011 12:14 — forked from Andrea/gist:1186006
namespace ravenConsole
{
using System;
using System.Linq;
using Raven.Client.Document;
using Raven.Client.Indexes;
using Xunit;
public class DocumentsTests
{
@ayende
ayende / Program.cs
Created December 15, 2011 12:58
Test file to see why Esent takes big files
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using Microsoft.Isam.Esent.Interop;
namespace EsentSize
{
class Program
@ayende
ayende / gist:1669767
Created January 24, 2012 11:46
RavenDB NGram Search
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Lucene.Net.Analysis;
using Lucene.Net.Analysis.Standard;
using Lucene.Net.Analysis.Tokenattributes;
using Lucene.Net.Util;
using Raven.Abstractions.Indexing;
using Raven.Client.Linq;
using Raven.Database.Indexing;
results = RavenSession.Query<Suppliers_QueryIndex.ReduceResult, Suppliers_QueryIndex>()
.Where(x => x.LocationName == location)
.Search(x => x.Query, string.Join(" ", suggestions))
.Search(x => x.Query, term +"*")
.Take(5 - ravenResults.Count)
.As<Supplier>()
.ToList();
public class RavenController : Controller
{
private static IDocumentStore documentStore;
public static IDocumentStore DocumentStore
{
get
{
if(documentStore == null)
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Raven.Abstractions.Data;
using Raven.Abstractions.Indexing;
using Raven.Client.Bundles.MoreLikeThis;
using Raven.Client.Indexes;
using Raven.Json.Linq;
using Xunit;