Skip to content

Instantly share code, notes, and snippets.

@DalSoft
DalSoft / Get.cs
Last active August 29, 2015 14:14
Introducing DalSoft.RestClient the dynamic rest client
dynamic client = new RestClient("http://jsonplaceholder.typicode.com");
var post = await client.Posts(1).Get();
Assert.That(post.HttpResponseMessage.StatusCode, Is.EqualTo(HttpStatusCode.OK));
Assert.That(post.id, Is.EqualTo(1));
@DalSoft
DalSoft / h1.css
Last active August 29, 2015 14:09
Introducing Brunch Below is a trivial example, it's obviously not a production quality and is for brevity just to show brunch working http://www.dalsoft.co.uk/blog/index.php/2014/10/15/introducing-brunch
h1 {
font-size: 3rem;
color:red;
}
@DalSoft
DalSoft / Raygun4NetExtensions.cs
Last active August 29, 2015 14:03
Stop Raygun4Net logging RawData and other sensitive data
using System.Collections.Generic;
using System.Web;
using Mindscape.Raygun4Net.Messages;
namespace Logging.Extensions
{
public static class Raygun4NetExtensions
{
public static void SetNonSensitiveHttpDetails(this RaygunMessage message)
{
<appSettings>
<add key="MyAppConfig" value="
{
'Website': 'http://dalsoft.co.uk/',
'DatabaseConnectionString': 'Server=myServerAddress;Database=myDataBase;Trusted_Connection=True;'
}" />
</appSettings>
public class MyAppConfig : JsonConfig<MyAppConfig>
{
public string Website { get; set; }
public string DatabaseConnectionString { get; set; }
}
public static IDictionary<string, object> GetUnobtrusiveValidationAttributesFor<TModel, TValue>(this HtmlHelper<TModel> html, Expression<Func<TModel, TValue>> expression)
{
return html.GetUnobtrusiveValidationAttributes(ExpressionHelper.GetExpressionText(expression));
}
@DalSoft
DalSoft / RavenDBNinjectModule
Created April 11, 2012 15:43
MVC – Get RavenDB up and running in 5 minutes using Ninject
using Ninject;
using Ninject.Modules;
using Ninject.Web.Common;
using Raven.Client;
using Raven.Client.Embedded;
using Raven.Database.Server;
namespace RavenDBInFiveMinutes
{
public class RavenDBNinjectModule : NinjectModule
@DalSoft
DalSoft / ExampleModel.cs
Created January 10, 2012 12:33
ASP.NET MVC 3 - Improved JsonValueProviderFactory using Json.Net
//Example of a model that won't work with the current JsonValueProviderFactory but will work with JsonDotNetValueProviderFactory
public class CmsViewModel
{
public bool IsVisible { get; set; }
public string Content { get; set; }
public DateTime Modified { get; set; }
public DateTime Created { get; set; }
//This property will not work with the current JsonValueProviderFactory
public dynamic UserDefined { get; set; }
}