Skip to content

Instantly share code, notes, and snippets.

View jasondentler's full-sized avatar

Jason Dentler jasondentler

View GitHub Profile
@jasondentler
jasondentler / FacetSetup.cs
Last active December 10, 2015 21:59
RavenDB Faceted Search blog post
// Run when we initialize the database, along with uploading indices and stuff
session.Store(new FacetSetup()
{
Facets = HomeSearchFacetSetup.Facets().ToList(),
Id = HomeSearchFacetSetup.HomeSearchFacetDocumentId
});
namespace DWH.Website.Facets
{
public class HomeSearchFacetSetup
@jasondentler
jasondentler / MapMarkerData.cs
Created December 14, 2012 19:53
Crazy spatial index
using System;
namespace DWH.Website.ViewModels
{
public class MapMarkerData
{
public enum MarkerType
{
Community,
CentralLiving,
@jasondentler
jasondentler / BundleCollectionExtensions.cs
Created November 19, 2012 13:47
Cassette, bundle per directory, recursive
using System;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Web;
using System.Web.Hosting;
using Cassette;
using Cassette.HtmlTemplates;
using Cassette.IO;
using Cassette.Scripts;
@jasondentler
jasondentler / IMediaService.cs
Created November 12, 2012 16:52
IMediaService
using System;
namespace DWH.Website
{
public static class IMediaService
{
public interface Community
{
@jasondentler
jasondentler / ScriptedPatchTests.cs
Created October 11, 2012 09:54
Raven Sanity Check
using NUnit.Framework;
using Raven.Abstractions.Data;
using Raven.Client;
using Raven.Client.Embedded;
using Raven.Database.Json;
using Raven.Json.Linq;
using SharpTestsEx;
namespace RavenDB.SanityCheck
{
@jasondentler
jasondentler / Index.cs
Created September 5, 2012 20:19
Raven search
public class Students_ByCourse : AbstractIndexCreationTask<Student>
{
public Students_ByCourse()
{
Map = students => from student in students
select new {student.Course};
Indexes.Add(s => s.Course, FieldIndexing.Analyzed);
}
@jasondentler
jasondentler / City.js
Created August 30, 2012 12:55
Floor plan VM index issue
var doc = {
"Id": "a04d38cd-ab02-41cd-ac67-2070f214daf5",
"MarketId": "778ac624-2337-4c6c-a741-20175aa694e7",
"Name": "Katy",
"StateAbbreviation": "TX"
};
@jasondentler
jasondentler / GetRandomUnusedPort.cs
Created August 11, 2012 02:07
Integration Testing Part 2
public static int GetRandomUnusedPort()
{
var listener = new TcpListener(IPAddress.Any, 0);
listener.Start();
var port = ((IPEndPoint)listener.LocalEndpoint).Port;
listener.Stop();
return port;
}
@jasondentler
jasondentler / ClearIECache.cs
Created August 11, 2012 01:01
Integration Testing Part 1
public void Clear()
{
const string exe = "RunDll32.exe";
const string args = "InetCpl.cpl,ClearMyTracksByProcess 8";
var si = new ProcessStartInfo(exe, args)
{
UseShellExecute = false,
CreateNoWindow = true
};
var process = Process.Start(si);
@jasondentler
jasondentler / AuctionGrowl.js
Created February 26, 2012 01:05
NServiceBus-and-SignalR
/// <reference path="~/scripts/lib"/>
$(function() {
var auctionHub = $.connection.auctionHub;
auctionHub.onBidAccepted = function(itemId, itemName, amount) {
$.pnotify({
pnotify_title: "Out bid",
pnotify_text: "The new high bid for " + itemName + " is " + amount + ".",
pnotify_sticker: false
});
};