Skip to content

Instantly share code, notes, and snippets.

View ayende's full-sized avatar

Ayende Rahien ayende

View GitHub Profile
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;
private static User FindUser(DocumentStore docStore, string query)
{
using (var session = docStore.OpenSession())
{
var q = session.Query<User>("Users/Search")
.Search(x=>x.Name, query);
var user = q.FirstOrDefault();
if (user != null)
using System.Linq;
using Orders;
using Raven.Abstractions.Indexing;
using Raven.Client.Indexes;
namespace RavenDB.Course.Nov2015
{
public class Users_Search :
AbstractIndexCreationTask<User, Users_Search.Result>
{
using System;
using System.Linq;
using Raven.Abstractions.Indexing;
using Raven.Client;
using Raven.Client.Indexes;
using Xunit;
namespace Raven.Tests.MailingList
{
public class NullableIssue : RavenTest
using System;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using System.Web.Http;
using System.Web.Http.Controllers;
using Raven.Client;
using Raven.Client.Document;
namespace Webinars.Controllers
@ayende
ayende / test.cpp
Created March 26, 2013 21:24
Two code samples showing differences between shift operators in C# & C++ Any idea why?
uint32_t x = 25426435u;
std::cout << x << std::endl;
uint32_t a = (x >> 17);
uint32_t b = (x << 15);
std::cout <<a << " " << b << " " << (a | b) << std::endl;
//OUTPUT:
// 25426435
// 193 4244733952 4244734145
using System;
using System.Linq;
using Raven.Abstractions.Smuggler;
using Raven.Client.Indexes;
using Raven.Database.Smuggler;
using Raven.Tests.Helpers;
using Xunit;
namespace RavenTests
{
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication2
{
class Program
public class ProperlyFlushFileStream : FileStream
{
[DllImport("kernel32.dll")]
static extern bool FlushFileBuffers(IntPtr hFile);
public void FSync()
{
base.Flush(false);
if(!FlushFileBuffers(SafeFileHandle))