Skip to content

Instantly share code, notes, and snippets.

View phillip-haydon's full-sized avatar
💭
Banana's are yellow.

Phillip Haydon phillip-haydon

💭
Banana's are yellow.
View GitHub Profile
@echo off
:: ----------------------
:: KUDU Deployment Script
:: ----------------------
:: Setup
:: -----
setlocal enabledelayedexpansion
public static class Enums
{
public static IList<dynamic> ListFrom<T>()
{
var list = new List<dynamic>();
var enumType = typeof(T);
foreach (var o in Enum.GetValues(enumType))
{
list.Add(new
@phillip-haydon
phillip-haydon / archive.cshtml
Created July 9, 2013 17:31
Sample view for BuildStarted
@inherits Nancy.ViewEngines.Razor.NancyRazorViewBase<Sandra.Snow.PreCompiler.PostData>
@using System.Collections.Generic
@{
Layout = "default.cshtml";
}
<h1>Archives</h1>
@foreach(var year in Model.PostsGroupedByYearThenMonth)
{
PM> install-package RavenDB.Embedded -pre
Attempting to resolve dependency 'RavenDB.Database (= 2.5.2653-Unstable)'.
Attempting to resolve dependency 'Microsoft.CompilerServices.AsyncTargetingPack'.
Attempting to resolve dependency 'System.Spatial (≥ 5.2)'.
Attempting to resolve dependency 'WindowsAzure.Storage (≥ 2.0)'.
Attempting to resolve dependency 'Microsoft.Data.OData (≥ 5.2.0)'.
Attempting to resolve dependency 'Microsoft.Data.Edm (= 5.2.0)'.
Attempting to resolve dependency 'Microsoft.WindowsAzure.ConfigurationManager (≥ 1.8.0.0)'.
Attempting to resolve dependency 'RavenDB.Client (= 2.5.2653-Unstable)'.
@phillip-haydon
phillip-haydon / gist:6316587
Last active December 21, 2015 13:59
Weather in New Zealand

In the morning the clouds gather, and they sit and have coffee and discuss the daily plan.

Their conversions are like: "Yo, lets head on over there, and rain on those fuckers, after an hour when they have given up on their plans and got out their umbrella's, we will head on over there, but we wont rain, we will just block out the sun and be assholes, then we will head back where we started and rain on those fuckers again for thinking it was going to be a nice day. Later, we will head down south and be really windy and blow some shit around and make a mess. At about 2pm we will go have a late lunch, before heading back to rain on those fuckers again while they collect their kids from school, ruin their evening, and call it a day."

When given two routes:
Get["/{name}"] _ => "Hello, " + _.name;
Get["/phillip"] _ => "Phillip is awesome!";
Both these routes are identical, but we need to parse the url against both every time.
http://mysite.com/phillip
^ This route is matched twice.
<div class="field">
<label>Gender</label>
<div class="ui dropdown selection">
<input type="hidden" name="gender">
<i class="dropdown icon"></i>
<div class="default text">...</div>
<div class="menu">
<div class="item" data-value="male">Male</div>
<div class="item" data-value="female">Female</div>
</div>
Nancy.RequestExecutionException: Oh noes! ---> System.AggregateException: One or more errors occurred. ---> System.AggregateException: One or more errors occurred. ---> System.NotSupportedException: Specified method is not supported.
at Raven.Client.Document.DocumentSession.Raven.Client.Linq.IDocumentQueryGenerator.AsyncQuery[T](String indexName, Boolean isMapReduce) in c:\Builds\RavenDB-Unstable-v2.5\Raven.Client.Lightweight\Document\DocumentSession.cs:line 758
at Raven.Client.Linq.RavenQueryProviderProcessor`1.GetAsyncLuceneQueryFor(Expression expression) in c:\Builds\RavenDB-Unstable-v2.5\Raven.Client.Lightweight\Linq\RavenQueryProviderProcessor.cs:line 1452
at Raven.Client.Linq.RavenQueryProvider`1.ToAsyncLuceneQuery[TResult](Expression expression) in c:\Builds\RavenDB-Unstable-v2.5\Raven.Client.Lightweight\Linq\RavenQueryProvider.cs:line 251
at Raven.Client.LinqExtensions.ToListAsync[T](IQueryable`1 source) in c:\Builds\RavenDB-Unstable-v2.5\Raven.Client.Lightweight\PublicExtensions\LinqExten
//Wont work
var thing = @"Value=One
Value=Two";
//Will work
var thing = "Value=One\nValue=Two"
store.DatabaseCommands.Patch("videos/", new[]
{
new PatchRequest
{
Type = PatchCommandType.Modify,
Name = "@metadata",
Nested = new[]
{
new PatchRequest
{