Skip to content

Instantly share code, notes, and snippets.

@RobertTheGrey
RobertTheGrey / DocumentStoreExtensions.cs
Created July 3, 2012 10:01
Query Raven by Index in a unit test
public static class DocumentStoreExtensions
{
public static void SaveSessionAction(this IDocumentStore documentStore, Action<IDocumentSession> action)
{
using (IDocumentSession session = documentStore.OpenSession())
{
action(session);
session.SaveChanges();
documentStore.WaitForStaleIndexes();
}
@RobertTheGrey
RobertTheGrey / gist:2853337
Created June 1, 2012 16:24
Unless - in Spark
<div>
<var arg="5"/>
<unless condition="arg==5">
<p>argis5</p>
</unless>
<unless condition="arg==6">
<p>argisnot6</p>
</unless>
</div>
@RobertTheGrey
RobertTheGrey / gist:2846383
Created May 31, 2012 21:19
Spark conditional rendering
<!-- conditional node -->
<p if='model.IsFull' class='resultmessage'>The list is full</p>
<!-- conditional attribute -->
<ul>
<li each="var product in Products" class="first?{productIsFirst} last?{productIsLast}">
${product.Name}
</li>
@RobertTheGrey
RobertTheGrey / gist:2695164
Created May 14, 2012 17:22
IIS rewrite to remove WWW from the URL
<rewrite>
<rules>
<rule name="CanonicalHostNameRule1">
<match url="(.*)" />
<conditions>
<add input="{HTTP_HOST}" pattern="^grandiflora\.co\.za$" negate="true" />
</conditions>
<action type="Redirect" url="http://grandiflora.co.za/{R:1}" />
</rule>
</rules>